Live data from Hacker News

A peek under Bitcoin’s hood: Writing a client that can create a transaction

samlewis.me

41–50 of 67 posts

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#41
post #40

Wrt transactions, I don't understand why you need to send yourself the unspent BTCs. Why does it make things significantly easier?

Because the miner almost always expects a fee, so why not just infer how high it is and you don't need to spend block bytes on it?

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#42
post #8

>> 0xFACEBEEF and sent it 0.0005 BTC.. 1 month later and someone had stolen my 0.0005 BTC! I guess people must occasionally trawl through addresses with simple/common private keys. This made it worth reading the article. Such cyberpunk!

For fun[1], you can occasionally trawl through addresses with any private key ! http://directory.io/ [1] For various definitions of "fun."

Their FAQ (unlisted on the main page) is interesting as well..

https://directory.io/faq

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#43
post #33

Earlier quoted context omitted.

With the comfort of a public blockchain at hand why not eliminate this case at address-creation time?

Let's do some back-of-the-envelope calculations. Let's say the probability of someone cloning a Velociraptor within the next 20 years is 1 in 1 trillion. Let's say that given a Velociraptor has been cloned, it has a probability of 1 in 1 million of escaping. Let's say that given a Velociraptor is on the lam, it has a 1 in 100 billion chance of breaking into your house. Let's say that if there's a Velociraptor in your…

From now on, I'm going to start my explanations about how Bitcoin addresses work with opening a closet to look for velociraptors.

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#44

Hi Sam, If you're reading the comments, can you do this treatment but for Ethereum and the smart contracts built on top of it? I find that your article gives a good explanation especially for beginner to understand from the code perspective.

No promises but I was actually considering having a crack at this as my next project. stay tuned!

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#45
post #40

Wrt transactions, I don't understand why you need to send yourself the unspent BTCs. Why does it make things significantly easier?

Because the miner almost always expects a fee, so why not just infer how high it is and you don't need to spend block bytes on it?

Ok, but the unspent output takes space as well. I think you could just replace it with the fee. Not sure if I'm missing something or if it was just an arbitrary design decision.

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#46
post #30
post #24

Earlier quoted context omitted.

Keccak256? Isn't that just SHA3 with a digest of 256 bits?

I'm unsure. I think this came before sha3 was defined so some parameters may have changed. But the core is essentially that.

There are minor padding differences but that's it.

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#47
post #45

Earlier quoted context omitted.

Because the miner almost always expects a fee, so why not just infer how high it is and you don't need to spend block bytes on it?

Ok, but the unspent output takes space as well. I think you could just replace it with the fee. Not sure if I'm missing something or if it was just an arbitrary design decision.

It has to do with the way transactions and the blockchain ledger works, reread the transaction part of the article and it might make more sense. Basically, transaction outputs can either be spent or unspent, you can't half spend an output (or perhaps more accurately, you can't spend a previous output twice).

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#48
post #3

Article says > This is also why address reuse in Bitcoin is encouraged as to sign a transaction you need to reveal your public key. If you don't reuse an address after sending a transaction from the address, you don't need worry about the private key of that address being exposed. Shouldn't that say "address reuse in Bitcoin is discouraged "? Otherwise I don't think I understand what he's trying to say.

Address reuse only becomes a problem in the theoretical case that someone can determine the private key from a signature. This would only happen if there was some sort of breakthrough in cryptoanalysis of elliptic curve cryptography, which while theoretically possible, is unlikely.

The idea is that you don't want to be secure now, but also in the future. The ECC Bitcoin uses is vulnerable to Shor's algorithm, and thus quantum computation. Quantum computing at that scale is a fair ways off, most likely, but on a timescale of a couple decades or more, a successful attack seems quite reasonable.

Bitcoin can soft-fork, allowing address generation with a different algorithm. It's not any sort of existential threat to Bitcoin. But it does require that you move your coins to a new address if you reuse an address, else you are vulnerable.

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#49
post #45

Earlier quoted context omitted.

Ok, but the unspent output takes space as well. I think you could just replace it with the fee. Not sure if I'm missing something or if it was just an arbitrary design decision.

It has to do with the way transactions and the blockchain ledger works, reread the transaction part of the article and it might make more sense. Basically, transaction outputs can either be spent or unspent, you can't half spend an output (or perhaps more accurately, you can't spend a previous output twice).

Yes I understand that's how it works, but I don't get why it's important. Surely you could double spend an output as long as you don't exceed its value; and that looks easily verifiable.

Re: A peek under Bitcoin’s hood: Writing a client that can create a transaction

#50
post #45

Earlier quoted context omitted.

Ok, but the unspent output takes space as well. I think you could just replace it with the fee. Not sure if I'm missing something or if it was just an arbitrary design decision.

It has to do with the way transactions and the blockchain ledger works, reread the transaction part of the article and it might make more sense. Basically, transaction outputs can either be spent or unspent, you can't half spend an output (or perhaps more accurately, you can't spend a previous output twice).

[deleted]
Post reply on HN