This repository contains a Sawtooth Transaction Processor reference implementation for the Bandcoin smart contract.
Start up a sawtooth network. The easiest way to do this is to run a devmode single node network using the provided docker-compose file. Then expose the rest-api as well as the validator to the local host.
...
validator:
image: hyperledger/sawtooth-validator:chime
container_name: sawtooth-validator-default
expose:
- 4004
ports:
- "4004:4004"
...
rest-api:
image: hyperledger/sawtooth-rest-api:chime
container_name: sawtooth-rest-api
ports:
- "8008:8008"
...
Now install the python dependencies with:
pip3 install -r requirements.txt
Generate a key to issue transactions:
python3 aima_client.py genkey && mv aima.key provider.key
python3 aima_client.py genkey
Start transaction processor with provider as exchange with ability to fund accounts.
BANDCOIN_KEY=provider.key python3 aima_client.py getkey > provider.pub
AIMA_EXCHANGE=$(cat provider.pub) DEBUG=yes python3 aima_transaction_processor.py
python3 aima_client.py create
BANDCOIN_KEY=provider.key python3 aima_client.py create
# Fund client account
BANDCOIN_KEY=provider.key python3 aima_client.py deposit $(cat aima.key) 1000
# Check client balance
python3 aima_client.py balance
# offer from_frequency to_frequency band_width price max_allocations volume_discount
BANDCOIN_KEY=provider.key python3 aima_client.py offer 1000 1200 100 1 100 10
# list blockchain states
python3 aima_client.py list
# show offers
python3 aima_client.py offers
# allocate provider epoch price from_frequency to_frequency band_width
python3 aima_client.py allocate $(cat provider.pub) 1 1 1000 1200 100
python3 aima_client.py show $(cat provider.pub)
python3 aima_client.py transactions