bitcoin core – decoding transaction hash returned in rpc name getrawtransaction

on

|

views

and

comments


It’s essential to use a library written to parse Blockchain knowledge.

This is my very own instance. My library is unpublished, decide a special one from search outcomes

package deal foremost

import (
    "encoding/hex"
    "fmt"
    "os"
)

// Learn transaction knowledge in hex from a file, parse & print it
func txFromFile(fileName string) {
    txHex, err := os.ReadFile(fileName)
    if err != nil { panic(err) }
    fmt.Println(string(txHex))

    b, err := hex.DecodeString(string(txHex))
    if err != nil { panic(err) }

    buf :=  NewMyBuffer(b)

    tx := parseTx(buf, 1)

    fmt.Println(tx.String())
}

Instance use

C> blockchain -txfile tx.hex
010000000001026a8da33916366b884349772dc022a39c4cf8d60acc45fd2527a71e5c80cc6da2000000000000000000208a35c4425160d006ed968606485258a1ecca80550ea48def5d44511bab553200000000000000000002e847791400000000160014885f1f476949438e34d3928fcff3449c339f934dc8633b0300000000160014618736c1f42c5029a5887a5ebac292720a4ccd1802483045022100f3d721d184ad19e50ca085fedb0c2654b1c5bd3cedb4b5f1d502ca7f21df125402204d87cda1511ebc1d943b0ee223aa2ade62410c51028d04ffabb3dfd7c1120273012102826930ee848903793b57d2e253284dfa0df86de1103bace30b84ab619e663fb402463043021f718f2adabc9214c196942861bfe93c8e96dd3517c6d4988898a901485ed0c1022007fee4bfd89d6d1f936932c3dd37fcad44cdcd6ec3ad9daebc2b8d8d7da1d5e1012102826930ee848903793b57d2e253284dfa0df86de1103bace30b84ab619e663fb400000000

  Model:................01000000 (1)
  Sort:...................0001 (Segwit)
  Inputs:.................02 (2)
  Enter:1
    Earlier Transaction:.A26DCC805C1EA72725FD45CC0AD6F84C9CA322C02D774943886B361639A38D6A
    Earlier Output Index:0000 (0)
    Script Size:........00 (0)
    Unlocking Script:.....
    Sequence:.............00000000
  Enter:2
    Earlier Transaction:.3255AB1B51445DEF8DA40E5580CAECA1585248068696ED06D0605142C4358A20
    Earlier Output Index:0000 (0)
    Script Size:........00 (0)
    Unlocking Script:.....
    Sequence:.............00000000
  Outputs:................02 (2)
  Output 1
    Worth:................E847791400000000 (343492584)
    Script Size:........16 (22)
    Locking Script:.......0014885F1F476949438E34D3928FCFF3449C339F934D
  Output 2
    Worth:................C8633B0300000000 (54223816)
    Script Size:........16 (22)
    Locking Script:.......0014618736C1F42C5029A5887A5EBAC292720A4CCD18
  Witness 1
    Merchandise Rely:...........02 (2)
    Merchandise 1
      Size:.............48 (72)
      Knowledge:...............3045022100F3D721D184AD19E50CA085FEDB0C2654B1C5BD3CEDB4B5F1D502CA
                          7F21DF125402204D87CDA1511EBC1D943B0EE223AA2ADE62410C51028D04FFAB
                          B3DFD7C112027301
    Merchandise 2
      Size:.............21 (33)
      Knowledge:...............02826930EE848903793B57D2E253284DFA0DF86DE1103BACE30B84AB619E663F
                          B4
  Witness 2
    Merchandise Rely:...........02 (2)
    Merchandise 1
      Size:.............46 (70)
      Knowledge:...............3043021F718F2ADABC9214C196942861BFE93C8E96DD3517C6D4988898A90148
                          5ED0C1022007FEE4BFD89D6D1F936932C3DD37FCAD44CDCD6EC3AD9DAEBC2B8D
                          8D7DA1D5E101
    Merchandise 2
      Size:.............21 (33)
      Knowledge:...............02826930EE848903793B57D2E253284DFA0DF86DE1103BACE30B84AB619E663F
                          B4
  LockTime:...............00000000 (0)
  (Calculated hash is 2C1DEA91142889092E41F0617250F83E0601E87290FAF0676F813F0F55063270)

Share this
Tags

Must-read

Waymo raises $16bn to gas international robotaxi enlargement | Know-how

Self-driving automobile firm Waymo on Monday stated it raised $16bn in a funding spherical that valued the Alphabet subsidiary at $126bn.Waymo co-chief executives...

Self-driving taxis are coming to London – ought to we be anxious? | Jack Stilgoe

At the top of the nineteenth century, the world’s main cities had an issue. The streets had been flooded with manure, the unintended...

US regulators open inquiry into Waymo self-driving automobile that struck youngster in California | Expertise

The US’s federal transportation regulator stated Thursday it had opened an investigation after a Waymo self-driving car struck a toddler close to an...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here