Author

Topic: main() in bitcoin-tx.cpp (Read 726 times)

jr. member
Activity: 113
Merit: 5
November 13, 2017, 12:19:18 AM
#10
So in "bitcoin-tx -create in=0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b:0 ...."
The 0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b is the txid.

Thank you.

We can use the command "bitcoin-tx -create --help"  to see the explanation of the options in the command.
member
Activity: 266
Merit: 42
The rising tide lifts all boats
November 12, 2017, 01:14:28 PM
#9
Code:
in=0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b:0

TxIn (transaction input) structure consists of prevOut, scriptSig and sequence.
In bitcoind code prevOut has type COutPoint which consists of txid and output number.
So the "in=" you quoted means the transaction will spend the output with index 0 from transaction with id 0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b, if the signature in scriptSig will be correct for
the corresponding TxOut's pk_script.

I guess the signature is generated from a key in your wallet file, if it can sign this input.
jr. member
Activity: 113
Merit: 5
November 12, 2017, 08:40:31 AM
#8
What about the in format ? what is 0fb9df56..... ? It is previous tx or scriptSig?
Read https://bitcoin.org/en/developer-reference#raw-transaction-format

I read the link about raw transaction format. It says raw transaction has version, tx_in count, Tx_in, TX_out count, Tx_out and lock time.

I can't relate this format to the hex value in the input part.
staff
Activity: 3458
Merit: 6793
Just writing some code
November 12, 2017, 12:14:09 AM
#7
What about the in format ? what is 0fb9df56..... ? It is previous tx or scriptSig?
Read https://bitcoin.org/en/developer-reference#raw-transaction-format
jr. member
Activity: 113
Merit: 5
November 11, 2017, 09:22:41 PM
#6
Thank you. Now I use the bitcoin-tx binary.

bitcoin-tx -create in=0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b:0 outscript=0.00159999:"DUP HASH160 0x14 0x6793a38f79b8cd51dbb6face6dc75a4af5c1bf29 EQUALVERIFY CHECKSIG"

and got the return value
02000000012b80bf9aeb824f609612cc05ceb7f1830d756240ce3404be338bbe1456dfb90f00000 00000ffffffff01ff700200000000001976a9146793a38f
79b8cd51dbb6face6dc75a4af5c1bf2988ac00000000

i understand the outscript format. 0.00159999 is the value to be spent. What about the in format ? what is 0fb9df56..... ? It is previous tx or scriptSig?
staff
Activity: 3458
Merit: 6793
Just writing some code
November 11, 2017, 09:05:47 PM
#5
It looks like bitcoin-tx.cpp is never built into the bincoind binary of Bitcoin core, isn't  it?
No, it is not. bitcoin-tx.cpp is for bitcoin-tx, a completely separate binary. It only exists to provide the separate bitcoin-tx binary.
jr. member
Activity: 113
Merit: 5
November 10, 2017, 09:52:11 AM
#4
There is a separate binary called bitcoin-tx which lets you do some transaction specific things without needing to run the full Bitcoin Core. It needs a main function for that binary to work.

It looks like bitcoin-tx.cpp is never built into the bincoind binary of Bitcoin core, isn't  it?
jr. member
Activity: 113
Merit: 5
November 08, 2017, 07:50:30 PM
#3
thank you. should have seen that
staff
Activity: 3458
Merit: 6793
Just writing some code
November 08, 2017, 10:12:21 AM
#2
There is a separate binary called bitcoin-tx which lets you do some transaction specific things without needing to run the full Bitcoin Core. It needs a main function for that binary to work.

Likewise, there are main functions in bitcoin-cli.cpp and qt/bitcoin.cpp as those are for separate binaries that need main functions too (bitcoin-cli and bitcoin-qt respectively).
jr. member
Activity: 113
Merit: 5
November 08, 2017, 08:58:01 AM
#1
I notice that is a main() function in bitcoin-tx.cpp. This main() is not the main function of bitcoin core. Because the main function is in bitcoind.cpp

So why there is a main() in bitcoin-tx.cpp ?
Jump to: