Author

Topic: If you have read "Mastering Bitcoin", can you please answer this question? (Read 1936 times)

hero member
Activity: 518
Merit: 502

I really don't know much about the book.  I'm not sure what sort of technical details, if any, it has.

It has many, many technical details and lots of code.  I don't know anything about code but read the book for the rest of the info, I probably missed out on ~50% of what was presented therein.

But yes, it does go over how to code your own tx and much, much more.  Worth the purchase and read for sure (I've read mine twice already).

You can browse "Mastering Bitcoin" (or read it all) here.  Not in a nice published format, but most of the final content is there.  

If you end up reading it all - consider buying the "real" book to support the author.

It's a good book and worth the money. It explains all the underlying concepts very well, and it a more detailed and practical manner than most sources do. AFAIK he doesn't saw anything about blockchain.info's API (apart that it exists)
legendary
Activity: 1274
Merit: 1000

I really don't know much about the book.  I'm not sure what sort of technical details, if any, it has.

It has many, many technical details and lots of code.  I don't know anything about code but read the book for the rest of the info, I probably missed out on ~50% of what was presented therein.

But yes, it does go over how to code your own tx and much, much more.  Worth the purchase and read for sure (I've read mine twice already).
hero member
Activity: 672
Merit: 508
LOTEO
Will this book provide me with enough knowledge so that I can, with only Bitcoin Core and nothing else, create a bitcoin transaction that puts my own SHA-512 hash of a text onto the blockchain? (I want to prove 10 years from now that I wrote this text 10 years ago and I want to do this myself with only Bitcoin Core.)

I skimmed through the book and it seems very focused on the Blockchain.info API. Am I right about this? I'm not really interested in the Blockchain.info API. I wanna do things myself using the core software.

To put your SHA-512 hash on the blockchain you do not need to read a book. All you need is a script to create the transaction, have a look on github. Take one of the bitcoin libraries https://github.com/search?utf8=%E2%9C%93&q=bitcoin+library&type=Repositories&ref=searchresults and create the transaction.  

How to put your own message in the blockchain:
It's pretty easy to put your own 20-character message into the blockchain. The following steps explain how.

1. Take your 20-character string and convert it to hex. E.g. in Python: 'http://righto.com/bc'.encode('hex')
2.Convert the resulting hex string to an address. An easy way is online: https://blockchain.info/q/hashtoaddress/your hex value yields 1AXJnNiDijKUnY9UJZkV5Ggdgh36aWDBYj.
3. Send bitcoins to that address and your message will show up in the blockchain when your transaction gets mined. Important: those bitcoins will be lost forever, so send a very small amount, like 10 cents.


full member
Activity: 233
Merit: 102
Quote
Thanks, but one question, is everything in Nakamoto's paper still valid or has some of it been rendered out of date due to later developments? A lot has changed since then, I imagine - including maybe how the transactions look etc.?

It's almost clichéd how often you'll hear read the whitepaper. OP provided a fantastic answer to your question and is obviously very knowledgable, even still, whenever I hear someone give the generic read the whitepaper response, I kind of cringe. The whitepaper absolutely won't have any answers to this particular question if you've already read a bit about Bitcoin. It's a high level conceptual description which is either covering familiar ground in terse language, or confusing a newb with the same terse language, ie the whitepaper is certainly not more readable than the Andreas book

All of this IMO obviously
sr. member
Activity: 293
Merit: 251
Director - www.cubeform.io
Although you seem to be an advanced enough user to go about this in a self tailored ideal way, I just wanted to present for reference: http://www.proofofexistence.com/
legendary
Activity: 3472
Merit: 4801
Thanks, but one question, is everything in Nakamoto's paper still valid or has some of it been rendered out of date due to later developments? A lot has changed since then, I imagine - including maybe how the transactions look etc.?

The paper is really a high level view of how the overall concepts work.

There are a few implementation details that have changed, but the basic concepts are the core of how bitcoin works.

Probably the most significant detail that is not technically correct is in section 4. (Proof-of-work)

In that section, the paper describes "scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits".  In reality, bitcoin uses a target value than can be adjusted with much more precision than simply increasing or decreasing the number of leading zeros.

Additionally, the paper assumes CPU mining and makes statements such as "Proof-of-work is essentially one-CPU-one-vote"  Mining has moved on to ASIC technologies and as such it would be more accurate to replace any reference to "CPU" in the paper with "hash".  As such, the statement would be more accurately understood as "Proof-of-work is essentially one-hash-one-vote".

The paper really doesn't go into details on the specific implementation of most of the concepts.  Once you have a good understanding of the basic concepts, I find that the bitcoin wiki is a great source of technical details.

For example, here are a few pages that I use frequently:

pf
full member
Activity: 176
Merit: 105
Thanks.

You're welcome.

I'll be damned. You see, this is the kind of knowledge I want in my brain . . . Of course, feel free to recommend other material too!

If you haven't done so already, start by reading the original whitepaper released by Satoshi Nakamoto.

After that, feel free to ask any questions here at bitcointalk.  There are some very knowledgeable people here, and they are very willing to share their knowledge and help others learn.

and I was just wondering if Antonopoulos's book will provide it.

I really don't know much about the book.  I'm not sure what sort of technical details, if any, it has.

Thanks, but one question, is everything in Nakamoto's paper still valid or has some of it been rendered out of date due to later developments? A lot has changed since then, I imagine - including maybe how the transactions look etc.?
legendary
Activity: 3472
Merit: 4801
Thanks.

You're welcome.

I'll be damned. You see, this is the kind of knowledge I want in my brain . . . Of course, feel free to recommend other material too!

If you haven't done so already, start by reading the original whitepaper released by Satoshi Nakamoto.

After that, feel free to ask any questions here at bitcointalk.  There are some very knowledgeable people here, and they are very willing to share their knowledge and help others learn.

and I was just wondering if Antonopoulos's book will provide it.

I really don't know much about the book.  I'm not sure what sort of technical details, if any, it has.
pf
full member
Activity: 176
Merit: 105
In case you want to try creating the transaction without reading the book, follow these steps.

Create a new address in your Bitcoin Core wallet

Send a 0.0001 BTC transaction to your new address.

Wait for the transaction to confirm.

In the Console, enter "listunspent"

Find the output associated with the address you just created.  You will be using this output to pay the transaction fee for the transaction you are creating.  The "txid" is the SHA256 hash of the transaction that you used to send the 0.0001 BTC to the address.  The "vout" is the index of the 0.0001 BTC output in that transaction.

In the Console, use createrawtransaction to create a template for your final transaction.  In the following example replace YOURINPUTTXID with the txid of the 0.0001 BTC output which you found with the listunspent command.  In the following example replace YOURVOUT with the vout value of the 0.0001 BTC output which you found with the listunspent command. In the following example replace ANYVALIDADDRESS with any valid bitcoin address, it doesn't matter which address since this portion of the transaction will be eventually replaced with the SHA512 hash instead.

Code:
createrawtransaction [{\"txid\":\"YOURINPUTTXID\",\"vout\":YOURVOUT}] {\"ANYVALIDADDRESS\":0.00010000}

You will receive a string of approximately 170 hexadecimal charcters (about 85 bytes).  This is an unsigned raw transaction. Do not sign and send this transaction yet. If you do, you'll simply be sending 0.0001 BTC to the address you used for ANYVALIDADDRESS without a transaction fee.

We will not be changing the first 47 bytes (94 characters) at all.

The first 46 bytes (92 characters) define the input that is being used to fund the transaction.  You should find the following:
The first 4 bytes (8 characters) of the raw transaction are the transaction version number.  The value of these 4 bytes should be 01000000. If it isn't then you've done something wrong.
The next 1 byte (2 characters) is the number of inputs in the transaction.  Since we created the transaction with only one 0.00001 BTC input, the value of this byte should be 01.  If it isn't then you've done something wrong.
The next 32 bytes (64 characters) will be YOURINPUTTXID with the bytes in reversed order.
The next 4 bytes (8 characters) are the YOURVOUT value with the bytes in reversed order.
The next byte (2 characters) will be the length of the signature. Since this transaction is not yet signed, the current signature length is 00
The next 4 bytes (8 characters) are the sequence number.  The value of these 4 bytes should be ffffffff. If it isn't then you've done something wrong.

The next byte (2 characters) immediately following the ffffffff is the number of outputs.  Since we created the template transaction with only one output, the value of this byte should be 01.  If it isn't then you've done something wrong.

The next 8 bytes (16 characters) is the value in satoshis being sent to ANYVALIDADDRESS with the bytes in reverse order.  Since we created the template sending 0.0001 BTC to the address, the value of these 8 bytes (16 characters) should be 1027000000000000.  If it isn't then you've done something wrong.  Change the value of these 8 bytes to 0000000000000000.  If you don't do this step you'll still have a transaction that you can broadcast, but it own't be paying any transaction fee (so it may take a VERY long time to confirm, and it will permanently lock away 0.0001 BTC in an output that will never be spendable.

Skipping ahead for a moment, the last 4 bytes (8 characters) are the locktime on the transaction.  This should be all zeros.  If it isn't then you've done something wrong. We won't be changing these 4 bytes (8 characters) either.  We'll just leave them as zeros.

Everything between the value being sent and the locktime  is the list of outputs of the transaction.  In this case we created only one output.

You will be replacing this output with a script that stores your SHA512 hash.

Remove the output list from this template raw transaction (including the 7689 that it will start with and the 88ac that it will end with).  Note that if the output list that you are removing does not start with 7689 and end with 88ac, then you've done something wrong.

In place of the bytes that you've just removed, you'll first place 3 bytes (6 characters) with the value of 426a40
That first byte (42) is the hexadecimal representation of the length of the script that you are adding.
That next byte (6a) is the OP_RETURN byte code. It indicates to the bitcoin network that this output is not data and that it is not spendable.
That third byte (40)  is the hexadecimal representation of the length of the data that you are storing in the transaction (40 is the hexadecimal representation of the decimal number 64 and there are 64 bytes in a SHA512 value).

Following that you'll put the 64 bytes (128 characters) of your SHA512 hash.

The locktime (00000000) should be following your SHA512 hash

Once you've built this transaction, you can post it here (or send it to me in a PM) and others (or myself if you send it via PM) can verify for you that you haven't made any mistakes.

If everything is correct, then you'll be able to use signrawtransaction to sign the transaction and sendrawtransaction to broadcast it to the network.

I'll be damned. You see, this is the kind of knowledge I want in my brain and I was just wondering if Antonopoulos's book will provide it. Of course, feel free to recommend other material too! Thanks.
legendary
Activity: 3472
Merit: 4801
In case you want to try creating the transaction without reading the book, follow these steps.

Create a new address in your Bitcoin Core wallet

Send a 0.0001 BTC transaction to your new address.

Wait for the transaction to confirm.

In the Console, enter "listunspent"

Find the output associated with the address you just created.  You will be using this output to pay the transaction fee for the transaction you are creating.  The "txid" is the SHA256 hash of the transaction that you used to send the 0.0001 BTC to the address.  The "vout" is the index of the 0.0001 BTC output in that transaction.

In the Console, use createrawtransaction to create a template for your final transaction.  In the following example replace YOURINPUTTXID with the txid of the 0.0001 BTC output which you found with the listunspent command.  In the following example replace YOURVOUT with the vout value of the 0.0001 BTC output which you found with the listunspent command. In the following example replace ANYVALIDADDRESS with any valid bitcoin address, it doesn't matter which address since this portion of the transaction will be eventually replaced with the SHA512 hash instead.

Code:
createrawtransaction [{\"txid\":\"YOURINPUTTXID\",\"vout\":YOURVOUT}] {\"ANYVALIDADDRESS\":0.00010000}

You will receive a string of approximately 170 hexadecimal charcters (about 85 bytes).  This is an unsigned raw transaction. Do not sign and send this transaction yet. If you do, you'll simply be sending 0.0001 BTC to the address you used for ANYVALIDADDRESS without a transaction fee.

We will not be changing the first 47 bytes (94 characters) at all.

The first 46 bytes (92 characters) define the input that is being used to fund the transaction.  You should find the following:
The first 4 bytes (8 characters) of the raw transaction are the transaction version number.  The value of these 4 bytes should be 01000000. If it isn't then you've done something wrong.
The next 1 byte (2 characters) is the number of inputs in the transaction.  Since we created the transaction with only one 0.00001 BTC input, the value of this byte should be 01.  If it isn't then you've done something wrong.
The next 32 bytes (64 characters) will be YOURINPUTTXID with the bytes in reversed order.
The next 4 bytes (8 characters) are the YOURVOUT value with the bytes in reversed order.
The next byte (2 characters) will be the length of the signature. Since this transaction is not yet signed, the current signature length is 00
The next 4 bytes (8 characters) are the sequence number.  The value of these 4 bytes should be ffffffff. If it isn't then you've done something wrong.

The next byte (2 characters) immediately following the ffffffff is the number of outputs.  Since we created the template transaction with only one output, the value of this byte should be 01.  If it isn't then you've done something wrong.

The next 8 bytes (16 characters) is the value in satoshis being sent to ANYVALIDADDRESS with the bytes in reverse order.  Since we created the template sending 0.0001 BTC to the address, the value of these 8 bytes (16 characters) should be 1027000000000000.  If it isn't then you've done something wrong.  Change the value of these 8 bytes to 0000000000000000.  If you don't do this step you'll still have a transaction that you can broadcast, but it won't be paying any transaction fee (so it may take a VERY long time to confirm, and it will permanently lock away 0.0001 BTC in an output that will never be spendable.

Skipping ahead for a moment, the last 4 bytes (8 characters) are the locktime on the transaction.  This should be all zeros.  If it isn't then you've done something wrong. We won't be changing these 4 bytes (8 characters) either.  We'll just leave them as zeros.

Everything between the value being sent and the locktime  is the list of outputs of the transaction.  In this case we created only one output.

You will be replacing this output with a script that stores your SHA512 hash.

Remove the output list from this template raw transaction (including the 7689 that it will start with and the 88ac that it will end with).  Note that if the output list that you are removing does not start with 7689 and end with 88ac, then you've done something wrong.

In place of the bytes that you've just removed, you'll first place 3 bytes (6 characters) with the value of 426a40
That first byte (42) is the hexadecimal representation of the length of the script that you are adding.
That next byte (6a) is the OP_RETURN byte code. It indicates to the bitcoin network that this output is data and that it is not spendable.
That third byte (40)  is the hexadecimal representation of the length of the data that you are storing in the transaction (40 is the hexadecimal representation of the decimal number 64 and there are 64 bytes in a SHA512 value).

Following that you'll put the 64 bytes (128 characters) of your SHA512 hash.

The locktime (00000000) should be following your SHA512 hash

Once you've built this transaction, you can post it here (or send it to me in a PM) and others (or myself if you send it via PM) can verify for you that you haven't made any mistakes.

If everything is correct, then you'll be able to use signrawtransaction to sign the transaction and sendrawtransaction to broadcast it to the network.
legendary
Activity: 3472
Merit: 4801
- snip -
with only Bitcoin Core and nothing else, create a bitcoin transaction that puts my own SHA-512 hash of a text onto the blockchain?
- snip -

I may be mistaken, but I thought I read somewhere that the developers of Bitcoin Core want to discourage people from storing non-currency data in the blockchain, and have therefore not implemented tools in Bitcoin Core for creating OP_RETURN transactions.  If that's true, then you will need to use some other tool to build the transaction.  Once the transaction is built, I think you'll be able to use Bitcoin Core to sign and broadcast it.

I haven't read the book, so I don't know if it explains how to create a bitcoin transaction with byte codes (essentially building the transaction with pen and paper unless you're really good at keeping all the information straight in your head) .  If it does, then you could just type the necessary bytes as input into the signrawtransaction API call.

Also, I don't know of any way to get Bitcoin Core to calculate a SHA-512 hash for you.  Are you planning on doing that with pen and paper (or in your head)?  Or are you willing to use some other (non Bitcoin  Core) tool for calculating that hash?
legendary
Activity: 1135
Merit: 1166
If you do not insist on Bitcoin, you can use Namecoin - it is trivial there.  Just register any name, and set the value of that name to your desired hex string.  Due to merge-mining of Namecoin with Bitcoin, this will actually even produce a link of your hash to the Bitcoin blockchain.  See http://www.domob.eu/blog/2015/0225-NameStamp.php.
legendary
Activity: 1946
Merit: 1012
vertex output parameter not completely initialized
pf
full member
Activity: 176
Merit: 105
Will this book provide me with enough knowledge so that I can, with only Bitcoin Core and nothing else, create a bitcoin transaction that puts my own SHA-512 hash of a text onto the blockchain? (I want to prove 10 years from now that I wrote this text 10 years ago and I want to do this myself with only Bitcoin Core.)

I skimmed through the book and it seems very focused on the Blockchain.info API. Am I right about this? I'm not really interested in the Blockchain.info API. I wanna do things myself using the core software.
Jump to: