0

I used to be able to get RawTX transactions on the Blockchain using the link:

https://blockchain.info/tx/60183ab915f2f4b0190605f98bd0e9f8eafe13a1c902b3ae87ecd0dfc8a599a0?format=hex

But the site switched to another domain and changed the api. If scripts for Ubuntu to get RawTX from a set of hashes?

How can I get RawTX now? Tell me the ways?

1 Answer 1

1

You can get this data by running a bitcoin-core full node with txindex=1 in the configuration file. You can then use the command bitcoin-cli getrawtransaction (TX_HASH) to get the raw transaction info.

For example:

$ bitcoin-cli getrawtransaction 60183ab915f2f4b0190605f98bd0e9f8eafe13a1c902b3ae87ecd0dfc8a599a0
0200000001a1565a3e50056710a250abaf55bd8b3f9bcf7ff413e23e7f8ff5d3dd25d66117020000008b483045022100ded45306a6ac022f13a16e994c87bb3f348d13e5039a5e088fe94c79e1d1ab5e0220311339632ef240d633510516c2536ae091eb176f14548412375f6f80d45e1a6b0141047146f0e0fcb3139947cf0beb870fe251930ca10d4545793d31033e801b5219abf56c11a3cf3406ca590e4c14b0dab749d20862b3adc4709153c280c2a78be10cffffffff0803170400000000001976a914817f1daf3b1080aa9d06b6969fa162b8d75a490d88ac80f773000000000017a9142c4154736c01c24d66a9e9f08df10a717e8dc81e87dbb9f4000000000017a91442771b8871e5df7baa107253c3ba156feb17db498776ecf900000000001976a9145b90ceac145472d39366f5c174e495e754e2016a88ac10037d01000000001976a9142c7c79f6a4a19b8a6071144dd9ee438d1e60c3c888ac00c2eb0b0000000017a914eade7d94aa4077025a322002a3d4f662d0bb8f1b8780fb4c2b020000001976a914d5458947802140d1ca099ef3f5b25151183e285f88ac42e3a413040000001976a91443849383122ebb8a28268a89700c9f723663b5b888ac00000000

Adding a 1 to the end of that command will return a more verbose output:

