https://github.com/carbolymer/blockchain
Sample implementation of a blockchain in Haskell
https://github.com/carbolymer/blockchain
blockchain haskell
Last synced: 4 months ago
JSON representation
Sample implementation of a blockchain in Haskell
- Host: GitHub
- URL: https://github.com/carbolymer/blockchain
- Owner: carbolymer
- License: apache-2.0
- Created: 2017-10-02T22:15:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T05:39:38.000Z (about 3 years ago)
- Last Synced: 2023-03-11T01:04:59.508Z (almost 3 years ago)
- Topics: blockchain, haskell
- Language: Haskell
- Size: 1.81 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Blockchain [](https://travis-ci.org/carbolymer/blockchain)
[](https://imgur.com/a/S6SLB)
Just a simple implementation of the blockchain, inspired by the article: https://hackernoon.com/learn-blockchains-by-building-one-117428612f46
### Features
* multinode miners network
* ECDSA transaction signing
* simple web UI with basic account panel
## How to run
1. You have to have Docker and Docker Compose installed.
2. Execute following command in the project root directory to download the node docker image
```
docker-compose pull ui
```
3. Start the blockchain node with UI
```
docker-compose up -d ui
```
4. To start next 10 blockchain nodes:
```
docker-compose up -d --scale drone-node=10 drone-node
```
5. Open url `http://localhost:8000` in browser
## How to build
1. You have to have Docker and Docker Compose installed.
2. Execute following command in the project root directory to build the project
```
docker-compose run --rm build
```
3. Build and start the blockchain UI with the beacon node
```
docker-compose up --build -d ui
```
4. Open url `http://localhost:8000` in browser
## Local development
### Automatic Haskell builds
Run the following command to automatically build the project & haddock
documentation after file changes:
```
stack test -j 8 --fast --haddock-deps --file-watch
```
### NPM live reload
Run the following command in the `blockchain-ui-fe` directory:
```
ng serve --open
```
## Node HTTP Endpoints
The node is listening on `8000` port and the following endpoints are available:
| Path | Description
|--|--
| `GET /healthckeck` | returns health status of the node
| `GET /chain` | returns whole blockchain
| `POST /transactions/new` | registers a new transaction
| `GET /transactions/confirmed` | lists confirmed transactions
| `GET /transactions/unconfirmed` | lists unconfirmed transactions
| `POST /mine` | mines a new block
| `POST /nodes/all` | lists all nodes known to this one
| `POST /nodes/register` | accepts a list of new nodes and add them to this one
| `POST /nodes/resolve` | queries all nodes, and checks if this one has the longest correct chain