4 ms·
Blockchain reminds me of monads... In a way that everyone is writing tutorials about it but the underlying concepts are quite simple. Do we have Blockchain tut
by hdhzy 9y ago
Blockchain reminds me of monads... In a way that everyone is writing tutorials about it but the underlying concepts are quite simple.
Do we have Blockchain tutorials timeline akin to https://wiki.haskell.org/Monad_tutorials_timeline https://wiki.haskell.org/Monad_tutorials_timeline ?
- atonse 9y agoI understand the cryptographic concept of a blockchain but have a bunch of "real-world scenarios" type questions on how it actually works. Like for example, it's a chain. I get that. But if there are thousands of people adding to the chain all the time, how do they coordinate to make sure they're always adding to the last block? Because this might happen: - I sync and have the latest block - I build another block off the latest block (takes 1 second) - In that time, I no longer have the latest block. Do I have to get the newest block again from the "world" and then recompute? Wouldn't this just be never-ending? And how would this work as more people add to the chain? Would I constantly be out of sync? That's the kind of stuff where I'm completely lost and haven't found a good explanation for it.
- hanbura 9y agoThis happens fairly frequently. Whenever you see a new block that forms a longer chain than the chain you currently know, you throw your work away and use that block as your new starting point. But you only do that if the new block has a longer chain, not for a chain of equal length. So if two miners both mine a new block that follows the same block, one will be seen first by some miners, the other will be seen first by others. That gives them different mining power, meaning the chains grow with different speed. After 1-3 blocks this mining power difference will lead to one of both chains being longer from everyone's point of view. At that point the longer chain won, the shorter is forgotten and all work put into it becomes worthless. That encourages miners to make sure they use new blocks as fast as possible. Unless of course you have more mining power than everyone else combined.
- annabellish 9y agoWhat happens to the transactions in the chain that were thrown away? Are they just lost now? Do they need to be added again?
- hdhzy 9y agoUsually the second miner also saw and included the same transactions so they are not lost. If they didn't the transaction is undone in a sense that it just didn't happen. Of course it can still be picked by the next miner. The chain that is longest (by difficulty) is by definition a log of everything that happened. Transactions that are not part of that chain are just candidates, nothing less nothing more.
- jackhack 9y ago>the shorter is forgotten and all work put into it becomes worthless Then one can commit work to (what is believed to be) the current, longest chain, only to find later that a branch occurred and the work was lost? As such it is then incumbent upon the contributor to follow the chain for some period of time until other work has contriubted to the chain? So how long is long enough? one contribution? ten? Serious question. How does one know with certainty that work was accepted by group consensus? This uncertainty seems to undermine the idea that blockchain is a trustworthy, predictable, verifiable ledger of activity if the work contributed cannot be known as reliably preserved at the time it is submitted, only later in review. I admit I'm fairly ignorant of the details of this, just attempting to understand. I hope I am misunderstanding something; somebody please steer me back onto the path.
- SomeStupidPoint 9y agoIf you had more computing power than the network, you could (theoretically) undo all of BTC by completely replacing the chain. I think in practice, they would ignore such a rewrite of history.
- hdhzy 9y agoIf you find a valid block then it's more profitable to switch to this block as a base. Chain splits happen when someone finds a block but is not aware of other valid block.
- rtkwe 9y agoCurrently that's solved because transactions aren't added live by every user but instead get batched together and added as a group so individually you just have to wait for some block to pickup your transaction from the pool of available transactions. What you're suggesting could potentially become a problem for a technology if new block propagation takes longer than new block discovery. Today orphan blocks aren't exactly rare there're several a month where two different pools will announce new blocks within a couple seconds of each other and one gets abandoned because it was the later one or because the other block had a new block mined from it faster.
- atonse 9y ago"What you're suggesting could potentially become a problem for a technology if new block propagation takes longer than new block discovery." But that's an inevitability. New block discovery only takes longer over time, and block propagation will only get more complicated as you add more users to chain.
- rtkwe 9y agoLuckily every user doesn't require a full copy to submit transactions and use the chain just miners.
- hdhzy 9y agoWell in a distributed system you are in a way always out of sync. The primary achievement of Bitcoin was taking already exiting pieces (hash cash, Merkle trees, signatures etc.) and assembling them in a way that solves consensus in such a system (see [0]). What's interesting is the combination of these pieces. They were known a long time before. Actually I had CS lessons where we were creating virtual currencies with these exact elements long before Bitcoin happened (of course no one got Bitcoin in the process :(... or maybe they did but never told me :) ). How to know Bitcoin better? The best approach is the same as with everything else: reverse engineer and recreate a small coin in your language of choice (chain using hashes plus a simple proof of work using N leading 0s). Remember Satoshi's genius was in assembling pieces in a way nobody thought of, you just need to copy a small version of that. It's not that difficult. For me the most interesting aspect is smart contracts [1]. That's the one underutilized element of the system that is quite versatile. [0]: https://en.m.wikipedia.org/wiki/Byzantine_fault_tolerance#Byzantine_Generals.27_Problem https://en.m.wikipedia.org/wiki/Byzantine_fault_tolerance#By... [1]: https://en.bitcoin.it/wiki/Contract https://en.bitcoin.it/wiki/Contract
- debacle 9y agoThat wiki article is great.