Skip to content

danielortiz/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple JS blockchain implementation based on this tutorial

  1. Clone and run yarn install to install the dependencies
  2. if you want to run yarn start, make sure you have nodemon installed globally, otherwise you can just run yarn serve
  3. Run yarn serve to start a blockchain node instance
  4. To have more than one instance, run it on different ports with a PORT env variable (ex. PORT=3001 yarn serve)
  5. Interact with your nodes using the following routes

Routes

  • POST /transactions/new - creates a new transaction expected format:
      {
        "sender": "my address",
        "recipient": "someone else's address",
        "amount": 5
      }
    
  • GET /mine - tell the server to mine a new block.
  • GET /chain - returns the full blockchain.
  • POST /nodes/register - accept a list of new nodes in the form of URLs.
      {
        "node": ["http://localhost:3001"],
      }
    
  • GET /nodes/resolve - run the Consensus Algorithm, which resolves any conflicts to ensure a node has the correct chain.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published