How to generate signed_transaction, base_transaction?

0

While sending bitcoin/bitcoincash site generates 2 values: signed_transaction, base_transaction they are the same and look like this: The question is, how to generate them and what do they include?

01000000013ad07c3878acc3fa05332af64fe32e3b0f5d153ba20215958e666dbf5bb78d8600000000b70000483045022100ec2932a8bf1109ce0cc6bad5ccac9437dc6824bbed78c50a2c51422ccd527499022033ff5f661fe1f0b3be9f21cb8c6caf96acec606ba0d3b42411cd0a525496038841004c69522102da7334c20ccd5f6baff59559038a787cbd5b21fc26ba1382ce8df018ca10927a2102db1ebc7f6a8144d32c84f26f50fd7284e66d4b90103448f6579bbc2444f4378e2103d56f387a572853513d2fa017c3b426e12fe592b36e66357a17dff26752d28c1b53aeffffffff0230750000000000001976a914f66e7f8c1895967566ad9ed1cae6883900508ec888ac1e9800000000000017a914c5baf6aa42a5fec28225e67cae4640b201d7d1f18700000000

Слава Гесто

Posted 2018-01-08T05:05:12.750

Reputation: 23

Answers

1

Firstly, the signed transaction and the base_transaction will not be identical, the base_transaction will not have the signature in it. But yes they will look very similar apart from that.

What you are looking at is a hex-encoded transaction. You can decode it to see what information it contains using the decoderawtransaction API https://chainquery.com/bitcoin-api/decoderawtransaction

MeshCollider

Posted 2018-01-08T05:05:12.750

Reputation: 8 735

Other sites show different formats of decode raw.Слава Гесто 2018-01-08T06:04:53.037

0

How to generate such transaction, depends on the software you are using, or the skills that you have. For un non-techy person, the wallet software would create the transaction. If you are tech-savvy, then you can assemble yourself such a transaction, a very good overview is given by Ken Shirrif here (there is a section called "Manually creating a transaction":

Ken Shirrif and creating a tx manually

What is included in the tx? I have disassembled your tx as per below (without further disassembling the signature or pubkey scripts):

VERSION
 01000000

TX_IN COUNT [var_int]: hex=01, decimal=1
 TX_IN[0]
  TX_IN[0] OutPoint hash (char[32])
  868DB75BBF6D668E951502A23B155D0F3B2EE34FF62A3305FAC3AC78387CD03A
  TX_IN[0] OutPoint index (uint32_t)
  hex=00000000, reversed=00000000, decimal=0
  TX_IN[0] Script Length (var_int)
  hex=B7, decimal=183
  TX_IN[0] Script Sig (uchar[])
  0000483045022100EC2932A8BF1109CE0CC6BAD5CCAC9437DC6824BBED78C50A2C51422CCD527499022033FF5F661FE1F0B3BE9F21CB8C6CAF96ACEC606BA0D3B42411CD0A525496038841004C69522102DA7334C20CCD5F6BAFF59559038A787CBD5B21FC26BA1382CE8DF018CA10927A2102DB1EBC7F6A8144D32C84F26F50FD7284E66D4B90103448F6579BBC2444F4378E2103D56F387A572853513D2FA017C3B426E12FE592B36E66357A17DFF26752D28C1B53AE 
  TX_IN[0] Sequence (uint32_t)
  FFFFFFFF

TX_OUT COUNT, hex=02, decimal=2
 TX_OUT[0]
  TX_OUT[0] Value (uint64_t)
  hex=3075000000000000, reversed_hex=0000000000007530, dec=30000, bitcoin=0.00030000
  TX_OUT[0] PK_Script Length (var_int)
  hex=19, dec=25
  TX_OUT[0] pk_script (uchar[])
  76A914F66E7F8C1895967566AD9ED1CAE6883900508EC888AC
 TX_OUT[1]
  TX_OUT[1] Value (uint64_t)
  hex=1E98000000000000, reversed_hex=000000000000981E, dec=38942, bitcoin=0.00038942
  TX_OUT[1] PK_Script Length (var_int)
  hex=17, dec=23
  TX_OUT[1] pk_script (uchar[])
  A914C5BAF6AA42A5FEC28225E67CAE4640B201D7D1F187

 LOCK_TIME
00000000

First an unsigned transaction is created, with all the details, and later on it is signed. The link below describes it quite nicely. To fully understand all the contents, space here on stack exchange would be wasted :-) I recommend to have a look into the developper section of "bitcoin.org", read the book from Andreas ("Mastering Bitcoin", it is online available...), and of course search in the forum here.

pebwindkraft

Posted 2018-01-08T05:05:12.750

Reputation: 4 568