Live data from Hacker News

Low-level Bitcoin

curiosity-driven.org

1–10 of 28 posts

Re: Low-level Bitcoin

#2
A little note about the "make a privkey" section of the signature example; it can sometimes* make invalid privkeys that are off the end of the EC curve. Only integers between 0x1 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 are valid in our particular case. Super unlikely to ever get a sha256 hash that matches the invalid portion, but it's worthwhile to point out.

* probably never, but worth mentioning

Re: Low-level Bitcoin

#3
Possible bug:

The instructions BOOLAND and BOOLOR don't interpret the stack values the same way IF, VERIFY etc do. They decode the top stack values as integers and compare against zero, thus they have to fail when the top stack item size is greater than 4 bytes.

Edit: littleEndian.decode also doesn't seem to respect the size limits

Edit2: .. or signed integers for that matter. So while this is a very cool basic concept, it's not a complete implementation.

The reference client provides test suites

https://github.com/bitcoin/bitcoin/blob/master/src/test/data...

https://github.com/bitcoin/bitcoin/blob/master/src/test/data...

Re: Low-level Bitcoin

#4
This article had me wondering what will happen when people start storing copyrighted data (or worse, pedopornographic images) inside the blockchain.

Re: Low-level Bitcoin

#5
post #4

This article had me wondering what will happen when people start storing copyrighted data (or worse, pedopornographic images) inside the blockchain.

They already do that: http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photo...

Also related: http://en.wikipedia.org/wiki/Illegal_number

Re: Low-level Bitcoin

#6
post #3

Possible bug: The instructions BOOLAND and BOOLOR don't interpret the stack values the same way IF, VERIFY etc do. They decode the top stack values as integers and compare against zero, thus they have to fail when the top stack item size is greater than 4 bytes. Edit: littleEndian.decode also doesn't seem to respect the size limits Edit2: .. or signed integers for that matter. So while this is a very cool basic conce…

Yes, you're right, numbers treatment is not exactly the same as in Bitcoin Core. The script interpreter supports only basics and it was implemented to show how Bitcoin Script works in general for another article [0].

But it was not clear from this text whether it's a complete implementation or not so it looks like a bug. I've added the annotation [1] and will update the interpreter in the future.

Of course if one wanted to use Bitcoin in real projects I'd rather recommend Bitcoin.js [2] but that's another topic.

Thanks for comment!

[0]: https://curiosity-driven.org/bitcoin-contracts

[1]: https://curiosity-driven.org/low-level-bitcoin#operators

[2]: http://bitcoinjs.org/

Re: Low-level Bitcoin

#8
post #2

A little note about the "make a privkey" section of the signature example; it can sometimes* make invalid privkeys that are off the end of the EC curve. Only integers between 0x1 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 are valid in our particular case. Super unlikely to ever get a sha256 hash that matches the invalid portion, but it's worthwhile to point out. * probably never, but worth…

Excellent point, added as annotation, thanks!

Re: Low-level Bitcoin

#9
post #5
post #4

This article had me wondering what will happen when people start storing copyrighted data (or worse, pedopornographic images) inside the blockchain.

They already do that: http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photo... Also related: http://en.wikipedia.org/wiki/Illegal_number

So what happens if someone puts CP into the block chain and publishes the instructions to retrieve after two months?

Re: Low-level Bitcoin

#10
post #5

Earlier quoted context omitted.

They already do that: http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photo... Also related: http://en.wikipedia.org/wiki/Illegal_number

So what happens if someone puts CP into the block chain and publishes the instructions to retrieve after two months?

The same thing that happens to every other data put in transactions - if they're included in blocks every node (full verifying node [0]) downloads it and stores it locally forever.

[0]: https://code.google.com/p/bitcoinj/wiki/FullVerification

Post reply on HN