Skip to main content

TRX

tokenviewAbout 1 min

TRX

Create Transaction

POST https://services.tokenview.io/vipapi/onchainwallet/trx?apikey={apikey}

Parameters

Apply to: Create a TRX transaction.

The POST request BODY is text in JSON format as follows:

{"owner_address":"{hexadecimal}", "to_address":"{hexadecimal}","amount":1,"method":"createtransaction","visible":{true means base58,false means hexadecimal}}

Correct answer format

{"result":"tx hash","jsonrpc": "2.0", "id":"viewtoken"}

Error answer format

{"result":null,"error":{"code":error code,"message":"error msg"},"jsonrpc": "2.0", "id":"viewtoken"}

Request

curl --location 'https://services.tokenview.io/onchainwallet/trx' \
--header 'Content-Type: application/json' \
--data '{"owner_address":"TGmzDFttsXBRpU8NHbx28Tb4Pq8GopZK8x","to_address":"TERJLhmbLMAJx85kzMpc91Zuan5F96FL37","amount":1,"visible":true,"method":"createtransaction"}'

Response

{"visible":true,"txID":"86faa885b10aac7f17c4d4d8a4d94b3dc64f7722b44b7966044c8edf0e1ccc4d","raw_data":{"contract":[{"parameter":{"value":{"amount":1,"owner_address":"TGmzDFttsXBRpU8NHbx28Tb4Pq8GopZK8x","to_address":"TERJLhmbLMAJx85kzMpc91Zuan5F96FL37"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"31db","ref_block_hash":"b16decf21e06738c","expiration":1606057407000,"timestamp":1606057350364},"raw_data_hex":"0a0231db2208b16decf21e06738c4098e4ec83df2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a15414aa9a0ed45321706f2618384a399e3fee73f13fc12154130cfc6507f8d4d3972d8ad74f3feaeeb44b6a19f180170dca9e983df2e"}

Create TRC20 Token Transaction

POST https://services.tokenview.io/vipapi/onchainwallet/trx?apikey={apikey}

Parameters

Apply to: Create the TRC2O transaction.

The POST request BODY is text in JSON format as follows:

{"owner_address":"{hexadecimal}", "to_address":"{hexadecimal}","amount":1,"method":"createtransaction","visible":{true means base58,false means hexadecimal}}

Correct answer format

{"result":"tx hash","jsonrpc": "2.0", "id":"viewtoken"}

Error answer format

{"result":null,"error":{"code":error code,"message":"error msg"},"jsonrpc": "2.0", "id":"viewtoken"}

Request

curl --location 'https://services.tokenview.io/vipapi/onchainwallet/trx' \
--header 'Content-Type: application/json' \
--data '{
"contract_address": "412dd04f7b26176aa130823bcc67449d1f451eb98f",
"owner_address": "411fafb1e96dfe4f609e2259bfaf8c77b60c535b93",
"function_selector": "transfer (address, uint256)",
"parameter": "0000000000000000000000002ed5dd8a98aea00ae32517742ea5289761b2710e0000000000000000000000000000000000000000000000000000000ba43b7400",
"call_value": 0,
"fee_limit": 1000000000,
"method":"triggersmartcontract"
} '

Response

{"result":{"code":"CONTRACT_VALIDATE_ERROR","message":"4e6f20636f6e7472616374206f72206e6f7420612076616c696420736d61727420636f6e7472616374"}}

TriggerSmartContract

POST https://services.tokenview.io/vipapi/onchainwallet/trx?apikey={apikey}

Parameters

Apply to: Send a transaction that has been signed and sent into the block.

The POST request BODY is text in JSON format as follows:

{"from":"{hexadecimal output address}", "to":"{hexadecimal input address}","amount":1,"signature":["hexadecimal signature"],"method":"broadcasttransaction"}

Correct answer format

{"result":"tx hash","jsonrpc": "2.0", "id":"viewtoken"}

Error answer format

{"result":null,"error":{"code":error code,"message":"error msg"},"jsonrpc": "2.0", "id":"viewtoken"}

Request

curl --location 'https://services.tokenview.io/onchainwallet/trx' \
--header 'Content-Type: application/json' \
--data '{"raw_data":"{\"contract\":[{\"parameter\":{\"value\":{\"amount\":1,\"owner_address\":\"TTRy1wgrn3gxeZybWNdKuPYU64kBLQ6Zmd\",\"to_address\":\"TGmzDFttsXBRpU8NHbx28Tb4Pq8GopZK8x\"},\"type_url\":\"type.googleapis.com/protocol.TransferContract\"},\"type\":\"TransferContract\"}],\"ref_block_bytes\":\"2ba9\",\"ref_block_hash\":\"efa970b152152a86\",\"expiration\":1606052703000,\"timestamp\":1606052647030}","raw_data_hex":"0a022ba92208efa970b152152a864098d6cd81df2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a1541bf89b206a6f347baf1de420f0356dccf62f2221f1215414aa9a0ed45321706f2618384a399e3fee73f13fc180170f6a0ca81df2e","signature":["7584150f82bd13ece4861e7fdb67cc4efe20da30e8467c3026db8a36951dbadca92b86a0d23a43b251bad138925f8c6025aedb9eed2c9785af1832f3d6b2b0dd01"],"txID":"923db55dd6bf012901b715debda10e2fb60fc1ff618747464da6c19720aa6188","visible":true,"method":"broadcasttransaction"}'

Response

{"code":"SIGERROR","txid":"923db55dd6bf012901b715debda10e2fb60fc1ff618747464da6c19720aa6188","message":"validate signature error 7584150f82bd13ece4861e7fdb67cc4efe20da30e8467c3026db8a36951dbadca92b86a0d23a43b251bad138925f8c6025aedb9eed2c9785af1832f3d6b2b0dd01 is signed by TBeL7J8XEKPdgvMFn9WSJNLZLTUFxRRBMb but it is not contained of permission."}

Last update: