Skip to content

hagenderouen/mini-chain

Repository files navigation

Mini-chain

Run a simple blockchain on your local computer. Special thanks to Hadelin de Ponteves

Tools

Blockchain With Cryptocurrency Demo

Connect the blockchain nodes, exchange 'Hadcoins', and mine blocks. For any blocks added, get consensus by calling replace_chain. Get the blockchain and check if it is valid.

  1. Run hadcoin_node_[port].py in separate consoles.
  2. Using Postman, send requests to http://127.0.0.1:[port]/
  3. Send POST connect_node requests to all nodes. Paste nodes.json in request body. Remove receiving node from the post request body. For example, if sending POST connect_node to http://127.0.0.1:5001/ remove http://127.0.0.1:5001/ from the request body.
  4. Send GET mine-block to any node.
  5. Send POST replace_chain on other nodes.
  6. Send POST add_transaction to any node. Paste transaction.json in request body. Replace sender and receiver strings with any name, and amount with any integer.
  7. Send GET mine_block to mine the transaction to the blockchain.
  8. Send POST replace_chain on other nodes to update the blockchain.

GET methods

  • get_chain - gets the full blockchain.
  • mine_block - adds a block to the blockchain.
  • is_valid - checks if the blockchain is valid.

POST methods

  • connect_node - connects a node to the blockchain
  • add_transaction - adds a new transaction to the blockchain
  • replace_chain - replaces the chain with the longest chain if needed

Ethereum Smart Contract

A smart contract written in Solidity for the Ethereum blockchain. Compile, deploy, and run transactions using Remix Ethereum. Paste hadcoins_ico.sol into main panel.

About

A simple blockchain demonstration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages