Naivechain : a blockchain implementation in 200 lines of code

“Because understanding blockchains should not be a difficult task!”

A very interesting Node.js project developed by Lauri Hartikka.

Blockchain is a distributed database that maintains a continuously-growing list of records called blocks secured from tampering and revision.

The blockchain format was first used for bitcoin, as a solution to the problem of making a database both secure and not requiring a trusted administrator: in this case the blockchain consists of blocks that hold batches of valid transactions.

Each block includes the hash of the prior block in the blockchain, linking the two. The linked blocks form a chain.

Why a new blockchain implementation?

From https://github.com/lhartikk/naivechain:

All the current implementations of blockchains are tightly coupled with the larger context and problems they (e.g. Bitcoin or Ethereum) are trying to solve.

This makes understanding blockchains a necessarily harder task, than it must be. Especially source-code-wisely. This project is an attempt to provide as concise and simple implementation of a blockchain as possible.


Key concepts of Naivechain

  • HTTP interface to control the node
  • Use Websockets to communicate with other nodes (P2P)
  • Super simple “protocols” in P2P communication
  • Data is not persisted in nodes
  • No proof-of-work or proof-of-stake: a block can be added to the blockchain without competition

More information and downloads

https://github.com/lhartikk/naivechain

Comments