Skip to content

Personalized p2p Blockchain network written in Nodejs

Notifications You must be signed in to change notification settings

bushra2001/Hydra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HYDRA:

Hydra is a very basic personalized P2P (Peer to Peer) blockchain network.

How to Use:

git clone https://github.com/bushra2001/Hydra.git
npm install crypto discovery-swarm dat-swarm-defaults get-port cron moment crypto-js
--save

To run the code from the clone library on GitHub, navigate to the code, follow these Terminal commands to install the libraries, and run a node.js instance attaching our p2p.js code:

cd [location]/Hydra
npm install 
node p2p.js // two instances in terminal

Tools:

It is implemented using;

  • Nodejs
  • Visual Studio Code

Functionalities:

This network is capable of doing following:

  • Send and receive messages and include blocks in these messages.

peer2

  • Register and unregister miners using PoS consensus mechanism.
  • Create new blocks and sent them between the peers.

Register_Miner

  • Store blocks using name-value LevelDB database.
npm install level fs -save
node p2p.js // create two instances
cd [location]/db/[peer Id] //in another terminal
tail –f 000003.log

tail command

  • Store public private key in Blockchain Wallet using using the elliptic-curve cryptography library.
npm install elliptic --save
node wallet.js
cat wallet/private_key

Generating a wallet’s private-public key

Communication:

Hydra communicate via API services.

For implementing API_Service :

npm install express body-parser --save
node p2p.js
http://localhost:80[port]/getWallet
http://localhost:80[port]/blocks
http://localhost:80[port]/getBlock?index=0
http://localhost:80[port]/ getDBBlock?index=0

Retrieving all the blocks in blockchain

About

Personalized p2p Blockchain network written in Nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages