Skip to main content

DeployContract

POST

Deploys a contract. Returns TransactionExtention, which contains an unsigned transaction.
Path Parameters
chainstringrequired
Parameter specifying the target chain to query.
networkstringrequired
Parameter specifying the network of the target chain.
Request Body
owner_addressstringrequired
Transaction initiator address. (Format: Base58 or Hex)
abistring
Smart contract ABI.Example: "[{"constant":false,"inputs":[{"name":"key","type":"uint256"},{"name":"value","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"key","type":"uint256"}],"name":"get","outputs":[{"name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]"
bytecodestring
Bytecode of the smart contract.Example: 608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029
fee_limitinteger
Maximum TRX (in sun) the caller agrees to pay for transaction fees. (Unit: sun). Example: 1000000000 (1,000 TRX)
parameterstring
The parameters passed to the contract's constructor function.(ABI-encoded format)
origin_energy_limitinteger
Maximum Energy the contract deployer is willing to subsidize per call. Must be > 0; typical value: 1,000,000–10,000,000. Example: 100000000
namestring
Contract name
call_valueinteger
Amount of TRX transferred into the contract at deployment. (Unit: sun)
consume_user_resource_percentinteger
Percentage of Energy paid by the contract caller (vs. the deployer). Range: 0–100. Default: 0 (deployer pays all). Example: 10 (caller pays 10%, deployer pays 90%).
visibleboolean
Optional. Set to true to format addresses in Base58; set to false for hex format. (Default: false)
Responses
owner_addressstring
Transaction initiator address. (Format: Base58 or Hex)
new_contractobject
Data of the deployed smart contract. See GetContract for fields.
call_token_valueint64
Amount of TRC-10 token transferred into the contract.
token_idinteger
TRC-10 token id
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "400"
}
cURL
curl -X POST 'https://tron-mainnet.nodit.io/wallet/deploycontract' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"abi": "\"[{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]\"",
"bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029",
"origin_energy_limit": 100000000
}'