Skip to content

Rawtransactions RPC Commands

Documentation for Raptoreum Rawtransactions RPC calls.


combinerawtransaction

Combine multiple partially signed transactions into one transaction. The combined transaction may be another partially signed transaction or a fully signed transaction.

Arguments

Position Name Type Required Default Description
1 txs json array True A json array of hex strings of partially signed transactions
Txs
1.1 hexstring string A hex-encoded raw transaction.
### Result
"str"    (string) The hex-encoded raw transaction with signature(s)
### Examples
 raptoreum-cli combinerawtransaction '["myhex1", "myhex2", "myhex3"]'

createrawtransaction

Create a transaction spending the given inputs and creating new outputs. Outputs can be addresses or data. Returns hex-encoded raw transaction. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.

Arguments

Position Name Type Required Default Description
1 inputs json array True A json array of json objects
Inputs
1.1 txid string True The transaction id.
1.2 vout numeric True The output number.
1.3 sequence numeric False The sequence number.
2 outputs json array True a json array with outputs (key-value pairs).
Outputs
2.1 address numeric or string True A key-value pair. The key (string) is the Raptoreum address, the value (float or string) is the amount in RTM.
2.2 future_maturity numeric True Number of confirmation for this future to mature.
2.3 future_locktime numeric True Total time in seconds from its first confirmation for this future to mature.
2.4 future_amount numeric True Raptoreum amount to be locked.
2.5 assetid string True The asset identifier.
2.6 uniqueid numeric The asset unique id.
2.7 amount numeric or string True Amount to send.
2.8 future_maturity numeric Number of confirmation for this future to mature.
2.9 future_locktime numeric Total time in seconds from its first confirmation for this future to mature.
2.10 data string True A key-value pair. The key must be "data", the value is hex-encoded data.
3 locktime numeric False 0 Raw locktime. Non-0 value also locktime-activates inputs
### Result
"hex"    (string)  hex string of the transaction
### Examples
 raptoreum-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "[{\"address\":0.01}]"
 raptoreum-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "[{\"data\":\"00010203\"}]"
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"data\":\"00010203\"}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/

decoderawtransaction

Return a JSON object representing the serialized, hex-encoded transaction.

Arguments

