Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olistic/simplechain
⛓✨ Interactive blockchain built with Node.js
https://github.com/olistic/simplechain
blockchain cryptocurrency nodejs proof-of-work
Last synced: 3 months ago
JSON representation
⛓✨ Interactive blockchain built with Node.js
- Host: GitHub
- URL: https://github.com/olistic/simplechain
- Owner: olistic
- License: mit
- Created: 2017-11-04T22:12:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T23:06:46.000Z (almost 7 years ago)
- Last Synced: 2024-08-04T07:01:12.623Z (6 months ago)
- Topics: blockchain, cryptocurrency, nodejs, proof-of-work
- Language: JavaScript
- Homepage:
- Size: 213 KB
- Stars: 71
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
✨⛓ Simplechain ⛓✨
Interactive blockchain built with Node.js.
![]()
## Intro
The blockchain is a fascinating technology, but it can also be intimidating. At the time I wrote this code, I had consumed a lot of material regarding the blockchain and cryptocurrencies, but I hadn't satisfied my hunger for knowledge (and still haven't). I wanted to create my own blockchain for some of that knowledge to sink in, and I wanted it to be simple. Simplechain is the result of that, and I hope you find it as helpful as it was for me when I created it.
> Check out [Simplechain++](https://github.com/olistic/simplechainpp) for a C++ port.
## Usage
First, clone the repo:
```sh
$ git clone https://github.com/olistic/simplechain.git
$ cd simplechain
```Then, install the dependencies:
```sh
$ npm install
```And finally, launch the REPL:
```sh
$ npm start
```_Voilà!_ If you see the `SIMPLECHAIN>` prompt, it means you're inside the REPL.
Go ahead and try the following commands:
* `ADDBLOCK `: Mines a block with the provided data and adds it to the chain.
* `LISTBLOCKS`: Lists all the blocks in the chain.Well done! If you want to learn more, please don't forget to [look at the code](https://github.com/olistic/simplechain/tree/master/lib).
## Advanced Usage
### Adjust Difficulty
If you want to tweak the blockchain's difficulty, you can do so via the CLI:
```sh
$ npm start -- --difficulty
```This number represents the amount of zeros the hashes of the blocks in the blockchain need to begin with. A greater number makes it more difficult (more computationally expensive) to mine a block.
## Next Steps
* Implement P2P network of nodes where:
* Miner nodes broadcast mined blocks
* User nodes broadcast data to be included in blocks by miners
* Implement peer discovery protocol so nodes can find each other## Resources
* [_Ever wonder how Bitcoin (and other cryptocurrencies) actually work?_](https://youtu.be/bBC-nXj3Ng4)
## License
MIT