Skip to content

An example of the flow required to get oracles up and running with Hyperledger Fabric through Convector

License

Notifications You must be signed in to change notification settings

worldsibu/convector-oracle

Repository files navigation

Conv-Oracle

Conv-Oracle is an example on how to handle oracles within Hyperledger Fabric with Convector.

Pre requisites

  • 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 is bankapi.
    • 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 content EXTERNAL_URL=<full-url>.

Start the project

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

See it in action!

# 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.

Want to see the logs of everything happening?

# Hook to the container running the smart contract
docker logs -f dev-peer0.org1.hurley.lab-carinsurance-2

How does it work?

Diagram

What do to next?

About

An example of the flow required to get oracles up and running with Hyperledger Fabric through Convector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published