Tuesday, April 16, 2024
HomeBitcoinscript - A number of enter/output transactions utilizing golang btcd

script – A number of enter/output transactions utilizing golang btcd


There may not be a straightforward reply, however the developper documentation might be a primary cease (https://bitcoin.org/en/developer-examples#complex-raw-transaction). Additionally I used regularily a block explorer (e.g. blockchain.information) to show the transaction and likewise its “uncooked” format. This permits to see the tx particulars in it is JSON format. Additionally the ebook from Andreas helped alot (Mastering Bitcoin). And eventually there may be additionally this discussion board right here (the search operate is sweet), and bitcointalk.org. Oh, then there may be the wiki as effectively: https://en.bitcoin.it/wiki/Protocol_documentation#tx.

For the inputs, is it so simple as taking all of the enter transactions
into little-endian, noting the proper quantity in inputs, and going
from there?

No, I do not assume so. There isn’t any such factor as easy 🙂
You might be on the fitting path, moreover when assembling a uncooked, unsigned transaction, and you must take care of discipline lengths, and with “var_int”, that are defined in developper docs. Here’s a pattern tx, so that you get an concept:

VERSION                                 01000000
TX_IN COUNT [var_int]:                  hex=03, decimal=3
 TX_IN[0]
  TX_IN[0] OutPoint hash (char[32])     94FAE0AC28792796063F23F4A4BA4F977A9599D1579C5AAE7CE6DDA4F8A6B1BB
  TX_IN[0] OutPoint index (uint32_t)    hex=14040000, reversed=00000414, decimal=1044
  TX_IN[0] Script Size (var_int)      hex=19, decimal=25
  TX_IN[0] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[0] Sequence (uint32_t)          FFFFFFFF
 TX_IN[1]
  TX_IN[1] OutPoint hash (char[32])     A3E719B12275357B15FC5DECD9088A0964FE860D49F026F2152E71F681AC3FA4
  TX_IN[1] OutPoint index (uint32_t)    hex=31040000, reversed=00000431, decimal=1073
  TX_IN[1] Script Size (var_int)      hex=19, decimal=25
  TX_IN[1] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[1] Sequence (uint32_t)          FFFFFFFF
 TX_IN[2]
  TX_IN[2] OutPoint hash (char[32])     874CD4C4E1683C43A98A9DAA0926BEA37C10616F165AC35481E8181BFD449C65
  TX_IN[2] OutPoint index (uint32_t)    hex=E0010000, reversed=000001E0, decimal=480
  TX_IN[2] Script Size (var_int)      hex=19, decimal=25
  TX_IN[2] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[2] Sequence (uint32_t)          FFFFFFFF

TX_OUT COUNT                            hex=01, decimal=1
 TX_OUT[0]
  TX_OUT[0] Worth (uint64_t)            hex=8038010000000000, reversed_hex=0000000000013880, dec=80000, bitcoin=0.00080000
  TX_OUT[0] PK_Script Size (var_int)  hex=19, dec=25
  TX_OUT[0] pk_script (uchar[])         76A914C2DF275D78E506E17691FD6F0C63C43D15C897FC88AC
LOCK_TIME                               00000000

For outputs, do you simply have a person block of to satoshiBytes
to scriptPubKey?

It’s similiar to the instance above, simply haven’t got one at hand. However the majority of tx have a spend-to tackle, and a return tackle, so that you would possibly look a tx up within the block explorer…
Blissful coding ! 🙂

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments