Sitemap
2 min readOct 11, 2025

--

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

TRON-TIP712-DEMO
├─ build/contracts/
├─ contracts/
│ ├─ Migrations.sol
│ └─ Tip712Verifier.sol
├─ migrations/
│ └─ 2_deploy_tip712.js
├─ demo.js
├─ tronbox.js
├─ .env
├─ .env.sample
└─ package.json

Press enter or click to view image in full size
Press enter or click to view image in full size

const domain = { name: NAME, version: VERSION, chainId: CHAIN_ID, verifyingContract: VERIFYING_CONTRACT };

const types = {
Person: [{ name: ‘name’, type: ‘string’ }, { name: ‘wallet’, type: ‘address’ }],
Mail: [{ name: ‘from’, type: ‘Person’ }, { name: ‘to’, type: ‘Person’ }, { name: ‘contents’, type: ‘string’ }, { name: ‘nonce’, type: ‘uint256’ }]
};

const value = {
from: { name: ‘Cow’, wallet: signer },
to: { name: ‘Bob’, wallet: signer },
contents: ‘Hello TIP-712 on TRON!’,
nonce: Date.now()
};

Press enter or click to view image in full size

let signature = await tronWeb.trx._signTypedData(domain, types, value);
let raw = signature.startsWith(‘0x’) ? signature.slice(2) : signature;
const vHex = raw.slice(128, 130);
if (vHex === ‘00’) raw = raw.slice(0, 128) + ‘1b’;
else if (vHex === ‘01’) raw = raw.slice(0, 128) + ‘1c’;
signature = ‘0x’ + raw;

Press enter or click to view image in full size

const contract = await tronWeb.contract(abi, VERIFYING_CONTRACT);
const okOnChain = await contract.verify(
[[value.from.name, value.from.wallet],
[value.to.name, value.to.wallet],
value.contents,
value.nonce],
signer,
signature
).call();

Press enter or click to view image in full size
Press enter or click to view image in full size

--

--

TRON DAO Arabic
TRON DAO Arabic

Written by TRON DAO Arabic

ترون | بروتوكول لامركزي قائم على البلوكتشين وهو ملتزم بتحسين البنية التحتية لشبكة الإنترنت اللامركزية

No responses yet