-
Notifications
You must be signed in to change notification settings - Fork 1
Build Locally
We use docker images for development so the descriptions below assume Docker and Docker Compose have been installed.
$ git clone https://github.com/hashblock/hashblock-exchange.git
These will be automatically installed when you compose up
hashblock
The hashblock-exchange repos comes equipped with all the goodies to run and observe behavior locally. This includes transaction authorizations, voting keys configurations, a ready to rock genesis.batch file for the sawtooth-validator and even a simple data seeder file to get you rolling.
If you are a Windows user, see the note at the bottom of the page before continuing.
Build the hashblock administrative, REST and hashblock TP family docker images. The build will also generates the necessary python protobuf files. To begin, change to the root of the hashblock-exchange directory on your machine and:
$ bin/build_all
While still in the hashblock-exchange root folder:
$ docker-compose -f docker/compose/hashblock-local.yaml up
As noted, the first execution may take a bit to start up due to the download of the hyperledger/sawtooth
services. Subsequent executions will not take as long to initialize unless you change the underlying docker files.
Once running, any of the running containers (hashblock or sawtooth) can be shelled into:
$ docker exec -it [component name here] bash
root@2fd6faa664fc:/path#
{ "plus": "church", "minus": "turing", "quantity": { "value": "5", "unit": { "system": "imperial", "key": "bags" }, "resource": { "system": "food", "key": "peanuts"
}
}
}
{ "plus": "turing", "minus": "church", "quantity": { "value": "10", "resource": { "system": "currency", "key": "USD" }, "unit": { "system": "imperial", "key": "$" } }, "utxq_address": "", "ratio": { "denominator": { "value": "1", "resource": { "system": "food", "key": "peanuts" }, "unit": { "system": "imperial", "key": "bags" } }, "numerator": { "value": "2", "resource": { "system": "currency", "key": "USD" }, "unit": { "system": "imperial", "key": "$" } } } }
To stop the hashblock-exchange processing, exit out of any shelled images, return to the composition terminal window and type Ctrl+C. When the shutdown completes clean up the docker-compose artifacts
; To stop the processing type Ctrl+C in the shell window you started it from.
; When the shutdown completes clean up the docker containers
docker-compose -f docker/compose/hashblock-local.yaml down
WSL and D4w do not agree on the path structure. WSL ads /mnt to a folder path (e.g. /mnt/c) and D4W only understand folders that start with / e.g. /c. Add the following to your ~/.bashrc file to fix this problem. You do need to provide your password.
export DOCKER_HOST='tcp://0.0.0.0:2375'
export PATH=$PATH:~/bin
# mount /mnt/c to /c if not already done
if [ ! -d "/c" ] || [ ! "$(ls -A /c)" ]; then
echo "Requiring root password to $(tput setaf 6)mount --bind /mnt/c /c$(tput sgr 0)"
sudo mkdir -p /c
sudo mount --bind /mnt/c /c
fi
# Change from /mnt/c/... to /c/...
if [ "$(pwd | cut -c -7)" == "/mnt/c/" ]; then
cd "$(pwd | cut -c 5-)"
fi
# Provide docker for bash and docker-compose
docker() {
docker.exe "$@"
}