$ bitcoin-cli getrawtransaction 60183ab915f2f4b0190605f98bd0e9f8eafe13a1c902b3ae87ecd0dfc8a599a0 1
{
  "txid": "60183ab915f2f4b0190605f98bd0e9f8eafe13a1c902b3ae87ecd0dfc8a599a0",
  "hash": "60183ab915f2f4b0190605f98bd0e9f8eafe13a1c902b3ae87ecd0dfc8a599a0",
  "version": 2,
  "size": 456,
  "vsize": 456,
  "weight": 1824,
  "locktime": 0,
  "vin": [
    {
      "txid": "1761d625ddd3f58f7f3ee213f47fcf9b3f8bbd55afab50a2106705503e5a56a1",
      "vout": 2,
      "scriptSig": {
        "asm": "3045022100ded45306a6ac022f13a16e994c87bb3f348d13e5039a5e088fe94c79e1d1ab5e0220311339632ef240d633510516c2536ae091eb176f14548412375f6f80d45e1a6b[ALL] 047146f0e0fcb3139947cf0beb870fe251930ca10d4545793d31033e801b5219abf56c11a3cf3406ca590e4c14b0dab749d20862b3adc4709153c280c2a78be10c",
        "hex": "483045022100ded45306a6ac022f13a16e994c87bb3f348d13e5039a5e088fe94c79e1d1ab5e0220311339632ef240d633510516c2536ae091eb176f14548412375f6f80d45e1a6b0141047146f0e0fcb3139947cf0beb870fe251930ca10d4545793d31033e801b5219abf56c11a3cf3406ca590e4c14b0dab749d20862b3adc4709153c280c2a78be10c"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.00268035,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 817f1daf3b1080aa9d06b6969fa162b8d75a490d OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914817f1daf3b1080aa9d06b6969fa162b8d75a490d88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1CoiSvDYA5KLJMpriJsZumg2iZ5Ds31r33"
        ]
      }
    },
    {
      "value": 0.07600000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 2c4154736c01c24d66a9e9f08df10a717e8dc81e OP_EQUAL",
        "hex": "a9142c4154736c01c24d66a9e9f08df10a717e8dc81e87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "35j1vBeT4iPeTM3zdzHpaz4byPcSUEp27Z"
        ]
      }
    },
    {
      "value": 0.16038363,
      "n": 2,
      "scriptPubKey": {
        "asm": "OP_HASH160 42771b8871e5df7baa107253c3ba156feb17db49 OP_EQUAL",
        "hex": "a91442771b8871e5df7baa107253c3ba156feb17db4987",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "37kTCwc3q8UF8wyqmSMkbzesMPbN6Bj3B1"
        ]
      }
    },
    {
      "value": 0.16378998,
      "n": 3,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 5b90ceac145472d39366f5c174e495e754e2016a OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9145b90ceac145472d39366f5c174e495e754e2016a88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "19M9xr1r3Un2XpUDEPxEapsHrnZNF3KdBj"
        ]
      }
    },
    {
      "value": 0.24970000,
      "n": 4,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 2c7c79f6a4a19b8a6071144dd9ee438d1e60c3c8 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9142c7c79f6a4a19b8a6071144dd9ee438d1e60c3c888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "154DrDQEkazY4k27PW6khJ3LyPH7ZTjGp1"
        ]
      }
    },
    {
      "value": 2.00000000,
      "n": 5,
      "scriptPubKey": {
        "asm": "OP_HASH160 eade7d94aa4077025a322002a3d4f662d0bb8f1b OP_EQUAL",
        "hex": "a914eade7d94aa4077025a322002a3d4f662d0bb8f1b87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "3P6taM3ogQJpzMDFkNg8coxZinbudUsNND"
        ]
      }
    },
    {
      "value": 93.16400000,
      "n": 6,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 d5458947802140d1ca099ef3f5b25151183e285f OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914d5458947802140d1ca099ef3f5b25151183e285f88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1LSgEKji3ZoGdvzBgkcJMej74iBd38fySb"
        ]
      }
    },
    {
      "value": 175.09442370,
      "n": 7,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 43849383122ebb8a28268a89700c9f723663b5b8 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91443849383122ebb8a28268a89700c9f723663b5b888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "17A16QmavnUfCW11DAApiJxp7ARnxN5pGX"
        ]
      }
    }
  ],
  "hex": "0200000001a1565a3e50056710a250abaf55bd8b3f9bcf7ff413e23e7f8ff5d3dd25d66117020000008b483045022100ded45306a6ac022f13a16e994c87bb3f348d13e5039a5e088fe94c79e1d1ab5e0220311339632ef240d633510516c2536ae091eb176f14548412375f6f80d45e1a6b0141047146f0e0fcb3139947cf0beb870fe251930ca10d4545793d31033e801b5219abf56c11a3cf3406ca590e4c14b0dab749d20862b3adc4709153c280c2a78be10cffffffff0803170400000000001976a914817f1daf3b1080aa9d06b6969fa162b8d75a490d88ac80f773000000000017a9142c4154736c01c24d66a9e9f08df10a717e8dc81e87dbb9f4000000000017a91442771b8871e5df7baa107253c3ba156feb17db498776ecf900000000001976a9145b90ceac145472d39366f5c174e495e754e2016a88ac10037d01000000001976a9142c7c79f6a4a19b8a6071144dd9ee438d1e60c3c888ac00c2eb0b0000000017a914eade7d94aa4077025a322002a3d4f662d0bb8f1b8780fb4c2b020000001976a914d5458947802140d1ca099ef3f5b25151183e285f88ac42e3a413040000001976a91443849383122ebb8a28268a89700c9f723663b5b888ac00000000",
  "blockhash": "000000000000000000203285ed3cdc4928fa74ccfc9a278c4a79caf09a0d00b1",
  "confirmations": 178585,
  "time": 1523893268,
  "blocktime": 1523893268
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.