Conv-Oracle is an example on how to handle oracles within Hyperledger Fabric with Convector.
- First meet Hyperledger Fabric pre-requisites.
- Configure a mock API in https://www.mockable.io.
- Make sure it is of type
POST
and the path isbankapi
. - Copy the whole url in the field
path
of mockable.io and add it in a.env
file in./packages/conv-oracle/src/.env
with the contentEXTERNAL_URL=<full-url>
.
- Make sure it is of type
npm install
# Start a blockchain network locally
npm run env:restart
# Install the smart contract
npm run cc:start
# Start the oracle daemon [ignore npx if you don't use it]
npx lerna run start --scope conv-oracle --stream
# If you don't have hurley go and get it! npm i -g @worldsibu/hurley
hurl invoke carinsurance carinsurance_create "1" "volk" "1199"
This will trigger the transaction in the blockchain - send an event to the oracle daemon - fetch the API - call the __callback()
and finish the transaction with external data.
# Hook to the container running the smart contract
docker logs -f dev-peer0.org1.hurley.lab-carinsurance-2
- Read this blog post for more details.
- Join the growing community on Discord.
- Get to know about WorldSibu's work in making blockchain easy for enterprises.
- Subscribe to the monthly newsletter.