Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naknode/blockchain.js
Native blockchain implementation in JavaScript.
https://github.com/naknode/blockchain.js
blockchain blockchain-demos blockchain-technology cryptocurrency cryptography
Last synced: about 1 month ago
JSON representation
Native blockchain implementation in JavaScript.
- Host: GitHub
- URL: https://github.com/naknode/blockchain.js
- Owner: naknode
- Created: 2018-11-04T19:13:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-04T20:04:20.000Z (about 6 years ago)
- Last Synced: 2024-03-11T20:59:24.903Z (8 months ago)
- Topics: blockchain, blockchain-demos, blockchain-technology, cryptocurrency, cryptography
- Language: JavaScript
- Size: 831 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# blockchain.js [![Build Status](https://travis-ci.org/naknode/blockchain.js.svg?branch=master)](https://travis-ci.org/naknode/blockchain.js)
![Demo](blockchain.gif)
> Native blockchain implementation in JavaScript.
## How to use
### Connecting peers
1. Connect two or more peers in seperate terminal sessions.
First, `peer 1` (`npm run peer1`):
```
./node_modules/.bin/cross-env PEER_PORT=6001 HTTP_PORT=3001 node index.js
```and `peer 2` or (`npm run peer2`):
```
./node_modules/.bin/cross-env PEER_PORT=6002 HTTP_PORT=3002 PEERS=6001 node index.js
```### Mine the Blockchain
Use curl below to simply execute or just run (`npm run mine`)
```bash
curl --data '{"content" : "Add some data here"}' -H "Content-Type: application/json" http://localhost:3001/mine
```or you can use [Postman](https://www.getpostman.com/) to execute `POST` requests and mine for blocks.
## Unit Tests
Run the unit tests by executing the following command:
```
npm run test
```Tests will run using [AVA](https://github.com/avajs) and validate the blockchain technology code to see if it's broken through Q&A scenarios.
Additionally, you can run `npm run lint` to check to see if the code is ESLint compliant.