0

After building litecoin v0.15.1rc1 client on Ubuntu 16.04 I wanted to build an app that uses Litecoin. But I stumbled upon something odd (at least to me).

I did the following command: ./litecoin-cli getrawtransaction 716aba3806b7737f5152af0079c73d20b924a4c1b679026feac42205e06d9f5b 1

I saw that transaction hash and block hash are absolutely the same. Can someone explain this? I can paste the whole output if requested.

Thank you in advance!

EDIT: this transaction is a testnet transaction

Full output:

{
  "txid": "716aba3806b7737f5152af0079c73d20b924a4c1b679026feac42205e06d9f5b",
  "hash": "716aba3806b7737f5152af0079c73d20b924a4c1b679026feac42205e06d9f5b",
  "version": 2,
  "size": 667,
  "vsize": 667,
  "locktime": 482836,
  "vin": [
    {
      "txid": "c7fdc7179381c001b056e2f905c5b506c79d10ae9fc3cd2a7721467a4bf05906",
      "vout": 1,
      "scriptSig": {
        "asm": "3045022100d723c11024ec3800aa87f9e20ebbd344ebcb57db5f71b2cc66155a2ea3ac167f022019f1455f1438d44e048ecf3895a5e3d041b2aca1146fc18b9c8dc4e77e40bb50[ALL] 035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44",
        "hex": "483045022100d723c11024ec3800aa87f9e20ebbd344ebcb57db5f71b2cc66155a2ea3ac167f022019f1455f1438d44e048ecf3895a5e3d041b2aca1146fc18b9c8dc4e77e40bb500121035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44"
      },
      "sequence": 4294967294
    },
    {
      "txid": "102313318e90c4c4ccb7581c90c1a8d38085106f19917544a21359067a80096a",
      "vout": 1,
      "scriptSig": {
        "asm": "30440220269bf280fd82163658da1be2f5301f851f13978937ee2c7701f654ac49ffc03602204fafb6592af7bdbedede204bd476b24fb03b50cdd75c5fbdb35e57692e870635[ALL] 0258c857eff89b9b54ccab29d4fcbadcb01c0a4cf9627fa56e4d6b96ae74f5e462",
        "hex": "4730440220269bf280fd82163658da1be2f5301f851f13978937ee2c7701f654ac49ffc03602204fafb6592af7bdbedede204bd476b24fb03b50cdd75c5fbdb35e57692e87063501210258c857eff89b9b54ccab29d4fcbadcb01c0a4cf9627fa56e4d6b96ae74f5e462"
      },
      "sequence": 4294967294
    },
    {
      "txid": "7c7c64412dfaad8bf74280748f295ae8b4fa88b469e2473b08c98198c1ba9266",
      "vout": 0,
      "scriptSig": {
        "asm": "3044022039293b68bda763f2f07ead2edd257eee35078ece91e0afdeb56b898c5e89d44502205f49dbebb0521e1cf4d74a1ec0fec0d174352e47385f773c4323e0533453e566[ALL] 035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44",
        "hex": "473044022039293b68bda763f2f07ead2edd257eee35078ece91e0afdeb56b898c5e89d44502205f49dbebb0521e1cf4d74a1ec0fec0d174352e47385f773c4323e0533453e5660121035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44"
      },
      "sequence": 4294967294
    },
    {
      "txid": "7c7c64412dfaad8bf74280748f295ae8b4fa88b469e2473b08c98198c1ba9266",
      "vout": 1,
      "scriptSig": {
        "asm": "304402200563b82f8d85ebc37f0adc106595caff6a69e5fecfda67c3003523fc195dd2a4022023f18ab2027f39b8c1e6be8cdf57d5fb6aae56c71756db4db9f123d6e88b77d3[ALL] 0209fac8d3f346aef9bf636e3d539e9c2cb0eb59bcd2898d560f0bbc9405628067",
        "hex": "47304402200563b82f8d85ebc37f0adc106595caff6a69e5fecfda67c3003523fc195dd2a4022023f18ab2027f39b8c1e6be8cdf57d5fb6aae56c71756db4db9f123d6e88b77d301210209fac8d3f346aef9bf636e3d539e9c2cb0eb59bcd2898d560f0bbc9405628067"
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 0.01885081,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 6e3201e86a59653a0ea031af8f2b03615748d248 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9146e3201e86a59653a0ea031af8f2b03615748d24888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mqZcXjXjHBTHJwSxns2ZajLHpu3Ej33gh3"
        ]
      }
    },
    {
      "value": 0.10000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 b3ebe3b4f7f100e00a1abfbb4ae39af4aece27f3 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914b3ebe3b4f7f100e00a1abfbb4ae39af4aece27f388ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mwvHqHCSHqrfp7t7bnFA74JdnmaFAVXpLk"
        ]
      }
    }
  ],
  "hex": "02000000040659f04b7a4621772acdc39fae109dc706b5c505f9e256b001c0819317c7fdc7010000006b483045022100d723c11024ec3800aa87f9e20ebbd344ebcb57db5f71b2cc66155a2ea3ac167f022019f1455f1438d44e048ecf3895a5e3d041b2aca1146fc18b9c8dc4e77e40bb500121035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44feffffff6a09807a065913a2447591196f108580d3a8c1901c58b7ccc4c4908e31132310010000006a4730440220269bf280fd82163658da1be2f5301f851f13978937ee2c7701f654ac49ffc03602204fafb6592af7bdbedede204bd476b24fb03b50cdd75c5fbdb35e57692e87063501210258c857eff89b9b54ccab29d4fcbadcb01c0a4cf9627fa56e4d6b96ae74f5e462feffffff6692bac19881c9083b47e269b488fab4e85a298f748042f78badfa2d41647c7c000000006a473044022039293b68bda763f2f07ead2edd257eee35078ece91e0afdeb56b898c5e89d44502205f49dbebb0521e1cf4d74a1ec0fec0d174352e47385f773c4323e0533453e5660121035e23a55d8804ae49e49136a2412fb53b02f3de495622ef1e6a40f63f1ea93e44feffffff6692bac19881c9083b47e269b488fab4e85a298f748042f78badfa2d41647c7c010000006a47304402200563b82f8d85ebc37f0adc106595caff6a69e5fecfda67c3003523fc195dd2a4022023f18ab2027f39b8c1e6be8cdf57d5fb6aae56c71756db4db9f123d6e88b77d301210209fac8d3f346aef9bf636e3d539e9c2cb0eb59bcd2898d560f0bbc9405628067feffffff0299c31c00000000001976a9146e3201e86a59653a0ea031af8f2b03615748d24888ac80969800000000001976a914b3ebe3b4f7f100e00a1abfbb4ae39af4aece27f388ac145e0700",
  "blockhash": "bb55f8d0463ddf6b1c854286a2f1911ab590ed154ef502406f28fd0a01e52238",
  "confirmations": 6,
  "time": 1523009113,
  "blocktime": 1523009113
}
6
  • Are you sure you're on the right chain? I don't see a tx or block for 716aba3806b7737f5152af0079c73d20b924a4c1b679026feac42205e06d9f5b on the litecoin chain – Raghav Sood Apr 6 '18 at 14:48
  • @RaghavSood its on the testnet, sorry i forgot to mention that – Micic Apr 6 '18 at 15:11
  • Can you post the full output? Looking at chain.so/tx/LTCTEST/…, it looks like the transaction hash and the block hash are different. – Andrew Chow Apr 6 '18 at 15:16
  • @AndrewChow i know that chain.so gives different hashes, i will paste it here asap – Micic Apr 6 '18 at 15:18
  • @AndrewChow pastebin.com/JHU640YT This is the output that litecoin client gives me – Micic Apr 6 '18 at 15:20
0

The txid and blockhash are clearly different. It appears that you are confusing the hash field for the blockchash field. The hash field is still just the hash of the transaction, not the hash of the block containing the transaction. Since this transaction is not a segwit transaction, the hash and txid will be the same. If this transaction were segwit (i.e. contains a segwit input), then the hash will be different from the txid.

4
  • so in conclusion, txid and hash keys are absolutely the same thing? and my pastebin is a correct output? – Micic Apr 6 '18 at 15:25
  • They are not always the same thing, but in this case they are the same thing. The output of the command is correct. – Andrew Chow Apr 6 '18 at 15:27
  • sorry for bothering you further, but shouldn't txid represent the transaction hash, and hash represent the hash of the block? – Micic Apr 6 '18 at 15:28
  • I reread the answer and get it now, sorry for additional questions. Thank you! – Micic Apr 6 '18 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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