Transformers node query API
The interface introduced in this chapter is the Transformers node information query interface
Query class interface
The following interfaces are the default APIs of the mainnet node and can be called directly.
The data type returned by the interface is in json format.
GetBlockByHeight
- Get block height
Just request the "GetBlockByHeight" interface from the request node without any parameters
For example: http://IP:port/GetBlockByHeight
curl http://localhost:20620/GetBlockByHeight -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{"beginHeight":"2484", "endHeight":"2584"}
}
'
Parameter:
{
"id":"1",
"jsonrpc":"2.0",
"params":{"beginHeight":"2484", "endHeight":"2584"}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetBlockByHeight",
"result": {
"blocks": [
{
"block": {
"blocksign": [
{
"pub": "MCowBQYDK2VwAyEAYc23TU7Tw6L9QcUXNM6FuS5kEzTTQEfX15dR9+n251Y=",
"sign": "nYmcHtPifKAydKyaP8UOhfyPsxLfUg4cscFx4aW8BdGp0MzBnJGajgrYr35QY2QGMh8KSsldcjwqaDP1t4aZAA==",
"signaddr": "0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce"
}
],
"bytes": 2398,
"data": {
"dependentCTx": ""
},
"hash": "0x85b85a2b88a9c993f44c21f45e43ff537eacfe08257d913ac9adcda223d14d4c",
"height": 2484,
"merkleroot": "0x446bd7acc5487883475b2c581f0c343bd9630adc35c88b584a52d5a2faec7ce8",
"prevhash": "0xd0e8f63a7479df2cec92c701b4650eff8fbb31af6dba955f426b6966ea4541da",
"time": 1717401536067676
},
"tx": [
{
"Consensus": 7,
"Type": "Tx",
"data": {
"TxInfo": {
"BonusAddr": "0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce",
"InvestAmount": 800000000000,
"InvestType": "Normal"
}
},
"identity": "0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce",
"info": "MQ==",
"time": 1717401535678450,
"txHash": "0x446bd7acc5487883475b2c581f0c343bd9630adc35c88b584a52d5a2faec7ce8",
"txType": 4,
"utxo": {
"multisign": [
{
"pub": "agc3qfYFfCGRHMJLSm/M37b32hITmFbt0VokGeECaEKazDrrUVDvwmRHY7QH/6lNMuuCVyfebhSjUr3AXW1ECg==",
"sign": "agc3qfYFfCGRHMJLSm/M37b32hITmFbt0VokGeECaEKazDrrUVDvwmRHY7QH/6lNMuuCVyfebhSjUr3AXW1ECg=="
}
],
"owner": [
"0x638c172F63db3caf32c410D0188143E0Eff74bC8"
],
"vin": {
"prevout": {
"hash": [
"0xd738eaacbba575fff85f12d356bba157ff6dc1fcdf6c470ddf4d15cca26db7c5"
]
},
"vinsign": [
{
"pub": "MCowBQYDK2VwAyEA878WPUVdMcjoPM+ZI1qC59e8nLgNXi/MAGIRFyU0kPM=",
"sign": "4H63JOxLz7T4ZxLaVAd3VMS3JUCAfv1blpaNVOM8vFyKrkk5NULHay5unpWlXQjIDEjOJCWo9jttJsoBXJbhBw=="
}
]
},
"vout": [
{
"addr": "VirtualInvest",
"value": 800000000000
},
{
"addr": "0x638c172F63db3caf32c410D0188143E0Eff74bC8",
"value": 2199999967700
},
{
"addr": "VirtualBurnGas",
"value": 32300
}
]
},
"verifySign": [
{
"pub": "MCowBQYDK2VwAyEAYc23TU7Tw6L9QcUXNM6FuS5kEzTTQEfX15dR9+n251Y=",
"sign": "5+excKFT9ZgiLS12P2zrRzy565esiAtckqcFpsjWHY/6gWAJv6++5m9mn+P5eRhK8kU2iBGS4cIY7+lxadWiAA==",
"signaddr": "0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce"
}
]
}
]
}
],
"code": 0,
"message": "success"
}
}
GetAllStakeNodeList
- Get all stake node list
Just request the "GetAllStakeNodeList" interface from the request node without any parameters
For example: http://IP:port/GetAllStakeNodeList
curl http://localhost:20620/GetAllStakeNodeList -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}
'
Parameter:
{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetAllStakeNodeList",
"result": {
"code": 0,
"list": {
"list": [
{
"addr": "0x01921896D8AAC12B19BC8413135907AB5aE82326",
"height": "590",
"identity": "MCowBQYDK2VwAyEAnkb8f/5s/LsQXNlU7/SDXR2sPf8IZZrbZ9v2HmYJffk=",
"ip": "192.168.1.86",
"version": "1_1.0.0_d"
},
{
"addr": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f",
"height": "590",
"identity": "MCowBQYDK2VwAyEAHDoLfSX+ygmvSICr/1Q/UnfLlPFkAQBB4oPZne/SoVo=",
"ip": "192.168.1.118",
"version": "1_1.0.0_d"
}
],
"message": "success",
"version": "1_1.0.0_d"
},
"message": "success"
}
}
GetBalance
- Get TTOS address balance
For example: http://IP:port/GetBalance
curl http://localhost:20620/GetBalance -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{"addr":"0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f"}
}
'
Parameter:
{
"id":"1",
"jsonrpc":"2.0",
"params":{"addr":"0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f"}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetBalance",
"result": {
"balance": "1905999939500",
"code": 0,
"message": "success"
}
}
Actual amount = balance/100000000
ConfirmTransaction
- Confirm whether the transaction is on the chain
For example: http://IP:port/ConfirmTransaction
curl http://localhost:20620/ConfirmTransaction -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{
"txhash":"64e91e7fa9ce873a1891806ae1adcc0af98d38ff78660c8408ad9caa81c67495",
"height": "500"
}
}
'
Parameter:
{
"id":"1",
"jsonrpc":"2.0",
"params":{
"txhash":"64e91e7fa9ce873a1891806ae1adcc0af98d38ff78660c8408ad9caa81c67495",
"height": "500"
}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "ConfirmTransaction",
"result": {
"code": 0,
"message": "",
"percent": "1.000000",
"receivedsize": "27",
"sendsize": "34",
"tx": {
"Consensus": 7,
"Type": "Tx",
"data": {
"TxInfo": {
"BonusAddr": "0xFFFF91572cC21352BD6044f91506294f4B01D73D",
"InvestAmount": 1000000000000,
"InvestType": "Normal"
}
},
"identity": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f",
"time": 1716775934685374,
"txHash": "0x64e91e7fa9ce873a1891806ae1adcc0af98d38ff78660c8408ad9caa81c67495",
"txType": 4,
"utxo": {
"multisign": [
{
"pub": "Hv7Z7SrYgnK9WGI0qZJJkCcDBVG5mYZlAN2fe0RsdEEIY3i9iAbRK+JtT+hxrv1+pWJeR3IdT/81Mx6TlAkkAg==",
"sign": "Hv7Z7SrYgnK9WGI0qZJJkCcDBVG5mYZlAN2fe0RsdEEIY3i9iAbRK+JtT+hxrv1+pWJeR3IdT/81Mx6TlAkkAg=="
}
],
"owner": [
"0xFFFF91572cC21352BD6044f91506294f4B01D73D"
],
"vin": {
"prevout": {
"hash": [
"0x7dd57386b958cb7ad02170bd5c190e369c1694f596d524d2b2bfa5e1a55c253b"
]
},
"vinsign": [
{
"pub": "MCowBQYDK2VwAyEA+X/pIfbC/gTA+iuG5yoLn6AH90PFdko5gWfURmCYC90=",
"sign": "eArBhLH2J24CjgE6SnPMV1/p+5Uqyuh2QwCwD7ldeqpJ63hPpcQ0n9CiNXh8CNPeKJNufduL1WjfDvqHymiZBA=="
}
]
},
"vout": [
{
"addr": "VirtualInvest",
"value": 1000000000000
},
{
"addr": "0xFFFF91572cC21352BD6044f91506294f4B01D73D",
"value": 6998899999939100
},
{
"addr": "VirtualBurnGas",
"value": 32400
}
]
},
"verifySign": [
{
"pub": "MCowBQYDK2VwAyEAHDoLfSX+ygmvSICr/1Q/UnfLlPFkAQBB4oPZne/SoVo=",
"sign": "bCoIyAR1qH5LDHpX5Y5E5OqZogQo0EDDPnihTaPDHV5jQdT9AEadCo/+uhRMOi7l9XlwxhrCcxesnfJDXbQmCg==",
"signaddr": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f"
}
]
},
"txhash": "0x64e91e7fa9ce873a1891806ae1adcc0af98d38ff78660c8408ad9caa81c67495"
}
}
GetTransactionByHash
- Get transaction information interface
For example: http://IP:port/GetTransactionByHash
curl http://localhost:20620/GetTransactionByHash -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{"txHash":"434026a97ff15f3519a95f3600c527d8b68cc72f279a4e36705b526900cbfbf0"}
}
'
Parameter:
{
"id":"1",
"jsonrpc":"2.0",
"params":{"txHash":"434026a97ff15f3519a95f3600c527d8b68cc72f279a4e36705b526900cbfbf0"}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetTransactionByHash",
"result": {
"code": 0,
"message": "success",
"tx": {
"Consensus": 7,
"Type": "Tx",
"data": {
"TxInfo": {
"BonusAddr": "0xFFFF91572cC21352BD6044f91506294f4B01D73D",
"InvestAmount": 1000000000000,
"InvestType": "Normal"
}
},
"identity": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f",
"time": 1716775934685374,
"txHash": "0x64e91e7fa9ce873a1891806ae1adcc0af98d38ff78660c8408ad9caa81c67495",
"txType": 4,
"utxo": {
"multisign": [
{
"pub": "Hv7Z7SrYgnK9WGI0qZJJkCcDBVG5mYZlAN2fe0RsdEEIY3i9iAbRK+JtT+hxrv1+pWJeR3IdT/81Mx6TlAkkAg==",
"sign": "Hv7Z7SrYgnK9WGI0qZJJkCcDBVG5mYZlAN2fe0RsdEEIY3i9iAbRK+JtT+hxrv1+pWJeR3IdT/81Mx6TlAkkAg=="
}
],
"owner": [
"0xFFFF91572cC21352BD6044f91506294f4B01D73D"
],
"vin": {
"prevout": {
"hash": [
"0x7dd57386b958cb7ad02170bd5c190e369c1694f596d524d2b2bfa5e1a55c253b"
]
},
"vinsign": [
{
"pub": "MCowBQYDK2VwAyEA+X/pIfbC/gTA+iuG5yoLn6AH90PFdko5gWfURmCYC90=",
"sign": "eArBhLH2J24CjgE6SnPMV1/p+5Uqyuh2QwCwD7ldeqpJ63hPpcQ0n9CiNXh8CNPeKJNufduL1WjfDvqHymiZBA=="
}
]
},
"vout": [
{
"addr": "VirtualInvest",
"value": 1000000000000
},
{
"addr": "0xFFFF91572cC21352BD6044f91506294f4B01D73D",
"value": 6998899999939100
},
{
"addr": "VirtualBurnGas",
"value": 32400
}
]
},
"verifySign": [
{
"pub": "MCowBQYDK2VwAyEAHDoLfSX+ygmvSICr/1Q/UnfLlPFkAQBB4oPZne/SoVo=",
"sign": "bCoIyAR1qH5LDHpX5Y5E5OqZogQo0EDDPnihTaPDHV5jQdT9AEadCo/+uhRMOi7l9XlwxhrCcxesnfJDXbQmCg==",
"signaddr": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f"
}
]
}
}
}
GetBlockNumber
- Get top block number info
For example: http://IP:port/GetBlockNumber
curl http://localhost:20620/GetBlockNumber -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
}
'
Return as follows:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetBlockNumber",
"result": {
"code": 0,
"message": "success",
"top": "590"
}
}
info interface
- View the status of node links
return data in non-json format.
For example: http://IP:20620/pub
Return:
file_name:./tfs_v1.1.0_68d583b_testnet
==================================
ca_active_task:0
ca_pending_task:0
==================================
net_active_task:0
net_pending_task:0
==================================
broadcast_active_task:0
broadcast_pending_task:0
==================================
tx_active_task:0
tx_pending_task:0
==================================
syncBlock_active_task:0
syncBlock_pending_task:0
==================================
saveBlock_active_task:0
saveBlock_pending_task:0
==================================
block_active_task:0
block_pending_task:0
==================================
work_active_task:0
work_pending_task:0
==================================
g_queueRead:0
g_queueWork:0
g_queueWrite:0
------------------------------------------
BlockMsg: 3 size: 0.032 MB
BuildBlockBroadcastMsg: 44 size: 0.579 MB
CheckTxAck: 1378 size: 0.541 MB
KeyExchangeRequest: 400 size: 0.0645 MB
KeyExchangeResponse: 250 size: 0.0403 MB
NodeHeightChangedReq: 82936 size: 16.4 MB
PingReq: 9866 size: 0.847 MB
PongReq: 9725 size: 0.835 MB
RegisterNodeAck: 148 size: 2.17 MB
RegisterNodeReq: 281 size: 0.0909 MB
SeekPreHashByHightReq: 10 size: 0.00152 MB
SyncGetBlockAck: 115 size: 0.584 MB
SyncGetBlockReq: 5 size: 0.0176 MB
SyncGetHeightHashAck: 5188 size: 2.61 MB
SyncGetHeightHashReq: 3265 size: 0.504 MB
SyncGetSumHashAck: 2880 size: 20.6 MB
SyncGetSumHashReq: 4655 size: 0.715 MB
SyncNodeAck: 1183 size: 15.6 MB
SyncNodeHashAck: 3746 size: 0.797 MB
SyncNodeHashReq: 6013 size: 0.895 MB
SyncNodeReq: 1325 size: 0.197 MB
newSeekContractPreHashReq: 12 size: 0.0027 MB
------------------------------------------
Count: 133428 Total: 64.1 MB
amount:
0x079da3A25c2F5C6B25552D86683DC48a5f45f1a1:99940000
Public PeerNode size is: 117
------------------------------------------------------------------------------------------------------------
ip(46.4.64.123) port(35566) ip_l(52.8.162.216) port_l(20619) kind(2) fd(103) addr(0x019F52d4552C417F1cF2d19a829874E9957A53F5) pulse(3) height( 157 ) name(dnsarz) version(1_1.1.0_t) logo(https://s3.amazonaws.com/keybase_processed_uploads/d351ed361a4fb96af568efa01c80b505_360_360.jpg)
ip(84.247.167.223) port(58666) ip_l(52.8.162.216) port_l(20619) kind(1) fd(115) addr(0x0318aedfaB29543f83ba285164454D2CE6cF39dF) pulse(3) height( 157 ) name(Moonlighter) version(1_1.1.0_t) logo(https://i.ibb.co/vDNZXf6/43675.png)
ip(213.21.202.33) port(46288) ip_l(52.8.162.216) port_l(20619) kind(1) fd(65) addr(0x0375f4371472871A01E03472Ea5043A50c8A18e3) pulse(3) height( 0 ) name() version(1_1.1.0_t) logo()
ip(144.217.180.121) port(33346) ip_l(52.8.162.216) port_l(20619) kind(1) fd(33) addr(0x06E43Ae952d6AeA45210C00dCe4113A606FE9fc8) pulse(3) height( 157 ) name() version(1_1.1.0_t) logo()
------------------------------------------------------------------------------------------------------------
PeerNode size is: 117
TTOS transaction
GetTransaction
- Step1: sign transaction
For example: http://IP:port/GetTransaction
curl http://localhost:20620/GetTransaction -X POST -H "Content-Type: application/json" -d '
{
"id": "",
"jsonrpc": "",
"params": {
"fromAddr": [
"0xcED97dA085527Fe7e1772CA59Aa1e64A78143128"
],
"isFindUtxo": false,
"toAddr": [
{
"addr": "0x06BA76F46631d4F344d1344303895001F1E3Af29",
"value": "13.5"
}
],
"txInfo": ""
}
}
'
Parameter:
{
"id": "",
"jsonrpc": "",
"params": {
"fromAddr": [
"0xcED97dA085527Fe7e1772CA59Aa1e64A78143128"
],
"isFindUtxo": false,
"toAddr": [
{
"addr": "0x06BA76F46631d4F344d1344303895001F1E3Af29",
"value": "13.5"
}
],
"txInfo": ""
}
}
Return:
{
"id": "",
"jsonrpc": "",
"method": "",
"result": {
"code": 0,
"gas": "20200",
"height": "600",
"message": "0",
"time": "1717148047269517",
"txJson": "{\"time\":\"1717148047269517\",\"identity\":\"2eb2F635320c3Dbf29eadD35E894c13EE3F20bd5\",\"utxo\":{\"owner\":[\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"],\"vin\":[{\"prevOut\":[{\"hash\":\"3f1342e96e426e2905021ad991787131ec70d31298646b1e80da9d912eeff274\"}]}],\"vout\":[{\"value\":\"1350000000\",\"addr\":\"06BA76F46631d4F344d1344303895001F1E3Af29\"},{\"value\":\"1982446992477\",\"addr\":\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"},{\"value\":\"20200\",\"addr\":\"VirtualBurnGas\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":1}",
"txType": "1",
"vrfJson": "{\"vrfdata\":{\"hash\":\"6cf89d80c98eecd9138caca4f55d7ad0fda2aed9d8e68dd4642543ae3ee056d6\"},\"Vrfsign\":{\"sign\":\"u5dNZ16Rd77B4nLd8gAcKTwz+GxeHH1HIlcGennGbPaKgIFXUkmFzS/EnVxRC4nmSfESAdWyMEmj4pKBhwuqAg==\",\"pub\":\"MCowBQYDK2VwAyEAcUcydwF7CSr9bjBiUbd3drV+WMd4yd8xFL7HWGA4FTw=\"}}"
}
}
sig_tx()
- Step2: Sign the return value as it is, and call
SendMessageas
a parameter.
Calling the sig_tx() method in thetfc_sdk
dynamic library
char *sig_tx(const char * message,int msize, long long pkey);
Obtain the jlong
value of sigTx and obtain a random number stamp by import_prikey_handler_from_seed()
.
uint8_t *export_new_seed_base64();
long long import_prikey_handler_from_seed(const uint8_t * seed);
SendMessage
After returning the value for public key signature, send the transaction as a parameter
- Step3: send message
For example: http://IP:port/SendMessage
curl http://localhost:20620/SendMessage -X POST -H "Content-Type: application/json" -d '
{
"ErrorCode": "0",
"ErrorMessage": "",
"gas": "20200",
"height": "225",
"time": "1716010020707529",
"txJson": "{\"time\":\"1716010020707529\",\"identity\":\"0x8199787886e29346a9f1206494cb8bD3C0b008Cf\",\"utxo\":{\"owner\":[\"0x6298D7a621bF8C37E74a51c6b3E9c788975d9cF1\"],\"vin\":[{\"prevOut\":[{\"hash\":\"e144683e5c2a088706b1e44d551826ca4bcf448f7b66117fbc21c184ba451110\"}],\"vinSign\":{\"sign\":\"HmK0MkZDgO7fn2GlDZb0RjNUZ0juIQjkT8PwXbc4rqvSIyLuU4tSmnKv/+tT+vl4RxSYteYguRAgogyg/2QUBQ==\",\"pub\":\"MCowBQYDK2VwAyEAuOmhl9PiwwviYtwW1ZVzl8e2LGC+4KA5fsQmJyt/XTo=\"}}],\"vout\":[{\"value\":\"200000000\",\"addr\":\"0x7058dC8425224D48A5Ff08946a1BDa6D7D1BA881\"},{\"value\":\"197899718881\",\"addr\":\"0x6298D7a621bF8C37E74a51c6b3E9c788975d9cF1\"},{\"value\":\"20200\",\"addr\":\"VirtualBurnGas\"}],\"multiSign\":[{\"sign\":\"hNlK6/df3rKH5uNEphi6/QDVBDW4OAb/W1zwIUqMgbXLvX1o3avGsDtWAzfX3YzgnrQaKnhwMjQn5miqcTRbBg==\",\"pub\":\"MCowBQYDK2VwAyEAuOmhl9PiwwviYtwW1ZVzl8e2LGC+4KA5fsQmJyt/XTo=\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":1}",
"txType": "0",
"type": "",
"vrfJson": "{}"
}
'
Parameter:
{
"id": "",
"jsonrpc": "",
"result": {
"code": "",
"gas": "20200",
"height": "600",
"message": "",
"time": "1717148047269517",
"txJson": "{\"time\":\"1717148047269517\",\"identity\":\"2eb2F635320c3Dbf29eadD35E894c13EE3F20bd5\",\"utxo\":{\"owner\":[\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"],\"vin\":[{\"prevOut\":[{\"hash\":\"3f1342e96e426e2905021ad991787131ec70d31298646b1e80da9d912eeff274\"}],\"vinSign\":{\"sign\":\"ApxL8NDgh9YYDuUXpdbsbVv0cEAr3HyXmr2TICkD4mfuDIZqVlZJNUmaPAKHCs5kkn7JnZx7r12+CpnnR4ZpAg==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}}],\"vout\":[{\"value\":\"1350000000\",\"addr\":\"06BA76F46631d4F344d1344303895001F1E3Af29\"},{\"value\":\"1982446992477\",\"addr\":\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"},{\"value\":\"20200\",\"addr\":\"VirtualBurnGas\"}],\"multiSign\":[{\"sign\":\"WCoFsLKML69x1rSpQc7pwbnd+GMfZ0Ce3wTPg96Rdb1v7ezFw9KuEBXwvGecTz264pVZB6T8hzgJIx26GuKVAA==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":1}",
"txType": "1",
"vrfJson": "{\"vrfdata\":{\"hash\":\"6cf89d80c98eecd9138caca4f55d7ad0fda2aed9d8e68dd4642543ae3ee056d6\"},\"Vrfsign\":{\"sign\":\"u5dNZ16Rd77B4nLd8gAcKTwz+GxeHH1HIlcGennGbPaKgIFXUkmFzS/EnVxRC4nmSfESAdWyMEmj4pKBhwuqAg==\",\"pub\":\"MCowBQYDK2VwAyEAcUcydwF7CSr9bjBiUbd3drV+WMd4yd8xFL7HWGA4FTw=\"}}"
}
}
Return:
{
"id": "",
"jsonrpc": "",
"result": {
"code": "",
"message": "",
"txhash":"0xe144683e5c2a088706b1e44d551826ca4bcf448f7b66117fbc21c184ba451110"
}
}
Token transaction(Call Contract)
GetCallContractTransaction
- Step1: sign transaction
For example: http://IP:port/GetCallContractTransaction
curl http://localhost:20620/GetCallContractTransaction -X POST -H "Content-Type: application/json" -d '
{
"id": "123",
"jsonrpc": "",
"params": {
"addr": "cED97dA085527Fe7e1772CA59Aa1e64A78143128",
"args": "0x7ad9ad7c000000000000000000000000ff3778ca36a2936390c06d8b0457f5b8e408389c0000000000000000000000000000000000000000000000000000000000002710",
"contractAddress": "0x7350399179EC2B0702008aE8b43a0579AA699Eb1",
"deployer": "cED97dA085527Fe7e1772CA59Aa1e64A78143128",
"deployutxo": "0x8a02413da127b48318a7ed12a46a4f68b83cdc6c21f937d7e6c99393d64112b0",
"isFindUtxo": false,
"istochain": "true",
"money": "0",
"pubstr": "MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=",
"tip": "0",
"txInfo": "info"
}
}
'
Parameter:
{
"id": "1",
"jsonrpc": "2.0",
"params": {
"addr": "0xcED97dA085527Fe7e1772CA59Aa1e64A78143128",
"args": "0xa9059cbb00000000000000000000000012460d65f8df3b75e5279fb930a6b7cdfc4b38d4000000000000000000000000000000000000000000000000000000000bebc200",
"contractAddress": "0x7350399179EC2B0702008aE8b43a0579AA699Eb1",
"deployer": "cED97dA085527Fe7e1772CA59Aa1e64A78143128",
"deployutxo": "0x8a02413da127b48318a7ed12a46a4f68b83cdc6c21f937d7e6c99393d64112b0",
"isFindUtxo": false,
"istochain": "true",
"money": "0",
"pubstr": "MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=",
"tip": "0",
"txInfo": "info"
}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "",
"result": {
"code": -1535152768,
"contractJs": "{\"version\":\"1_1.0.0_d\",\"txMsgReq\":{\"version\":\"1_1.0.0_d\",\"txMsgInfo\":{\"nodeHeight\":\"603\",\"contractStorageList\":[\"7350399179EC2B0702008aE8b43a0579AA699Eb1\"]},\"vrfInfo\":{\"vrfdata\":{\"hash\":\"79675c88de3a336d2e47c6134146f0a4d26e068ca76aa730ca654830c6bb6b96\"},\"Vrfsign\":{\"pub\":\"MCowBQYDK2VwAyEASFAPKN8n+Nqn2RcJX8XCgyx1sveBLZ/f5tn5JpM2Xxs=\"}}}}",
"message": "",
"txJson": "{\"time\":\"1717148359029088\",\"identity\":\"0aFeBC02da4d5111d05d425e74e822B032274f2b\",\"utxo\":{\"owner\":[\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"],\"vin\":[{\"prevOut\":[{\"hash\":\"79675c88de3a336d2e47c6134146f0a4d26e068ca76aa730ca654830c6bb6b96\"}]}],\"vout\":[{\"value\":\"25041\",\"addr\":\"VirtualCallContractBurnGas\"},{\"value\":\"1982446318715\",\"addr\":\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"},{\"value\":\"65000\",\"addr\":\"VirtualBurnGas\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":8,\"data\":\"{\\\"TxInfo\\\":{\\\"blockPrevRandao\\\":4345,\\\"blockTimestamp\\\":1717148360,\\\"contractDeployer\\\":\\\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\\\",\\\"donation\\\":0,\\\"input\\\":\\\"7ad9ad7c000000000000000000000000ff3778ca36a2936390c06d8b0457f5b8e408389c0000000000000000000000000000000000000000000000000000000000002710\\\",\\\"output\\\":\\\"\\\",\\\"recipient\\\":\\\"7350399179EC2B0702008aE8b43a0579AA699Eb1\\\",\\\"sender\\\":\\\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\\\",\\\"transfer\\\":0,\\\"version\\\":0,\\\"virtualMachine\\\":0}}\"}"
}
}
sig_contract_tx()
- Step2: Sign the return value as it is, and call
SendMessageas
a parameter.
Calling the sig_contract_tx() method in thetfc_sdk
dynamic library
char * sig_contract_tx(const char *message ,int msize, long long pkey);
SendContractMessage
After returning the value for public key signature, send the transaction as a parameter
- Step3: send message
For example: http://IP:port/SendContractMessage
curl http://localhost:20620/SendContractMessage -X POST -H "Content-Type: application/json" -d '
{
"id": "",
"jsonrpc": "",
"result": {
"code": "",
"contractJs": "{\"version\":\"1_1.0.0_d\",\"txMsgReq\":{\"version\":\"1_1.0.0_d\",\"txMsgInfo\":{\"nodeHeight\":\"601\",\"contractStorageList\":[\"A8B8Ae6F84709fF80E08aD9d26575c161aCC95f1\"]},\"vrfInfo\":{\"vrfdata\":{\"hash\":\"dea1b44a641928d6a09db9a3d9da274abe4ef13eb23833213144a5b46c612136\"},\"Vrfsign\":{\"pub\":\"MCowBQYDK2VwAyEASFAPKN8n+Nqn2RcJX8XCgyx1sveBLZ/f5tn5JpM2Xxs=\"}}}}",
"message": "",
"txJson": "{\"time\":\"1717148103333839\",\"identity\":\"2eb2F635320c3Dbf29eadD35E894c13EE3F20bd5\",\"utxo\":{\"owner\":[\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"],\"vin\":[{\"prevOut\":[{\"hash\":\"dea1b44a641928d6a09db9a3d9da274abe4ef13eb23833213144a5b46c612136\"}],\"vinSign\":{\"sign\":\"3o82Rq7taGO+VRtrhtxWOVPAolo/pVxuNXEBdklDpDVd8tJcTjNrnmaMFixdav2wCyvCb+AFOd02ryPI4JV1Cw==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}}],\"vout\":[{\"value\":\"480\",\"addr\":\"VirtualDeployContractBurnGas\"},{\"value\":\"1982446498797\",\"addr\":\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"},{\"value\":\"493200\",\"addr\":\"VirtualBurnGas\"}],\"multiSign\":[{\"sign\":\"YVcOA5gZhVNaQx7eoduw4lOI4d1HNtPRWEUoMzDK6D2UnZXDbRziXV66XiaRxKOzXF3kF/N4j8PEe5CMjkf3BQ==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":7,\"data\":\"{\\\"TxInfo\\\":{\\\"blockPrevRandao\\\":4406,\\\"blockTimestamp\\\":1717148110,\\\"input\\\":\\\"608060405234801561001057600080fd5b506108b3806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630483a7f61461005c5780631629614e1461008c57806327e235e3146100a85780637ad9ad7c146100d8578063afc58189146100f4575b600080fd5b610076600480360381019061007191906105a8565b610110565b60405161008391906106d7565b60405180910390f35b6100a660048036038101906100a19190610615565b610128565b005b6100c260048036038101906100bd91906105a8565b6102a7565b6040516100cf91906106d7565b60405180910390f35b6100f260048036038101906100ed91906105d5565b6102bf565b005b61010e60048036038101906101099190610615565b61037d565b005b60016020528060005260406000206000915090505481565b80806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a1906106b7565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546101f89190610759565b9250508190555081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024e9190610703565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f3a14c6aa3e15c61c97825b026647b989a91e18aa33b689769475a298922480428360405161029b91906106d7565b60405180910390a25050565b60006020528060005260406000206000915090505481565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461030d9190610703565b925050819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f322d0c4befd4c2dd440740b711488a1638fd7d8eeb25f9dacede84083db428c98360405161037191906106d7565b60405180910390a35050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610400576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f790610697565b60405180910390fd5b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047990610697565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546104d09190610703565b9250508190555080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105269190610759565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f867b353f032680758428983522443995b88120a470e436b962c6a9d0d8940af78260405161057391906106d7565b60405180910390a250565b60008135905061058d8161084f565b92915050565b6000813590506105a281610866565b92915050565b6000602082840312156105be576105bd6107f8565b5b60006105cc8482850161057e565b91505092915050565b600080604083850312156105ec576105eb6107f8565b5b60006105fa8582860161057e565b925050602061060b85828601610593565b9150509250929050565b60006020828403121561062b5761062a6107f8565b5b600061063984828501610593565b91505092915050565b600061064f6011836106f2565b915061065a826107fd565b602082019050919050565b60006106726014836106f2565b915061067d82610826565b602082019050919050565b610691816107bf565b82525050565b600060208201905081810360008301526106b081610642565b9050919050565b600060208201905081810360008301526106d081610665565b9050919050565b60006020820190506106ec6000830184610688565b92915050565b600082825260208201905092915050565b600061070e826107bf565b9150610719836107bf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561074e5761074d6107c9565b5b828201905092915050565b6000610764826107bf565b915061076f836107bf565b925082821015610782576107816107c9565b5b828203905092915050565b60006107988261079f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b7f4e6f206c6f636b65642062616c616e6365000000000000000000000000000000600082015250565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6108588161078d565b811461086357600080fd5b50565b61086f816107bf565b811461087a57600080fd5b5056fea264697066735822122067e67aed3152cf78a07c4f8842540cf5803e421699b10fbf8f66c015550b0ed464736f6c63430008070033\\\",\\\"recipient\\\":\\\"A8B8Ae6F84709fF80E08aD9d26575c161aCC95f1\\\",\\\"sender\\\":\\\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\\\",\\\"version\\\":0,\\\"virtualMachine\\\":0}}\"}"
}
}
'
Parameter:
{
"id": "",
"jsonrpc": "",
"result": {
"code": "",
"contractJs": "{\"version\":\"1_1.0.0_d\",\"txMsgReq\":{\"version\":\"1_1.0.0_d\",\"txMsgInfo\":{\"nodeHeight\":\"601\",\"contractStorageList\":[\"A8B8Ae6F84709fF80E08aD9d26575c161aCC95f1\"]},\"vrfInfo\":{\"vrfdata\":{\"hash\":\"dea1b44a641928d6a09db9a3d9da274abe4ef13eb23833213144a5b46c612136\"},\"Vrfsign\":{\"pub\":\"MCowBQYDK2VwAyEASFAPKN8n+Nqn2RcJX8XCgyx1sveBLZ/f5tn5JpM2Xxs=\"}}}}",
"message": "",
"txJson": "{\"time\":\"1717148103333839\",\"identity\":\"2eb2F635320c3Dbf29eadD35E894c13EE3F20bd5\",\"utxo\":{\"owner\":[\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"],\"vin\":[{\"prevOut\":[{\"hash\":\"dea1b44a641928d6a09db9a3d9da274abe4ef13eb23833213144a5b46c612136\"}],\"vinSign\":{\"sign\":\"3o82Rq7taGO+VRtrhtxWOVPAolo/pVxuNXEBdklDpDVd8tJcTjNrnmaMFixdav2wCyvCb+AFOd02ryPI4JV1Cw==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}}],\"vout\":[{\"value\":\"480\",\"addr\":\"VirtualDeployContractBurnGas\"},{\"value\":\"1982446498797\",\"addr\":\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\"},{\"value\":\"493200\",\"addr\":\"VirtualBurnGas\"}],\"multiSign\":[{\"sign\":\"YVcOA5gZhVNaQx7eoduw4lOI4d1HNtPRWEUoMzDK6D2UnZXDbRziXV66XiaRxKOzXF3kF/N4j8PEe5CMjkf3BQ==\",\"pub\":\"MCowBQYDK2VwAyEA89VSBQU7d4uL+jvqAKeCRbgYz2tzk/Rf8DNRhB0sLbg=\"}]},\"type\":\"Tx\",\"consensus\":7,\"txType\":7,\"data\":\"{\\\"TxInfo\\\":{\\\"blockPrevRandao\\\":4406,\\\"blockTimestamp\\\":1717148110,\\\"input\\\":\\\"608060405234801561001057600080fd5b506108b3806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630483a7f61461005c5780631629614e1461008c57806327e235e3146100a85780637ad9ad7c146100d8578063afc58189146100f4575b600080fd5b610076600480360381019061007191906105a8565b610110565b60405161008391906106d7565b60405180910390f35b6100a660048036038101906100a19190610615565b610128565b005b6100c260048036038101906100bd91906105a8565b6102a7565b6040516100cf91906106d7565b60405180910390f35b6100f260048036038101906100ed91906105d5565b6102bf565b005b61010e60048036038101906101099190610615565b61037d565b005b60016020528060005260406000206000915090505481565b80806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a1906106b7565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546101f89190610759565b9250508190555081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024e9190610703565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f3a14c6aa3e15c61c97825b026647b989a91e18aa33b689769475a298922480428360405161029b91906106d7565b60405180910390a25050565b60006020528060005260406000206000915090505481565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461030d9190610703565b925050819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f322d0c4befd4c2dd440740b711488a1638fd7d8eeb25f9dacede84083db428c98360405161037191906106d7565b60405180910390a35050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610400576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f790610697565b60405180910390fd5b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047990610697565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546104d09190610703565b9250508190555080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105269190610759565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f867b353f032680758428983522443995b88120a470e436b962c6a9d0d8940af78260405161057391906106d7565b60405180910390a250565b60008135905061058d8161084f565b92915050565b6000813590506105a281610866565b92915050565b6000602082840312156105be576105bd6107f8565b5b60006105cc8482850161057e565b91505092915050565b600080604083850312156105ec576105eb6107f8565b5b60006105fa8582860161057e565b925050602061060b85828601610593565b9150509250929050565b60006020828403121561062b5761062a6107f8565b5b600061063984828501610593565b91505092915050565b600061064f6011836106f2565b915061065a826107fd565b602082019050919050565b60006106726014836106f2565b915061067d82610826565b602082019050919050565b610691816107bf565b82525050565b600060208201905081810360008301526106b081610642565b9050919050565b600060208201905081810360008301526106d081610665565b9050919050565b60006020820190506106ec6000830184610688565b92915050565b600082825260208201905092915050565b600061070e826107bf565b9150610719836107bf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561074e5761074d6107c9565b5b828201905092915050565b6000610764826107bf565b915061076f836107bf565b925082821015610782576107816107c9565b5b828203905092915050565b60006107988261079f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b7f4e6f206c6f636b65642062616c616e6365000000000000000000000000000000600082015250565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6108588161078d565b811461086357600080fd5b50565b61086f816107bf565b811461087a57600080fd5b5056fea264697066735822122067e67aed3152cf78a07c4f8842540cf5803e421699b10fbf8f66c015550b0ed464736f6c63430008070033\\\",\\\"recipient\\\":\\\"A8B8Ae6F84709fF80E08aD9d26575c161aCC95f1\\\",\\\"sender\\\":\\\"cED97dA085527Fe7e1772CA59Aa1e64A78143128\\\",\\\"version\\\":0,\\\"virtualMachine\\\":0}}\"}"
}
}
Return:
{
"id": "1",
"jsonrpc": "2.0",
"method": "GetCallContractTransaction",
"result": {
"code": 0,
"txhash": "0x9486c7cb49e22726b5fbbcaac4f4842e020bc3357feeed3037c23e1fc88c8715",
"message": "success"
}
}