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://ltc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": null,
    "error": {
        "code": -3,
        "message": "Expected type array, got string"
    },
    "id": "curltest"
}

decoderawtransaction

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

Method: POST

https://ltc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": null,
    "error": {
        "code": -22,
        "message": "TX decode failed"
    },
    "id": "curltest"
}

decodescript

Decode a hex-encoded script.

Method: POST

https://ltc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": {
        "asm": "OP_UNKNOWN OP_UNKNOWN OP_ADD OP_OVER OP_GREATERTHANOREQUAL [error]",
        "type": "nonstandard",
        "p2sh": "MDPMexQNgzdtiGkWRVGRJ2WDbViqvt34Zs",
        "segwit": {
            "asm": "0 319ead96a2fb7a82045ef3d66e74bf099d23af6781a910a8aaf34fc7fb28fb3b",
            "hex": "0020319ead96a2fb7a82045ef3d66e74bf099d23af6781a910a8aaf34fc7fb28fb3b",
            "reqSigs": 1,
            "type": "witness_v0_scripthash",
            "addresses": [
                "ltc1qxx02m94zldagypz770txua9lpxwj8tm8sx53p2927d8u07eglvasrprshk"
            ],
            "p2sh-segwit": "MKW3gc4i7LVyccv3WsyX7MP8LvRSQjPyFW"
        }
    },
    "error": null,
    "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://ltc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": {
        "txid": "cfe79378a24b231b7f646a670549be1a7203038e74b2a19c23470df0450907ee",
        "hash": "7cf72c9ffeaf8d1b816a6b20950e4c0e13848b149a069c9800bb6cde011f37f0",
        "version": 1,
        "size": 250,
        "vsize": 223,
        "weight": 892,
        "locktime": 0,
        "vin": [
            {
                "ismweb": false,
                "coinbase": "03adbd28194d696e656420627920416e74506f6f6c209b009703fcd28f93fabe6d6d59a985c819392290e3bb0dcdcea78ecacb178e7e9d3fd3fc88686a3a656297ec01000000000000000000cdd37c000000",
                "txinwitness": [
                    "0000000000000000000000000000000000000000000000000000000000000000"
                ],
                "sequence": 4294967295
            }
        ],
        "vout": [
            {
                "ismweb": false,
                "value": 6.25584744,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 bc14b37375146785074671bbaf5804133e5827e5 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914bc14b37375146785074671bbaf5804133e5827e588ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "LcNS6c8RddAMjewDrUAAi8BzecKoosnkN3"
                    ]
                }
            },
            {
                "ismweb": false,
                "value": 0.00000000,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_RETURN aa21a9ed5db51dbb705b4a0ee29e3bb9792cc53e9636d0ed1f11ce339cb109b145710952",
                    "hex": "6a24aa21a9ed5db51dbb705b4a0ee29e3bb9792cc53e9636d0ed1f11ce339cb109b145710952",
                    "type": "nulldata"
                }
            }
        ],
        "hex": "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff5203adbd28194d696e656420627920416e74506f6f6c209b009703fcd28f93fabe6d6d59a985c819392290e3bb0dcdcea78ecacb178e7e9d3fd3fc88686a3a656297ec01000000000000000000cdd37c000000ffffffff0268aa4925000000001976a914bc14b37375146785074671bbaf5804133e5827e588ac0000000000000000266a24aa21a9ed5db51dbb705b4a0ee29e3bb9792cc53e9636d0ed1f11ce339cb109b1457109520120000000000000000000000000000000000000000000000000000000000000000000000000",
        "blockhash": "ea5f168ae8a819fc6db65f5d9eb9422e1c43f92c9b84354648de2362da72c78d",
        "confirmations": 10,
        "time": 1713433719,
        "blocktime": 1713433719
    },
    "error": null,
    "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://ltc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": null,
    "error": {
        "code": -22,
        "message": "TX decode failed. Make sure the tx has at least one input."
    },
    "id": "curltest"
}

signrawtransactionwithkey

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

The second argument is an array of base58-encoded private keys that will be the only keys used to sign the transaction.

The third optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain.

Method: POST

https://ltc-testnet.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "signrawtransactionwithkey",
    "params": [
        "myhex",
        "[\"key1\",\"key2\"]"
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -3,
        "message": "Wrong type passed:\n{\n    \"Position 2 (privkeys)\": \"JSON value of type string is not of expected type array\"\n}"
    },
    "id": "curltest"
}

Last updated