triggersmartcontract - Tron
triggersmartcontract. Creates an unsigned transaction that calls a function on a deployed smart contract.
triggersmartcontract - tron [Value: 20CU]
Creates an unsigned transaction that calls a function on a deployed smart contract.
Use cases
- Build a TRC20 token transfer transaction before signing and broadcasting
- Call a state-changing DeFi contract method (swap, stake, claim)
Constraints
- fee_limit is required and capped at the protocol maximum (1,500,000 TRX)
- The returned transaction is unsigned and must be broadcast separately
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl --request POST \
--url https://lb.drpc.live/tron/{API-KEY}/wallet/triggersmartcontract \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "contract_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "function_selector": "example", "parameter": "example", "data": "example", "fee_limit": 1, "call_value": 1, "call_token_value": 1, "token_id": 1, "visible": true}'Response
200
{
"result": { "result": true },
"energy_used": 13859,
"constant_result": ["0000000000000000000000000000000000000000000000000000000000000001"],
"transaction": {
"visible": true,
"txID": "fbc18aa61f0ef6feed8683d44fe9b854bcc0000000000000000000000000000",
"raw_data": {
"contract": [{
"parameter": {
"value": {
"data": "a9059cbb00000000000000000000000041a614f89f8a93d7f8824f607c7b2a3c3e0d5e190000000000000000000000000000000000000000000000000000000000000064",
"owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
"contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs"
},
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
},
"type": "TriggerSmartContract"
}],
"ref_block_bytes": "5e4b",
"ref_block_hash": "47c9dc89341b300d",
"expiration": 1591089627000,
"fee_limit": 100000000,
"timestamp": 1591089567635
},
"raw_data_hex": "0a025e4b220847c9dc89341b300d..."
}
}Request params
idinteger
jsonrpcstring
methodstring
object
owner_addressstring
[Required] The deploying account's address
contract_addressstring
[Required]Contract address. (Format: Base58 or Hex)
function_selectorstring
Function selector. Example: transfer(address,uint256)
datastring
This field transmits the necessary data for smart contract interaction, including the function being called and its parameters. You may choose to use the data field, which contains the complete ABI-encoded information, or use the function_selector and parameter fields separately. Note that if both data and function_selector are present, the system will prioritize using the function_selector and parameter fields for the contract interaction.
parameterstring
Constructor parameters (hex, appended to bytecode)
fee_limitinteger
[Required] Maximum TRX, in sun, the caller will burn for energy on this deployment
call_valueinteger
Amount of TRX, in sun, sent to the contract's constructor
token_idint64
TRC-10 token id sent with the deployment
call_token_valueint64
TRC-10 amount sent with the deployment
Permission_idinteger
Multi-sig permission ID
visibleboolean
When true, addresses are base58check strings; when false (default), hex strings
Response
200
Creates an unsigned transaction that calls a function on a deployed smart contract.Response params
object
resultobject
The outcome of constructing (and, for read-only calls, executing) this transaction.
object
resultboolean
Whether the transaction was successfully built without errors.
transactionobject
The unsigned transaction object built from the call parameters, ready to be signed and broadcast.
object
visibleboolean
Indicates whether addresses in this transaction are represented in base58 format (true) or hex format (false).
txIDstring
The unique transaction hash (transaction ID), computed as the SHA256 of raw_data.
raw_dataobject
The unsigned transaction body containing the contract instruction and blockchain reference data.
object
contractarray_of_objects
The list of contract instructions to be executed by this transaction.
object
parameterobject
The typed payload describing the specific contract call being made.
object
valueobject
The decoded fields of the contract — here, a smart contract call (e.g. a TRC20 token transfer).
object
datastring
The hex-encoded ABI-encoded call data, including the function selector and its arguments.
owner_addressstring
The address initiating the smart contract call, in hex format.
contract_addressstring
The address of the smart contract being invoked, in hex format.
type_urlstring
The fully qualified protobuf type identifier describing which contract schema `value` should be decoded with.
typestring
The human-readable name of the contract type being executed (here, TriggerSmartContract).
ref_block_bytesstring
The last two bytes of the reference block number, used for transaction expiration and replay protection.
ref_block_hashstring
The last eight bytes of the reference block's hash, paired with ref_block_bytes for replay protection.
fee_limitinteger
The maximum amount of TRX, in sun, the caller is willing to spend on Energy fees for this contract call.
expirationinteger
Unix timestamp, in ms, after which this transaction is no longer valid and will be rejected by the network.
timestampinteger
Unix timestamp, in ms, marking when the transaction was constructed.
raw_data_hexstring
The hex-encoded serialized bytes of raw_data, used as the actual payload to sign and broadcast.