/chain_forge

Simple Sinatra API for Blockchain Management

Primary LanguageRuby

ChainForge

Setup

Install ruby 3.2.2

rbenv install 3.2.2
rbenv local 3.2.2

Install dependencies

bundle install

Test

bundle exec rspec

Usage

ruby main.rb -p 1910

API

POST /chain

curl -X POST http://localhost:1910/chain

POST /chain/:chain_id/block

curl -X POST -H 'Content-Type: application/json' -d '{"data": "your_data"}' http://localhost:1910/chain/:chain_id/block

POST /chain/:chain_id/block/:block_id/valid

curl -X POST -H 'Content-Type: application/json' -d '{"data": "your_data"}' http://localhost:1910/chain/:chain_id/block/:block_id/valid