187 points · by nitramm · 9y ago · 57 comments
If you remove the LCR and PoW, all you are left with is a toy example which cannot work in practice.
What is needed is education about censensus design and bitcoin's implementation of the solution, rather than a 'how to guide' for building a basic linked list under the guise of 'blockchain'.
Cheers, Paul.
Add a field to store a random number. Keep generating values for this field until the hash of the structure has 'n' leading zeros.
Is that more or less correct?
It's worth adding to that description that the hash must be secure in that it does not allow determining what random number to use to get a particular output (I'm sure you already recognized this detail - it just guarantees you have to keep trying actually random numbers to find a result).
Also worth adding is that the 'n' (Basically the difficulty) is generally going to need some way of scaling based on how quickly correct hashes were found in the past. This is important to prevent problems that would happen with people being able to generate correct results too quickly (Or even just significantly faster then previously).
In particular, Bitcoin's difficulty factor scales such that a new block is found aprox. every 10 minutes, so 'n' is adjusted every so many blocks depending on how fast the hashes were found. Because in the case of Bitcoin, a found block means more coins in the market, it is important that when more hashing power is added, it doesn't result in blocks now being found 1 minute apart. If that were to happen, then you'd have 10 times the number of coins entering the market.
[ed: from other comments, I gather that "passage of time" means "added blocks (hashes)" - but I'm still not clear on where the agreement on what constitutes "in 10 minutes on average" comes from - if A sees an addition to the blockchain of N blocks with X proof-of-work, lets call it N * X from B, and sees M blocks with Y proof-of-work from C -- it should be easy to figure out which is bigger of N * X and M * Y (here we don't really assume multiplication, but some way to figure out maximum proof-of-work).
But how does A know how long either took? Is the time local, so that A looks at the head of the B and C chains, and considers when A saw this head, and figure the elapsed time based on that?]
This sounds pretty interesting, can you elaborate on how exactly its proxy model for the passage of time?
I don't see this any differently than a tutorial that makes a static image move around the screen with key presses. Is it a full game? Not at all. But can it teach you how to build a tiny piece of it, and you can look at other tutorials to figure out how to build other tiny pieces of it, and eventually synthesize that knowledge and make a full game? Yes.
It uses:
- Hashcash-style proof of work: http://www.hashcash.org/ (originally designed to make spamming harder, although I don't think it ever really became widely adopted).
- Merkle trees to reference transactions in the blocks (same technology used for bittorent chunks): https://en.wikipedia.org/wiki/Merkle_tree
- Elliptic curve cryptography for signing transactions: https://en.wikipedia.org/wiki/Elliptic_curve_cryptography (asymmetric cryptography, used in TLS, SSH etc...)
- When a new "node" connects to the network it uses hardcoded addresses and DNS seeds to find other nodes to connect to: https://bitcoin.org/en/glossary/dns-seed (before that it used IRC)
And there are probably a few other things but basically if you know how to work with those technologies then you have all the tools you need to implement a bitcoin clone. It's nothing groundbreaking, it's "just" a clever novel use of existing technology.
All the actual "rules" of the network (the block reward etc...) are simply validated in the nodes, they'll reject any block that's not properly crafted (i.e. bad reward, invalid proof of work etc...). Therefore the node consensus dictates what bitcoin is. If you implement a non-compatible change in the client and you don't convince all the other users to switch you create a fork since you won't have the same definition of what constitutes a valid block.
Instead this is just a list of hashed-linked documents... Not that much different from a Git repo or a basic file system with integrity checks. Hashing != blockchains.
You are interpreting "blockchain" to be constrained to a "chain of hashes". That is a valid interpretation.
The parent (Uptrenda) is interpreting "blockchain" as a umbrella label for "distributed ledger". This wider definition is also a valid interpretation and this language phenomenon is called "synecdoche"[1].
To point back to the actual article, the author (Gerald Nash) is using "blockchain" in both meanings. On the one hand, he talks about the wider scope of distributed currency... but on the other hand, his Python example is constrained to a "chain of hashes". Since Mr Nash is mentioning the Satoshi bitcoin whitepaper when talking about "blockchain" (the wider meaning), Uptrenda's criticism is reasonable because the most interesting part of distributed-blockchain is the invention of incentives (mining rewards) and social agreement on acceptable hashes (e.g. how many 0000s are counted, which chain is chosen, etc).
As other distributed projects such as IPFS/Diaspora/Sandstorm/etc show, finding the right combination of incentives to create social buy-in and sustainability is the hard part. The hashes is the easy part.
"Block chains" in modern times are very helpful in handling transactions in databases by replacing things like CAS-Numbers [2] with hashes. The hash of the previous block effectively becomes the CAS-Number, with the feature of staying persistent and verifiable.
CAS example: IF X_version IS 200 SET X=2
BC example: IF hash(X) IS 200 ADD document Y WITH Y_parent = hash(X)
That is, while the article does in fact also mentions Bitcoin, I don't see a point in discrediting the article, the code or the author in any way. Personally, I find it far more valuable for engineers to understand the underlying, fundamental concepts of things before going all-in. Sure, he could have discussed all these things, but for people who are new to the topic, that would not have been very helpful in understanding the concept of a block chain.
It's kind of like how in modern cryptography most of our algorithms aren't bullet proof. Cryptographers aren't saying that an algorithm can't be broken, but that it requires so much computational resources to do so that its simply improbable. We can say that blockchains also include this idea but they add the economic aspect; Now it isn't just improbable to break an algorithm (with universe sized computers) -- its also improbably (and irrationally) expensive.
Your other point is that a blockchain is simply a linked chain of documents. This is incorrect. The whole point behind a blockchain is that it serves as a way to get people to agree on an ordered list of events. The problem was never being able to form that list (anyone can hash a list of documents, its basic applied crypto.) It was getting a group of strangers to agree on a single result under highly adversarial conditions.
See also: http://unenumerated.blogspot.com.au/2017/02/money-blockchain...
This has nothing to do with blockchains. What you're describing is proof of work with a payout system, and you could implement that without a blockchain at all.
>So while it is true that a blockchain can exist without any kind of currency
It has always been true. This was, in fact, exclusively the case before the first cryptocurrencies - blockchains are data structures, not a concept exclusive to currency.
>Your other point is that a blockchain is simply a linked chain of documents. This is incorrect.
It is exactly correct. The use of blockchains in cryptocurrencies is irrelevant to what they are. If I build the next great money machine tomorrow using a doubly-linked list, it doesn't change what a doubly-linked list fundamentally is. The fact that many people have been introduced to the idea of a blockchain through cryptocurrencies doesn't alter the basic facts.
>The whole point behind a blockchain is that it serves as a way to get people to agree on an ordered list of events.
This is not what the blockchain does. The blockchain helps to ensure that Proof of Work is effective for maintaining consensus after blocks are made - it's the role of PoW to produce the agreement. A blockchain without PoW would allow members to produce new combinations of blocks at will to edit the history.
What you're describing is a cryptocurrency, or some other form of cryptographically assured distributed ledger with a proof of work.
If you think I'm wrong, look in the original Bitcoin paper and search for "blockchain".
It's justified since blockchain on its own is a relatively simple data structure which on itself is not that significant. It's the composition of all the elements that have given the value and recognition to this technology.
You might want to keep track of the blocks as you create them, or you will find it hard to verify the integrity of a block.
(Do I know the hash of the previous block? Do I know about the next block, if it is not the last block?)
the thing i really want to try making is take a sinatra/redis/crud app and rebuild the database as a distributed database on a blockchain. or at least i think thats what i want to do.
But me, I'm not planning on starting a coin, although I'm pretty interested in the tech behind it, albeit not enough to deep dive into the white papers and code, at least not yet. So I thought this was a nice byte-size chunk and was informative.