Rawtransactions RPCs

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.

Method: POST

https://dcr.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "createrawtransaction",
    "params": [
        "[{\"txid\":\"myid\",\"vout\":0}]",
        "[{\"address\":0.01}]"
    ]
}

Example response: 200

{
    "jsonrpc": "1.0",
    "result": null,
    "error": {
        "code": -8,
        "message": "Failed to parse request: parameter #1 'inputs' must be type []types.TransactionInput (got string)"
    },
    "id": "curltest"
}

decoderawtransaction

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

Method: POST

https://dcr.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "decoderawtransaction",
    "params": [
        "hexstring"
    ]
}

Example response: 200

{
    "jsonrpc": "1.0",
    "result": null,
    "error": {
        "code": -22,
        "message": "Argument must be hexadecimal string (not \"0hexstring\")"
    },
    "id": "curltest"
}

decodescript

Decode a hex-encoded script.

Method: POST

https://dcr.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "decodescript",
    "params": [
        "hexstring"
    ]
}

Example response: 200

{
    "jsonrpc": "1.0",
    "result": null,
    "error": {
        "code": -22,
        "message": "Argument must be hexadecimal string (not \"0hexstring\")"
    },
    "id": "curltest"
}

getrawtransaction

Return the raw transaction data.

By default this function only works for mempool transactions. When called with a blockhash argument, getrawtransaction will return the transaction if the specified block is available and the transaction is found in that block. When called without a blockhash argument, getrawtransaction will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction is in a block in the blockchain.

Hint: Use gettransaction for wallet transactions.

If verbose is ‘true’, returns an Object with information about ‘txid’.

If verbose is ‘false’ or omitted, returns a string that is serialized, hex-encoded data for ‘txid’.

Method: POST

https://dcr.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getrawtransaction",
    "params": [
        "mytxid",
        true
    ]
}

Example response: 200

{
    "jsonrpc": "1.0",
    "result": null,
    "error": {
        "code": -8,
        "message": "Failed to parse request: parameter #2 'verbose' must be type int (got bool)"
    },
    "id": "curltest"
}

sendrawtransaction

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

Note that the transaction will be sent unconditionally to all peers, so using this for manual rebroadcast may degrade privacy by leaking the transaction’s origin, as nodes will normally not rebroadcast non-wallet transactions already in their mempool.

Also see createrawtransaction and signrawtransactionwithkey calls.

Method: POST

https://dcr.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "sendrawtransaction",
    "params": [
        "signedhex"
    ]
}

Example response: 200

{
    "jsonrpc": "1.0",
    "result": null,
    "error": {
        "code": -22,
        "message": "Argument must be hexadecimal string (not \"0signedhex\")"
    },
    "id": "curltest"
}

Last updated