Skip to content

turbopape/turbo-ledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

turbo-ledger - A Scalable Ledger

This is an accompanying repo for the Building turbo-ledger: A Scalable Ledger with Go and Redis post.

Building and Running API

go get .
go run .

Create a wallet

curl http://localhost:12000/wallets \
    --include \
    --header "Content-Type: application/json" \
    --request "POST" \
    --data '{"wallet_id": "new_wallet", "tags": ["vip","rich"],"owner":"rafik}'

Create a transaction

curl http://localhost:12000/transactions \
    --include \
    --header "Content-Type: application/json" \
    --request "POST" \
    --data '{"source_wallet": "src_wallet",
             "destination_wallet": "dst_wallet",
             "amount": 5,
             "transaction_description":"my cool transaction",
             "date":"2022-06-07T19:02:01.0Z"}'

Search wallets by owners

curl http://localhost:12000/wallets/owner?query\=bob\
    --include \
    --header "Content-Type: application/json" \
    --request "GET" 

Search wallets by tags

curl http://localhost:12000/wallets/tags\?query\=rich\
    --include \
    --header "Content-Type: application/json" \
    --request "GET"