Gas Fee Delegation in TrueChain — A Developer's Guide

·

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:

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 payment field?
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 using sendSignedTrueTransaction().

👉 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:

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

Returns

💡 Even when using fee or payment, this method also generates a backward-compatible Ethereum-style signature under rawTransaction.

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():

Returns

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

Returns

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 use sendSignedTransaction() — 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


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.