# Tx
# tx_sendRawTx
Send a raw transaction block
Parameters:
Object
:RawTxBlock
Mandatory:
blockType
:byte
Block typeheight
:string
Heighthash
:Hash
Transaction hashprevHash
:Hash
The hash of previous block in the account chain. Fill 0 if there is no previous blockaccountAddress
:Address
Account addresspublicKey
:[]byte
Account's public keysignature
:[]byte
Signature
Optional: below fields should be filled upon sending transaction through pow, otherwise can be ignored or filled with null
difficulty
:*string
PoW difficultynonce
:[]byte
Nonce
Optional: below fields should be filled depending on the transaction type (send or receive)
fromBlockHash
:Hash
The hash of corresponding request transaction. Required for response transactiontoAddress
:Address
The account address to send the transaction to. Required for request transactiontokenId
:TokenTypeId
The token ID in which the transaction is settled. Required for request transactionamount
:*string
Transaction amount. Required for request transactionfee
:*string
Transaction fee. Fill "0" or null for all transactionsdata
:[]byte
Additional data the transaction carries. This field can be specified in request transaction for user account as additional comment or formalized data used to call a contract. Ignore or fill with null if not used.
Returns:
Object
:AccountBlock
blockType
:byte
height
:string
hash
:Hash
prevHash
:Hash
accountAddress
:Address
publicKey
:[]byte
signature
:[]byte
fromAddress
:Address
toAddress
:Address
fromBlockHash
:Hash
tokenId
:TokenTypeId
amount
:*string
fee
:*string
data
:[]byte
difficulty
:*string
nonce
:[]byte
quota
:*string
The quota consumed by the transaction, excluding temporary quota obtained through PoWquotaUsed
:*string
The quota consumed by the transactionutUsed
:*string
The quota consumed by the transaction in Unit Transactions (rounded to 4 decimals)logHash
:*types.Hash
The hash of LogList generated by smart contractsendBlockList
:[]*RawTxBlock
A list of request transactions sent from within the block. RS block onlytokenInfo
:*RpcTokenInfo
The token information in which the transaction is settledconfirmedTimes
:*string
The confirmation number of the transactionconfirmedHash
:*Hash
The hash of snapshot block in which the transaction was snapshottedtimestamp
:int64
The timestamp(seconds) in which the transaction was snapshottedreceiveBlockHeight
:*string
The height of the corresponding response transaction. Request transaction onlyreceiveBlockHash
:*Hash
The hash of the corresponding response transaction. Request transaction only
Example:
# tx_calcPoWDifficulty
Obtain current PoW difficulty for sending a transaction via sendRawTx
.
This method calculates the required quota based on given transaction parameters, and then determines whether the account has enough quota from staking. Difficulty is only calculated if the account does not have sufficient quota. If error is returned, it could be because too many characters in data field, or the current transaction cannot obtain quota by calculating PoW. For example, during the same snapshot period, if previous transaction in the account chain has obtained quota through calculating PoW, calling this method for next transaction will throw an error.
Parameters:
selfAddr
:Address
Account addressprevHash
:Hash
The hash of previous block in the account chain. Fill 0 if there is no previous blockblockType
:byte
Transaction typetoAddr
:Address
The account address to send the transaction to. Required for request transaction. Fill null for response.data
:[]byte
Additional data the transaction carries. Fill null for response transaction.usePledgeQuota
:bool
Whether quota from staking is used first
Returns:
Object
difficulty
:big.Int
Current PoW difficulty. Empty string means calculating PoW is not necessaryquotaRequired
:uint64
Quota that will be consumed by the transactionutRequired
:uint64
Quota that will be consumed by the transaction in Unit Transactions (rounded to 4 decimals)isCongestion
:bool
An indicator to show if the network is jammed at the time being. If the value is true, the quota consumed by the transaction will increase.
Example:
# tx_calcQuotaRequired
Calculate the quota required for sending the transaction
Parameters:
selfAddr
:Address
Account addressblockType
:byte
Transaction typetoAddr
:Address
The account address to send the transaction to. Required for request transaction. Fill null for response.data
:[]byte
Additional data the transaction carries. Fill null for response transaction.
Returns:
Object
quotaRequired
:uint64
Quota that will be consumed by the transactionutRequired
:uint64
Quota that will be consumed by the transaction in Unit Transactions (rounded to 4 decimals)
Example: