3 ms·
easychain – a python exploration of blockchain ledger concepts
https://github.com/davecan/easychain
I wrote this over the weekend after doing quite a bit of research into how blockchain ledgers work. I know there is some grumbling about what a blockchain is and is not, which is why the following statement is made in the project:
"This implementation focuses only on the hashed ledger concept. It specifically does not include any concept of mining or any other form of distributed consensus. It also abstracts the concept of a transaction to that of a message in general. The concept of a header and payload in messages and blocks is adapted from Bitcoin."
The focus here is on understanding how the ledger itself works. Distributed consensus is out of scope, though I would be interested in exploring a mechanism for distributed consensus of a shared blockchain. But for now it is out of scope.
Includes a few unit tests. Any feedback appreciated.
- dozzie 9y agoNote that blockchain in its technical essence is not a ledger, as ledger is not a cryptographic primitive. Blockchain is a document timestamping system, and as such allows one to order documents. It's just that ledger happens to require some means to order the transactions (and make them unmodifiable), each of which can be easily described by some sort of document (message). Meaning, you didn't "abstracts the concept of a transaction to that of a message". You just moved back to the underlying cryptographic primitive. More reading: https://en.wikipedia.org/wiki/Trusted_timestamping https://en.wikipedia.org/wiki/Trusted_timestamping
- memoized 9y agoGood point and thanks for the clarification. Glad to know I moved in the right direction. :) I used the term "ledger" simply because that is the common term used to describe blockchains. My reason for writing the code was to explore how a hashed transaction "ledger" fits together at a more technical level, instead of as a marketing buzzword. Plus it is there in case others want to understand just that piece of it. That link is very straightforward. I have a copy of Haber & Stornetta's 1991 paper on timestamping but haven't read it yet.