0

Every transaction takes unspent outputs as inputs and creates new outputs. The creator of the transaction uses his private key to sign the transaction and nodes validate that transaction by using the public key of the creator.

But how excactly are transactions formated? I have seen this on the bitcoin wiki:

Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

Output:
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG

If we use this transaction as an example, how do we take the data from this and format it into a RAW signed transaction that I could send straight into the network without the need of a wallet?

Also, after creating the signed RAW transaction, is it just hashed by SHA256 to create its hash ID or does creating the ID consist of other steps?

Lastly, what is scriptSig? I don't quiet understand scripts in general so if someone could give me a brief explanation of that as well I'd be grateful

Thanks in advance!

Fihdi

1

If we use this transaction as an example, how do we take the data from this and format it into a RAW signed transaction that I could send straight into the network without the need of a wallet?

The referenced tx is already spent. So it cannot be re-used. Also you cannot reformat it into a RAW signed tx. There would be 2 steps required. First reformat into a "RAW UNSIGNED" tx, and then this would run through another set of commands to get it signed. Only then it could be sent to the network. In the example, there is a bit of data missing, I'll add quickly. It becomes clear with the two links below:

version       01000000
Input(s):     1
Previous tx:  f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index:        0
script length 48
scriptSig:    304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501
Sequence      00000000
Output:       1
Value:        5000000000
script length 19
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d OP_EQUALVERIFY OP_CHECKSIG
Locktime:     FFFFFFFF

now you have chosen a coinbase tx as reference, which adds some more difficulty, but ignoring this, then next step would be serialization. Instead of repeating, here are links to amaclin's work or runek's work.

Also, after creating the signed RAW transaction, is it just hashed by SHA256 to create its hash ID or does creating the ID consist of other steps?

No. Not that easy :-) See the link above, and what also gave me a very good hint was Ken Shirriff's blog "Bitcoins the hard way". There is many different data representation involved, including reversed hex and more, which adds layer(s) of complexity.

Lastly, what is scriptSig? I don't quiet understand scripts in general

Basically it makes sure, that the condition to spend the transaction's funds are verified. This has been asked several times in bitcoin.SE, so I provide another link (see my answer further down): Why does Bitcoin uses a Script language?

And as said in this link, the book from Andreas answers all these questions very well. Really highly recommended.

  • I'm quite sure that the amaclin's provided link is a copy paste of the runek's previous answer though. – sr-gi Mar 7 '18 at 8:11
0

You can sign the transaction hash data by pressing the "Sign" button by accessing the details of the transaction with tools such as Electrum. Then do not forget to say live broadcast.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.