TrueChain introduces a powerful and user-friendly feature known as gas fee delegation, allowing decentralized applications (DApps) to enhance user onboarding by covering transaction costs on behalf of their users. This capability removes one of the biggest barriers to mainstream blockchain adoption: the need for new users to first acquire cryptocurrency just to perform simple actions like voting, registration, or data submission.
With gas delegation, the transaction initiator (the from address) and the gas payer (the payment address) can be two different accounts. This enables seamless, frictionless interactions where users engage with DApps without holding any funds — ideal for lightweight smart contract operations.
This guide dives into the structure, signing process, and sending mechanism of TrueTransactions, highlighting key differences from standard Ethereum transactions and demonstrating practical implementation using web3t.js.
Understanding TrueTransaction Structure
Compared to traditional Ethereum transactions, TrueChain enhances the transaction format with two optional but powerful fields:
fee– String: An additional fee (in wei) paid directly to miners. In the future, high-priority smart contracts (e.g., ST projects) may enforce minimum fee thresholds to ensure fast processing.payment– 32 Bytes: The address responsible for paying gas fees. If valid and properly signed, the network deducts gas from this account instead of the sender’s (from) balance.
We refer to these enhanced transactions as TrueTransactions, and all related methods in web3t.js are prefixed with True for clarity.
🔍 Why explicitly declare the
paymentfield?
Although nodes could theoretically derive the payment address from signatures, explicitly including it prevents misuse. It ensures that no party — including the payer — can bypass the intended delegation flow by submitting the transaction directly and inadvertently charging the sender.⚠️ Important Note: Because TrueTransactions require two separate digital signatures, there is no single
sendTrueTransaction()method. Instead, developers must first sign the transaction in two stages, then broadcast the final signed payload usingsendSignedTrueTransaction().
👉 Discover how to integrate gasless transactions into your DApp today.
Signing a Gas-Delegated Transaction
The web3t.js library extends the web3t.eth.accounts object with new methods tailored for TrueTransaction handling:
signTransaction()– Enhanced version supportingfeeandpaymentfields.signPrePaymentTransaction()– Signs the initial transaction on behalf of the user.signPaymentTransaction()– Finalizes the transaction with the gas payer’s signature.
Let’s walk through each step.
1. Using signTransaction() – Standard Signing with Delegation Support
This method supports both regular Ethereum transactions and TrueTransactions. When you include the payment field, it prepares a delegatable transaction.
Parameters
tx– Object: Standard transaction object with optionalfeeandpayment.privateKey– String: Private key of the sender (not the gas payer).callback– Function (optional): Returns error or result asynchronously.
Returns
trueHash– String: Hash of the extended transaction includingfeeandpayment.trueRawTransaction– String: RLP-encoded signed transaction ready for broadcasting if no further delegation is needed.
💡 Even when usingfeeorpayment, this method also generates a backward-compatible Ethereum-style signature underrawTransaction.
Example
web3t.eth.accounts.signTransaction({
to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
value: '1000000000',
gas: '21000',
gasPrice: '1000000',
chainId: '10',
fee: '500000',
payment: '0x2b5ad5c4795c026514f8317c7a215e218dccd6cf'
}, '0x01')
.then(console.log);This outputs both standard and TrueChain-specific fields, giving flexibility in how you handle the transaction downstream.
2. Using signPrePaymentTransaction() – First Signature (User Side)
This method creates a pre-signed transaction — not broadcastable on its own — used as input for the second signing phase.
Parameters
Same as signTransaction():
- Transaction object with
payment - Sender’s private key
Returns
preSignedRawTx– String: RLP-encoded transaction containing the first signature and chain metadata.- Other standard signature components (
r,s,v,messageHash)
Example
web3t.eth.accounts.signPrePaymentTransaction({
nonce: 0,
gasPrice: '1000000',
gas: 21000,
to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
value: '1000000000',
payment: '0x2b5ad5c4795c026514f8317c7a215e218dccd6cf',
chainId: 10
}, '0x01')
.then(console.log);The resulting preSignedRawTx is sent securely to the service or backend that will apply the second signature.
3. Using signPaymentTransaction() – Second Signature (Service Side)
This method applies the final signature from the gas-paying account, completing the delegation process.
Parameters
preSignedRawTx– Output from previous stepprivateKey– Private key of the gas payer- Optional callback
Returns
- Fully formed
rawTransactionwith both signatures embedded - Final
v,r,s, and updatedmessageHash
Example
web3t.eth.accounts.signPaymentTransaction(
'0xf87f8083...', // preSignedRawTx from earlier
'0x02'
)
.then(console.log);The output is a complete, valid TrueRawTransaction ready for submission.
👉 Learn how OKX supports advanced blockchain integrations for developers.
Broadcasting the Signed Transaction
Once both signatures are applied, use:
sendSignedTrueTransaction()
This method sends the finalized TrueRawTransaction to the network via RPC. Its interface mirrors web3.eth.sendSignedTransaction(), but only accepts transactions with TrueChain-specific fields (fee, payment).
✅ Use this exclusively for gas-delegated transactions.
❌ Do not usesendSignedTransaction()— it will reject extended fields.
Example
const tx = '0xf8bf80...'; // Final raw transaction from signPaymentTransaction
web3t.eth.sendSignedTrueTransaction(tx)
.on('transactionHash', hash => console.log('Tx Hash:', hash))
.on('receipt', receipt => console.log('Receipt:', receipt));Frequently Asked Questions (FAQ)
Q1: Why can’t I use sendTrueTransaction() directly?
Because gas delegation requires two independent signatures, there’s no way to securely perform both within a single client-side call. Separating signing stages ensures security and flexibility — especially important when private keys are stored separately (e.g., user wallet vs. backend signer).
Q2: Can a user still be charged if delegation fails?
No. If the payment account fails to sign or has insufficient balance, the transaction simply won’t be mined. The sender’s funds remain untouched. This makes gas delegation safe for end users.
Q3: Is gas delegation secure for service providers?
Yes — as long as proper access controls are in place. The service must validate every pre-signed transaction before applying its signature to prevent spam or abuse. Rate limiting and whitelisting contracts are recommended practices.
Q4: Can I delegate gas without paying extra fees?
Absolutely. The fee field is optional. You can set only the payment field to cover base gas costs without offering additional miner incentives.
Q5: Are TrueTransactions compatible with Ethereum tooling?
Partially. Standard wallets and explorers may not recognize payment or display incorrect sender balances unless they’re updated for TrueChain rules. However, execution logic remains EVM-compatible.
Q6: Where should I host a gas delegation service?
You can run it as a secure backend microservice, part of your DApp infrastructure. In the future, TrueChain plans to formalize this as an off-chain protocol component, enabling shared, trustless delegation networks.
Core Keywords
- Gas fee delegation
- TrueTransaction
- web3t.js
- DApp onboarding
- Blockchain user experience
- Smart contract interaction
- Transaction signing
- Gasless transactions
By enabling gasless interactions, TrueChain empowers developers to build intuitive, accessible Web3 experiences. With clear separation between action initiators and cost bearers, applications can now onboard users instantly — no crypto purchase required.
Whether you're building a voting platform, NFT minting site, or decentralized identity system, integrating gas delegation via web3t.js streamlines your UX while maintaining full security and decentralization.
👉 Start building smarter DApps with seamless transaction flows now.