getrawtransaction

NOTE: By default this function only works for mempool transactions. If the -txindex option is
enabled, it also works for blockchain transactions. If the block which contains the transaction
is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is
provided, only that block will be searched and if the transaction is in the mempool or other
blocks, or if this node does not have the given block available, the transaction will not be found.
DEPRECATED: for now, it also works for transactions with unspent outputs.

Return the raw transaction data.

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'.

Arguments:

  1. "txid" (string, required) The transaction id
  2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object
  3. "blockhash" (string, optional) The block in which to look for the transaction

Request

curl 'https://rpc.web3api.io?x-api-key=YOUR-API-KEY' \
    -X POST \
    -H 'x-amberdata-blockchain-id: bitcoin-mainnet' \
    -d '{"jsonrpc":"2.0","id":1,"method":"getrawtransaction","params":["6b029135dcbff2c9bba177b3875542c1a5d0c8ffa6f889658b14ff9d97487b0a"]}'

Response

{
  "result": "0200000000010124ea6a105346212b7e6043da66ff33023e071a30997b66bfd49c1cf5b066ae340100000017160014ace8b2a4231527c2901f544deac0f3178a23bc1affffffff0250e00402000000001976a9145a6a6e57d026f8421ef823d8bcae0807d2205d2688ace0691f050000000017a914f7deab017a95f24a46981d10ab8d46e7c3dd313b870247304402207ac235915ec0e199c8e3e7af1d6f1e4dcde9e6d2856447f84e70a8a778a36dbd022051d6ce9f4f643a6c89a3efd445d9d61db8cabe53c323465def66edfa21b5e472012102acea3ff9d52e4dee60b03c0b933aed9d1a7aedc50ca41c6468f6237a38cf6e2700000000",
  "error": null,
  "id": 1
}