Tx

tx_sendRawTx

Send a raw transaction block

  • Parameters: Object : RawTxBlock

    • blockType : byte mandatory
    • height : string mandatory
    • hash : Hash mandatory
    • prevHash : Hash The hash of the previous block in the account chain mandatory if the block height is 1 fill it with 0-Hash
    • accountAddress : Address The address of the account chain mandatory
    • publicKey : []byte mandatory
    • signature : []byte mandatory

    Optional: whether or not to do pow, it's only specified when Pow is required, otherwise these fields can be ignored or filled with null

    • difficulty : *string PoW difficulty to be calculated
    • nonce : []byte Pow nonce value

    Optional: depends on the transaction type (send/receive)

    • fromBlockHash : Hash Hash of the send transaction which the receive corresponding to. It's only specified in receive transaction, and ignore the field or fill it with 0-hash in all send.
    • toAddress : Address The address specifed to accept. It's only specified in the send transaction and be ignored in all receive.
    • tokenId : TokenTypeId It's only specified in the send transaction, and ignore the field in all receive. The send with no need of amount can ignore the field or fill it with 0-TokenTypeId
    • amount : *string It's only specified in the send transaction, and ignore the field in all receive. The send with no need of amount can ignore the field or fill it with "0" or null
    • fee : *string It's only specified in the send transaction, and ignore the field in all receive. The send with no need of fee can ignore the field or fill it with "0" or null
    • data : []byte For general account, it can only be specified in send and be ignored in all receive., which can be the message or the transaction data to call the contract. If there is no demand, ignore the field or fill it with null.
  • 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
    • quotaUsed : *string The quota that this transaction consumes
    • logHash : *types.Hash The Hash of the LogList generated by the smart contract execution
    • sendBlockList : []*RawTxBlock
    • tokenInfo : *RpcTokenInfo Token information to which tokenId refers
    • confirmedTimes : *string Number of times the transaction was confirmed
    • confirmedHash : *Hash The snapshot hash of which the transaction was first confirmed by
    • timestamp : int64 The snapshot timestamp of which the transaction was first confirmed by
    • receiveBlockHeight : *string The height of the receive transaction to which the send refers, only send transaction displays it.
    • receiveBlockHash : *Hash The hash of the receive transaction to which the send refers, only send transaction displays it.
  • Example:

{
    "jsonrpc": "2.0",
    "id": 17,
    "method": "tx_sendRawTx",
    "params": [{
    	"blockType": 2,
        "height": "9",
        "hash": "7161f621d1bdc2571fa1e66917fca90b047e3e5c78c18e5cfb11edba32c7c2fc",
        "prevHash": "7c6a8b729e73ae98409a5ab72ccc458ff449eced5e7ee757d52de83e8f32a070",
        "accountAddress": "vite_ab24ef68b84e642c0ddca06beec81c9acb1977bbd7da27a87a",
        "publicKey": "WHZinxslscE+WaIqrUjGu2scOvorgD4Q+DQOOcDBv4M=",
        "signature":"Hz8bC6TUM00oWylUua7oN2sE4EEFUuCK4C9LQcZZu8vyb3UU9xG32BeJtBQ==",
        "difficulty": "65535",
        "nonce": "Tgb+PebmE4w=",
        "fromBlockHash": "0000000000000000000000000000000000000000000000000000000000000000",
        "toAddress":"vite_ab24ef68b84e642c0ddca06beec81c9acb1977bbd7da27a87a",
        "tokenId": "tti_5649544520544f4b454e6e40",
        "amount": "10000",
        "fee": "0",
        "data":null
    }]
}
{
    "jsonrpc": "2.0",
    "id": 17,
    "method": "tx_sendRawTx",
    "params": [{
    	"blockType": 4,
        "height": "11",
        "hash": "d7a26855f131f53ba6320f0ebcba99f2c2157d60a47dc7a53a3186cd0b202b63",
        "prevHash": "9f463b7db51f91951de9445570e4a6d4f00def4d528c80ddfdf39e1e47f8498d",
        "accountAddress": "vite_ab24ef68b84e642c0ddca06beec81c9acb1977bbd7da27a87a",
        "publicKey": "WHZinxslscE+WaIqrUjGu2scOvorgD4Q+DQOOcDBv4M=",
        "signature":"zBF5LgOOxQ+H86oMNQ3kbuJbiQ+yCdLbtOdmEJ7QRNo67HF3b/pm+bfM5EHuxMNpOnimKgawtozZwifnFVhyDQ==",
        "difficulty": null,
        "nonce": null,
        "fromBlockHash":"7c6a8b729e73ae98409a5ab72ccc458ff449eced5e7ee757d52de83e8f32a070",
        "data":null
    }]
}
{
    "jsonrpc": "2.0",
    "id": 17,
    "result": null
}
{
    "jsonrpc": "2.0",
    "id": 17,
    "error": {
        "code": -36006,
        "message": "verify prevBlock failed, incorrect use of prevHash or fork happened"
    }
}