Skip to content

maribies/wombat-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting to know blockchain w/ @JoshCheek

Inspo:

To run server:

rackup -I lib -p 5000

To run tests:

rspec

To interact with server:

# NOTE: for pretty printing the JSON, we are using `jq`,
# which can be installed via package manager. Eg `brew install jq`

# Post a transaction
curl -s localhost:5000/transactions/new -H 'Content-Type: application/json' --data-raw $'{
 "sender": "my address",
 "recipient": "someone else\'s address",
 "amount": 5
}' | jq

# Mine the next block
curl -s 'localhost:5000/mine' | jq

# View the blockchain
curl -s 'localhost:5000/chain' | jq

Exploring the differences between posting via API and HTML

curl localhost:5000/transactions/new \
  -i -H 'Content-Type: application/json' -H 'accept: application/json' --data-raw $'{
 "sender": "my address",
 "recipient": "someone else\'s address",
 "amount": 5
}'

# It's not about the method, but the structure and data sent. :)
curl localhost:5000/transactions/new \
  -i \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'accept: text/html' \
  --data-raw $'transaction%5Bsender%5D=my+address&transaction%5Brecipient%5D=your+address&transaction%5Bamount%5D=8'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published