bitcoind getrawtransaction returning numbers and letters

1

1

I’m not sure how to get this data in a format I can use and consume? I was expecting some kind of JSON structure, hopefully there’s a way to get this info easily?

Johnnya12345

Posted 2018-07-19T19:14:14.440

Reputation: 13

Answers

3

To clarify what's happening:

getrawtransaction 0cd7d76e5...7ecb84755a - returns serialized, hex-encoded data for transaction txid.

getrawtransaction 0cd7d76e5...7ecb84755a 1 - verbose flag, which returns a JSON Object containing information about the transaction.

sizzlecookie

Posted 2018-07-19T19:14:14.440

Reputation: 366

4

getrawtransaction 0cd7d76e5666a066ba7e7ecb84755a1c58bee6456de76b2516bb039589c9081d

020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4b03c02008040ce3505b662f4254432e434f4d2ffabe6d6d8f19ce5133a77536eee1867e96d87b190c3f589b41e7fa55440de72880bdf54e010000000000000004a5f53ed70d000000000000ffffffff026d9bd14a000000001976a91478ce48f88c94df3762da89dc8498205373a8ce6f88ac0000000000000000266a24aa21a9edf6addde9f85e6eb9d990f21898e3dc174ce2f36fb831a9ba2d1205291ec8a1e40120000000000000000000000000000000000000000000000000000000000000000000000000

and

getrawtransaction 0cd7d76e5666a066ba7e7ecb84755a1c58bee6456de76b2516bb039589c9081d 1

{
  "hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4b03c02008040ce3505b662f4254432e434f4d2ffabe6d6d8f19ce5133a77536eee1867e96d87b190c3f589b41e7fa55440de72880bdf54e010000000000000004a5f53ed70d000000000000ffffffff026d9bd14a000000001976a91478ce48f88c94df3762da89dc8498205373a8ce6f88ac0000000000000000266a24aa21a9edf6addde9f85e6eb9d990f21898e3dc174ce2f36fb831a9ba2d1205291ec8a1e40120000000000000000000000000000000000000000000000000000000000000000000000000",
  "txid": "0cd7d76e5666a066ba7e7ecb84755a1c58bee6456de76b2516bb039589c9081d",
  "hash": "1d6ec45dd2a63099fbb11adc08f76e2022d014572a0cedc7d6124918ad56ffa8",
  "size": 243,
  "vsize": 216,
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "03c02008040ce3505b662f4254432e434f4d2ffabe6d6d8f19ce5133a77536eee1867e96d87b190c3f589b41e7fa55440de72880bdf54e010000000000000004a5f53ed70d000000000000",
      "txinwitness": [
        "0000000000000000000000000000000000000000000000000000000000000000"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 12.55250797,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 78ce48f88c94df3762da89dc8498205373a8ce6f OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91478ce48f88c94df3762da89dc8498205373a8ce6f88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1C1mCxRukix1KfegAY5zQQJV7samAciZpv"
        ]
      }
    }, 
    {
      "value": 0.00000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_RETURN aa21a9edf6addde9f85e6eb9d990f21898e3dc174ce2f36fb831a9ba2d1205291ec8a1e4",
        "hex": "6a24aa21a9edf6addde9f85e6eb9d990f21898e3dc174ce2f36fb831a9ba2d1205291ec8a1e4",
        "type": "nulldata"
      }
    }
  ],
  "blockhash": "000000000000000000158c2c1ad9a1fcddf8a771fde6b6b4fcf7b443b310cc7b",
  "confirmations": 1,
  "time": 1532027659,
  "blocktime": 1532027659
}

amaclin

Posted 2018-07-19T19:14:14.440

Reputation: 5 763

1

As an alternative to Amaclin’s answer:

Once you use getrawtransaction, you can copy the raw transaction hex string into a decoderawtransactioncommand to return the detailed transaction info.

ie:

bitcoin-cli decoderawtransaction [raw transaction hex string]

chytrik

Posted 2018-07-19T19:14:14.440

Reputation: 10 276