Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse bitcoin transaction data #40

Closed
Tracked by #22
oxf71 opened this issue Nov 16, 2023 · 0 comments · Fixed by #44
Closed
Tracked by #22

parse bitcoin transaction data #40

oxf71 opened this issue Nov 16, 2023 · 0 comments · Fixed by #44
Assignees
Labels
feature new function

Comments

@oxf71
Copy link
Collaborator

oxf71 commented Nov 16, 2023

Goal

parse bitcoin tx, get from addrerss, to address, amount

Implement

  • Take the output of tx and see if the address of the output is equal to our receiving address
  • If it's equal to the receiving address, go get the value and the sender address
  • sender address is analyzed from input of tx according to txid and n
{
  "txid": "ff234571d6a7711c25ad68ca2eab5e5c8a85626e8dc276b49fcae2892473c5a0",
  "hash": "7ecd5808f3f84ad6b06ff0f19dc7510a6d05c1c4bd3050d091ca75d340df2add",
  "version": 2,
  "size": 253,
  "vsize": 172,
  "weight": 685,
  "locktime": 169611,
  "vin": [
    {
      "txid": "781580fe3ec70c5e1dea51ebb8ea97e42a1f151e4a1b5b0ceea73cbb342a325e",    (Use txid and vout to find from_address)
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "304402202ae6d0b767a36a4d814503d7a6809bb6473c0117827ac6d4b9691faf9cadb6b602207298ed4ab5cd18df71b8ffab447f00c27aa078c3a23a127519fad802321136df01",
        "03b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e177"
      ],
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.00100005,  (value)
      "n": 0,
      "scriptPubKey": {
        "asm": "0 e58d88c091846d49d045c19713108e4625b0a962",
        "desc": "addr(tb1qukxc3sy3s3k5n5z9cxt3xyywgcjmp2tzudlz2n)#gfv8e9ks",
        "hex": "0014e58d88c091846d49d045c19713108e4625b0a962",
        "address": "tb1qukxc3sy3s3k5n5z9cxt3xyywgcjmp2tzudlz2n",  (to address)
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00100005,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 3af616edf94967988eac2eb1c9c43dd5ccbc11f9",
        "desc": "addr(tb1q8tmpdm0ef9ne3r4v96cun3pa6hxtcy0e3f0wdd)#kyzapmdd",
        "hex": "00143af616edf94967988eac2eb1c9c43dd5ccbc11f9",
        "address": "tb1q8tmpdm0ef9ne3r4v96cun3pa6hxtcy0e3f0wdd",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00791291,
      "n": 2,
      "scriptPubKey": {
        "asm": "0 ca6ef3338977842525c3f0e5a584964cf10e2e79",
        "desc": "addr(tb1qefh0xvufw7zz2fwr7rj6tpykfncsutne4p6jv3)#h688732w",
        "hex": "0014ca6ef3338977842525c3f0e5a584964cf10e2e79",
        "address": "tb1qefh0xvufw7zz2fwr7rj6tpykfncsutne4p6jv3",
        "type": "witness_v0_keyhash"
      }
    }
  ],
  "hex": "020000000001015e322a34bb3ca7ee0c5b1b4a1e151f2ae497eab8eb51ea1d5e0cc73efe8015780100000000fdffffff03a586010000000000160014e58d88c091846d49d045c19713108e4625b0a962a5860100000000001600143af616edf94967988eac2eb1c9c43dd5ccbc11f9fb120c0000000000160014ca6ef3338977842525c3f0e5a584964cf10e2e790247304402202ae6d0b767a36a4d814503d7a6809bb6473c0117827ac6d4b9691faf9cadb6b602207298ed4ab5cd18df71b8ffab447f00c27aa078c3a23a127519fad802321136df012103b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e1778b960200"
}




{
  "txid": "781580fe3ec70c5e1dea51ebb8ea97e42a1f151e4a1b5b0ceea73cbb342a325e",
  "hash": "4a277577e89a6cee945af18fc2a3fdc9b7463a72c7515427e23d4998f77aaab7",
  "version": 1,
  "size": 234,
  "vsize": 153,
  "weight": 609,
  "locktime": 0,
  "vin": [
    {
      "txid": "65fc47a4eceb1009066f13fcb0568a19f13c54c997f9e051928ac7420534d932",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "304402203542dcd6e74cb6591b7bb8a0c12a3b5991d16f9126aa7e22207de82782674d780220726866b61579090f1a407168b8447682d304f8cc7f8134cf15840a72fa8ed79f01",
        "03b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e177"
      ],
      "sequence": 4294967285
    }
  ],
  "vout": [
    {
      "value": 0.00003854,
      "n": 0,
      "scriptPubKey": {
        "asm": "1 6a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c",
        "desc": "rawtr(6a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c)#msnnw5xu",
        "hex": "51206a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c",
        "address": "tb1pdgna2q6lsyfgmpfuwexxj3nnuu9knack2ewkpysdc86trz8rcsxqahjz35",
        "type": "witness_v1_taproot"
      }
    },
    {
      "value": 0.00993021,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 99a4deb673f775b750d9a68295dc03b6c02016ac",
        "desc": "addr(tb1qnxjdadnn7a6mw5xe56pfthqrkmqzq94vy5q9s5)#uu0zlr8d",
        "hex": "001499a4deb673f775b750d9a68295dc03b6c02016ac",
        "address": "tb1qnxjdadnn7a6mw5xe56pfthqrkmqzq94vy5q9s5",    (from address)
        "type": "witness_v0_keyhash"
      }
    }
  ],
  "hex": "0100000000010132d9340542c78a9251e0f997c9543cf1198a56b0fc136f060910ebeca447fc650100000000f5ffffff020e0f0000000000002251206a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40cfd260f000000000016001499a4deb673f775b750d9a68295dc03b6c02016ac0247304402203542dcd6e74cb6591b7bb8a0c12a3b5991d16f9126aa7e22207de82782674d780220726866b61579090f1a407168b8447682d304f8cc7f8134cf15840a72fa8ed79f012103b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e17700000000",
  "blockhash": "000000c83c5fd01a26ff50b7338cef38986ec534906eee5c6852fbb06a360800",
  "confirmations": 441,
  "time": 1699857576,
  "blocktime": 1699857576
}
@oxf71 oxf71 added the feature new function label Nov 16, 2023
@oxf71 oxf71 self-assigned this Nov 16, 2023
@oxf71 oxf71 changed the title parse transaction data parse bitcoin transaction data Nov 16, 2023
This was referenced Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new function
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants