hlf-database-app
Skeleton for building a Hyperledger Fabric database app
Requirements
MacOS
brew install jq
debian/ubuntu
sudo apt install jq
QUICKSTART
-
Configure environment
make config.env
Edit config.env to taste (see below for Blockdaemon CA-server setup)
-
Build binary and make credentials:
make
-
Create/update/join channel, then install/instantiate chaincode (only have to do this once):
./app init
Some things you can do
Start up a webapp
./app webapp
It should be visible here: http://localhost:3001
hello
to a value, and retrieve it
Set ./app set hello world
./app get hello
Store a file and retrieve it
./app store <key> <sample-file>
./app fetch <key> out
diff <sample-file> out
Clear out old chaincode
pushd $GOPATH/src/github.com/Blockdaemon/hlf-service-network
docker-compose down
popd
make clean-cc
Talk to real external hosts and not a local docker instance
Set DISABLE_MATCHERS=_
in config.env
, rerun make
cryptogen
Talk to a Blockdaemon CA server instead of using cp examples/config-ca.env config.env
Edit config.env
to taste, then add CA server admin creds to ca-client/local.env
:
CA_USER=<adminuser>
CA_PASS=<adminpass>
Make it a bit more secure, then run make:
chmod og-rw ca-client/local.env
make
Bugs
- You may need to check out the repo in your
GOPATH
or chaincode installation may not work. - If you change
config.env
, and you are usingca-client
, you may need torm -rf ca-client/crypto-config
.app get/set
may hang waiting for the transaction ack event. For some reason they go missing sometimes. CTRL-C to abort, the transaction usually went through
References
Based on the chainhero.io tutorial.
Requires a service network or a Blockdaemon hosted HLF network