Skip to content
An example of the flow required to get oracles up and running with Hyperledger Fabric through Convector
TypeScript JavaScript
Branch: master
Clone or download
Latest commit e6d74d4 Aug 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
packages readme details Aug 9, 2019
.convector nest bootstrap Aug 9, 2019
.gitignore oracle working Aug 9, 2019
LICENSE Initial commit Aug 9, 2019
README.md completed readme Aug 9, 2019
config.json oracle working Aug 9, 2019
lerna.json nest oracle compiling Aug 9, 2019
package-lock.json
package.json oracle working Aug 9, 2019
tsconfig.json nest bootstrap Aug 9, 2019
update-paths.js nest bootstrap Aug 9, 2019

README.md

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?

You can’t perform that action at this time.