This blockchain is based on the python/flask blockchain created by Daniel van Flymen for Hackernoon
This blockchain requires Sinatra, run a bundle install in the root directory of the project
bundle install
Begin your chain by running rubychain.rb
ruby rubychain.rb
The chain will run on port 4567 by default
To get your address perform a get request
http://#{your_ip}:4567/identifier
To view the current chain on your node perform a get request
http://#{your_ip}:4567/chain
To add transactions to the pending block perform a post to
http://#{your_ip}:4567/transactions/new
with a request body containing a JSON object
{
"sender": "#{your_address}",
"recipient": "#{someone_elses_address}",
"amount": #{Amount being transfered}
}
To mine new block containing all pending transactions perform a get request
http://#{your_ip}:4567/mine
To connect to a new node(s), register the node(s) by performing a post request
http://#{your_ip}:4567/nodes/register
with a request body containing a JSON object
{
"nodes": ["http://#{other_ip}:#{port}", "http://#{more_ips}:#{port}"]
}
To ensure you have the correct chain (In this case the longest chain) perform a get request
http://#{your_ip}:4567/nodes/resolve
This will update your chain to the largest chain available on the connected nodes