# Send Transactions

Support sending transactions, including transfer, node staking, node registration, node voting, node claiming rewards, etc.

Before sending transactions,make sure that:

  1. You already have an account on the chain.

  2. Get the identity token by requestToken.

# Transaction Costs

In RPC, account balance, transaction deposit,etc.The unit is uTOP, 1TOP=1*10^6 uTOP.

Sending transactions on TOP Network chain consumes certain gas resources. If the account balance is greater than or equal to 100*10^6 uTOP, the system will give the account 25,000 Tgas for free.

Each transaction requires at least 100,000 uTOP as the transaction deposit, otherwise the transaction will be discarded.

If the account‘s gas resources are sufficient, the transaction deposit will be returned to your account immediately after the transaction is successful. If the account's gas resources are insufficient to pay the transaction costs, a fee shall be deducted from the transaction deposit to exchange gas resources to pay the transaction costs, and the deducted TOP tokens will be destroyed.

If the transaction deposit is not enough to exchange gas resources, the transaction will eventually fail.

For transactions that running the contracts deployed on the Beacon (registration node-related, proposal related, starting xnode), in addition to the minimum transaction deposit of 100,000 uTOP tokens, the system will automatically deduct the 100*10^6 uTOP tokens as transaction fee from the sender's account and then destroy it.

The resources consumed by transaction, please refer to Resource Model.

More about Beacon contract, please refer to Smart Contract.

# RPC Instructions

Request Method

sendTransaction

Request Parameters

Parameter Name Parameter Name Description
authorization String Transaction body signature.
ext String The reserve filed, default to empty String.
last_tx_nonce Uint64 The nonce of the previous transaction ,used for transaction sorting and removing duplicates.
note String Transaction note.
premium_price Uint32 The reserve filed, default to "0".
receiver_action_name String The name of contract function.
The system smart contract function,please refer to Platform Smart Contract API.
receiver_action_param String The transaction receiver action.The serialization of different action perform content please refer to Action Param Serialization.
receiver_account String Transaction receiver account address.
send_timestamp Uint64 Transaction send timestamp.
sender_action_name String The reserve filed, default to empty String.
sender_action_param String The transaction sender action.The serialization of different action perform content please refer to Action Param Serialization.
sender_account String Transaction sender account address.
tx_deposit Uint32 Transaction deposit.The unit is uTOP.
tx_expire_duration Uint16 If the transaction expires, it will be discarded with the default time of 100s.
tx_hash String The hexadecimal of the transaction hash.
tx_structure_version String Transaction structure version.Default to "2".Temporary unused.
tx_type Uint16 Transaction type.
Different transaction types have different action param and action type in action.
<!--xtransaction_type_create_contract_account = 1,

Response Parameters

Parameter Name Parameter Type Description
tx_hash String The transaction hash which can be used to retrieve the transaction consensus status.
tx_len Uint16 The gas consumed by transaction consensus is related to the transaction size.

Request Sample

curl -X POST --data 'target_account_addr=T8000066ab344963eaa071f9636faac26b0d1a39900325&body=%7b%22authorization%22%3a%220x015c5be7876376b09297f9247e34e1e921474f2f66c61700e57832546e6c1de918136abe1a56c346ebf2dce9358941df89d02fd5274222435e7bd0f756de1adf83%22%2c%22ext%22%3a%22%22%2c%22last_tx_nonce%22%3a2%2c%22note%22%3a%221231fsd%22%2c%22receiver_action_name%22%3a%22%22%2c+%22receiver_action_param%22%3a%220x000000008c00000000000000%22%2c%22receiver_account%22%3a%22T8000085a8e8acd53c72dca85dcb002a6710796975b4ba%22%7d%2c%22send_timestamp%22%3a1602820177%2c%22sender_action_name%22%3a%22%22%2c%22sender_action_param%22%3a%220x000000008c00000000000000%22%2c%22sender_account%22%3a%22T80000fd4f433c036268f17a1b4204ea907e70618d030e%22%7d%2c%22premium_price%22%3a0%2c%22tx_deposit%22%3a100000%2c%22tx_expire_duration%22%3a100%2c%22tx_len%22%3a322%2c%22tx_structure_version%22%3a0%2c%22tx_type%22%3a4%7d%7d&method=getTransaction&sequence_id=8&identity_token=&version=1.0'  http://localhost:19081

Response Schema

  • Successful
{
	"errmsg": "ok",
	"errno": 0,
	"sequence_id": "2",
	"tips": "Please use command 'get transaction' to query transaction status later on!!!",
	"tx_hash": "0x34ca8f317107ce6b01c933b017f28e6cf0f84f2e31627a8349f167c1aa9ade10",
	"tx_len": 306
}

Useget transaction to query the transaction details and final consensus status.

  • Failed
{
	"errmsg": "ok",
	"errno": 0,
	"sequence_id": "3",
	"tips": "Please use command 'get transaction' to query transaction status later on!!!",
	"tx_hash": "0xc73f6295bc5b6be1ace273d59504f4c97d1b01cd2d3301c47cf042e28795e35b",
	"tx_len": 306
}

In case of a transaction is failed, the transaction consensus final status will not be returned directly, and the transaction details need to be queried by get Transaction .