Position Name Type Required Default Description
1 hexstring string True The transaction hex string
### Result
{                            (json object)
  "txid" : "hex",            (string) The transaction id
  "size" : n,                (numeric) The transaction size
  "version" : n,             (numeric) The version
  "version" : n,             (numeric) The type
  "locktime" : xxx,          (numeric) The lock time
  "vin" : [                  (json array)
    {                        (json object)
      "txid" : "hex",        (string) The transaction id
      "vout" : n,            (numeric) The output number
      "scriptSig" : {        (json object) The script
        "asm" : "str",       (string) asm
        "hex" : "hex"        (string) hex
      },
      "sequence" : n         (numeric) The script sequence number
    },
    ...
  ],
  "vout" : [                 (json array)
    {                        (json object)
      "value" : n,           (numeric) The value in RTM
      "n" : n,               (numeric) index
      "scriptPubKey" : {     (json object)
        "asm" : "str",       (string) the asm
        "hex" : "hex",       (string) the hex
        "reqSigs" : n,       (numeric) The required sigs
        "type" : "str",      (string) The type, eg 'pubkeyhash'
        "addresses" : [      (json array)
          "str",             (string) Raptoreum address
          ...
        ]
      }
    },
    ...
  ],
  "extraPayloadSize" : n,    (numeric, optional) Size of DIP2 extra payload. Only present if it's a special TX
  "extraPayload" : "hex"     (string, optional) Hex-encoded DIP2 extra payload data. Only present if it's a special TX
}
### Examples
 raptoreum-cli decoderawtransaction "hexstring"
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "decoderawtransaction", "params": ["hexstring"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/

decodescript

Decode a hex-encoded script.

Arguments

Position Name Type Required Default Description
1 hexstring string True the hex-encoded script
### Result
{                    (json object)
  "asm" : "str",     (string) Script public key
  "type" : "str",    (string) The output type (e.g. nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata)
  "reqSigs" : n,     (numeric) The required signatures
  "addresses" : [    (json array)
    "str",           (string) Raptoreum address
    ...
  ],
  "p2sh" : "str"     (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)
}
### Examples
 raptoreum-cli decodescript "hexstring"
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "decodescript", "params": ["hexstring"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/

fundrawtransaction

Add inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add at most one change output to the outputs. No existing outputs will be modified unless "subtractFeeFromOutputs" is specified. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransactionwithkey or signrawtransactionwithwallet for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees). You can see whether this is the case by checking the "solvable" field in the listunspent output. Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only.

Arguments

Position Name Type Required Default Description
1 hexstring string True The hex string of the raw transaction
2 options json object False for backward compatibility: passing in a true instead of an object will result in
Options
2.1 changeAddress string False pool address The Raptoreum address to receive the change.
2.2 changePosition numeric False random The index of the change output.
2.3 includeWatching boolean False False Also select inputs which are watch only.
2.4 lockUnspents boolean False False Lock selected unspent outputs.
2.5 feeRate numeric or string False not set: makes wallet determine the fee Set a specific fee rate in RTM/kB.
2.6 subtractFeeFromOutputs json array False empty array A json array of integers.
2.7 conf_target numeric False fallback to wallet's default Confirmation target (in blocks).
2.8 estimate_mode string False UNSET The fee estimate mode, must be one of:.

Result

{                     (json object)
  "hex" : "hex",      (string) The resulting raw transaction (hex-encoded string)
  "fee" : n,          (numeric) Fee in RTM the resulting transaction pays
  "changepos" : n     (numeric) The position of the added change output, or -1
}

Examples

Create a transaction with no inputs

 raptoreum-cli createrawtransaction "[]" "{\"myaddress\":0.01}"

Add sufficient unsigned inputs to meet the output value

 raptoreum-cli fundrawtransaction "rawtransactionhex"

Sign the transaction

 raptoreum-cli signrawtransaction "fundedtransactionhex"

Send the transaction

 raptoreum-cli sendrawtransaction "signedtransactionhex"

getrawtransaction

Return the raw transaction data.

Arguments

Position Name Type Required Default Description
2 verbose boolean Optional false See CLI help for details

Examples

 raptoreum-cli getrawtransaction "mytxid"
 raptoreum-cli getrawtransaction "mytxid" true
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawtransaction", "params": ["mytxid", true] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
 raptoreum-cli getrawtransaction "mytxid" false "myblockhash"
 raptoreum-cli getrawtransaction "mytxid" true "myblockhash"


sendrawtransaction

Submits raw transaction (serialized, hex-encoded) to local node and network.

Arguments

Position Name Type Required Default Description
2 maxfeerate numeric or string Optional 0.10 See CLI help for details
4 bypasslimits boolean Optional false See CLI help for details

Result

"hex"    (string) The transaction hash in hex

Examples

Create a transaction
 raptoreum-cli createrawtransaction "[{\"txid\" : \"mytxid\",\"vout\":0}]" "{\"myaddress\":0.01}"
Sign the transaction, and get back the hex
 raptoreum-cli signrawtransactionwithwallet "myhex"
Send the transaction (signed hex)
 raptoreum-cli sendrawtransaction "signedhex"
As a json rpc call
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["signedhex"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/


signrawtransactionwithkey

Sign inputs for raw transaction (serialized, hex-encoded).

Arguments

Position Name Type Required Default Description
4 sighashtype string Optional ALL See CLI help for details

Result

{                             (json object)
  "hex" : "hex",              (string) The hex-encoded raw transaction with signature(s)
  "complete" : true|false,    (boolean) If the transaction has a complete set of signatures
  "errors" : [                (json array) Script verification errors (if there are any)
    {                         (json object)
      "txid" : "hex",         (string) The hash of the referenced, previous transaction
      "vout" : n,             (numeric) The index of the output to spent and used as input
      "scriptSig" : "hex",    (string) The hex-encoded signature script
      "sequence" : n,         (numeric) Script sequence number
      "error" : "str"         (string) Verification or signing error related to the input
    },
    ...
  ]
}

Examples

 raptoreum-cli signrawtransactionwithkey "myhex"
 curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransactionwithkey", "params": ["myhex"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/