This app is to emulate blockchain ecosystem in node.js
node.js로 구현한 블록체인 애플리케이션
Running 5 diffrenet local servers(ports) declared in package.json
Each server(port) handles the blockchain process as if being chained as series of the nodes in the real world blockchain application.
Each end point API can be tested by postman and browser (UI page added by Angular)
- /transaction-broadcast (postman) -- transaction of bitcoin on pending state
- /register-and-broadcast-node (postman) -- connection of servers(nodes)
- /mine (on browser) -- mining successfully carried
- /consensus (on browser) -- addition of new server to the current nodes ecosystem
- /block-explorer (on browser) -- UI page
Enjoy!
npm install
npm run node_1
npm run node_2
npm run node_3
npm run node_4
npm run node_5
Get /localhost:3001/blockchain
- Explore the current state of blockchain
Post /localhost:3001/register-and-broadcast-node
- Postman with JSON body {"newNodeUrl":"http://localhost:3002~5"}
- Connection of all servers(nodes) together
Post /transaction-broadcast
- Postman with JSON body {"amount":1000, sender:"id", recipient:"id"} -- send bitcoin
- This automatically adds the transaction(on pending) to all of the nodes
Browser
Get /mine
- Carrying a succesful mining process as committing all of the transactions
Browser
Get //localhost:{{new port}}/consensus
- Add the past record of all blockchains to the new node and share the current state of other nodes
- Make sure to register a new node to other nodes beforhand, executing "/localhost:3001/register-and-broadcast-node"
Browser
Get /block-explorer
- You can explore the blocks in search of the transaction record, hash, and user history