trezor / blockbook

:blue_book: Trezor address/account balance backend
https://trezor.io
GNU Affero General Public License v3.0
640 stars 635 forks source link

how to detect multisig transactions #1095

Closed dev-dantealighieri closed 1 month ago

dev-dantealighieri commented 1 month ago

i have a transaction example like this, i want to understand if this is multi sig (that i need more than 1 public key to spend this transaction), should i check hex(script) values under the vin, our vout, or is there any other way that we can understand this in the blockbook?

(what i want to see is, when im checking the transaction, i want to know if i can spend it, or do i need another public key to spend it?)

{
  txid: "d4c101e4db2aaaa234aa00fe324a5c8e1d619346ecae2692b5f3b60a3d3ab083",
  version: 1,
  vin: [
    {
      txid: "18ecae09b2b081bdf8258ffe4adfd1f0707f926816327e47efcbd3adc6fbc4a9",
      sequence: 4294967295,
      n: 0,
      addresses: [
        "1A698ymVjxJXhWf7agSUUKmvbg59VAQZ6j",
      ],
      isAddress: true,
      value: "93787267",
      hex: "47304402203d5687732cb210b0baf8da7b9ac29a3378f0bce6dd653f7d433a16358195a59b02203e9040615716bf644486139d84cf059199cc0f0df1013c62c9f97a70b18c3e820141041b2bbeb965a37fae1f20f6e8199b407cfc968070c5f0e5da17d1ea1873b61c74c52a52e01746438a655f1fd21636e27dbad79d9df92f11e2c52e8cbe771853a3",
    },
  ],
  vout: [
    {
      value: "52837267",
      n: 0,
      spent: true,
      spentTxId: "69ee46e01a2d5fde7903286bcabdfb75bc5bf81777a6c45c7974fd14c775c719",
      spentIndex: 1,
      spentHeight: 164052,
      hex: "76a914028980e10347ffdad83105f6080186275fe65b9d88ac",
      addresses: [
        "1ER5HoaBCfyxi8opNGxQbUs6PagHtvt6C",
      ],
      isAddress: true,
    },
    {
      value: "40900000",
      n: 1,
      spent: true,
      spentTxId: "67b37ee9d86118c22a237b79d5af31b100e2abdd8c670ad4eda1ee22a040bd37",
      spentIndex: 1,
      spentHeight: 164049,
      hex: "76a914db2259266167a58859562fdc09e784c0b59b221c88ac",
      addresses: [
        "1Lyg8ZybTHARqYCX3aM4mR85eZArxXAMcD",
      ],
      isAddress: true,
    },
  ],
  blockHash: "000000000000019ca1fff7f5e9109cb33698cdcd1cc83a86c7eb3d362dc67e7e",
  blockHeight: 164049,
  confirmations: 681021,
  blockTime: 1327651798,
  size: 257,
  vsize: 257,
  value: "93737267",
  valueIn: "93787267",
  fees: "50000",
  hex: "0100000001a9c4fbc6add3cbef477e321668927f70f0d1df4afe8f25f8bd81b0b209aeec18000000008a47304402203d5687732cb210b0baf8da7b9ac29a3378f0bce6dd653f7d433a16358195a59b02203e9040615716bf644486139d84cf059199cc0f0df1013c62c9f97a70b18c3e820141041b2bbeb965a37fae1f20f6e8199b407cfc968070c5f0e5da17d1ea1873b61c74c52a52e01746438a655f1fd21636e27dbad79d9df92f11e2c52e8cbe771853a3ffffffff02933b2603000000001976a914028980e10347ffdad83105f6080186275fe65b9d88aca0157002000000001976a914db2259266167a58859562fdc09e784c0b59b221c88ac00000000",
}

thanks, dante

dev-dantealighieri commented 1 month ago

it can be detected from address