{"id":23554765,"url":"https://github.com/alejoacosta74/chainlink-node-oracle-demo","last_synced_at":"2026-04-20T09:33:08.324Z","repository":{"id":128687212,"uuid":"459298118","full_name":"alejoacosta74/chainlink-node-oracle-demo","owner":"alejoacosta74","description":"Run a local Chainlink node with Oracle contract deployed on Qtum, Rinkeby or Ganache chains.","archived":false,"fork":false,"pushed_at":"2023-01-09T05:20:41.000Z","size":1648,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T13:28:37.823Z","etag":null,"topics":["chainlink","chainlink-node","docker","ethereum","qtum-blockchain","rinkeby","truffle"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alejoacosta74.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-14T19:30:09.000Z","updated_at":"2023-12-04T14:13:56.000Z","dependencies_parsed_at":"2023-04-06T15:36:24.163Z","dependency_job_id":null,"html_url":"https://github.com/alejoacosta74/chainlink-node-oracle-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejoacosta74%2Fchainlink-node-oracle-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejoacosta74%2Fchainlink-node-oracle-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejoacosta74%2Fchainlink-node-oracle-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejoacosta74%2Fchainlink-node-oracle-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alejoacosta74","download_url":"https://codeload.github.com/alejoacosta74/chainlink-node-oracle-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414501,"owners_count":22067272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chainlink","chainlink-node","docker","ethereum","qtum-blockchain","rinkeby","truffle"],"created_at":"2024-12-26T12:25:17.748Z","updated_at":"2026-04-20T09:33:03.286Z","avatar_url":"https://github.com/alejoacosta74.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![chainlink](https://img.shields.io/badge/chainlink-375BD2?style=for-the-badge\u0026logo=chainlink\u0026logoColor=white) ![solidity](https://img.shields.io/badge/Solidity-e6e6e6?style=for-the-badge\u0026logo=solidity\u0026logoColor=black) ![ethereum](https://img.shields.io/badge/Ethereum-3C3C3D?style=for-the-badge\u0026logo=Ethereum\u0026logoColor=white)  ![javascript](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge\u0026logo=javascript\u0026logoColor=F7DF1E) ![docker](https://img.shields.io/badge/Docker-2CA5E0?style=for-the-badge\u0026logo=docker\u0026logoColor=white) ![postgres](https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white) ![golang](https://img.shields.io/badge/Go-00ADD8?style=for-the-badge\u0026logo=go\u0026logoColor=white)\u003cimg src=\"https://camo.githubusercontent.com/4485d17c3a177657700243cda0c3c8e78423102f11fbacbd9bb40d20cb1f0f27/68747470733a2f2f74727566666c6573756974652e636f6d2f696d672f74727566666c652d6c6f676f2d6461726b2e737667\" height=70 /\u003e\n\n\n# Running a local Chainlink node with Oracle contract\n\nStep by step guide to run a Chainlink consumer test with a local chainlink node on Qtum, Rinkeby or Ganache chains.\n\nRef: https://docs.chain.link/docs/fulfilling-requests/\n\n![chainlink poc](demo.png \"chainlink-demo\")\n\n\n## Dependencies\n\nThis project has a number of dependencies, including but not limited to: Node.js, Ganache and Docker.\n\n## Basic deployment to Gananche\n\n- Before using this project, start a Ganache workspace that includes `./truffle/truffle-config.js` from this project and serves\non all interfaces (`0.0.0.0`).\n\n- Run `npm start` to migrate the Truffle contracts and start a Chainlink node that is connected to Ganache.\n\n- Run `npm run truffle:init-setup` to fund the deployed Chainlink client contract with `LINK`, fund your Chainlink node\nwith ETH and give the address of your Chainlink node fulfillment permissions on the deployed oracle contract.\n\n- Run `npm run stop` to shutdown the Chainlink node.\n\n## Custom deployment to Ganache/Rinkeby\n\n- Migrate contracts with truffle\n\n```\ntruffle migrate --network ganache|qtum|rinkeby\n```\n\n- Start Chainlink node\n\n```\n./chainlink/start-cl.sh\n```\n\n\n- Fund Client contract with LINK\n\n```\ntruffle exec ./scripts/request-price.js --network ganache|qtum|rinkeby\n```\n\n- Setting fullfilment and funding Chainlink addres\n  \n```\ntruffle exec ./scripts/prep-node.js --network ganache|qtum|rinkeby\n```\n\n-  Define a Chainlin Job\nUse your web browser and the Chainlink node web UI (`localhost:6688`) to add the following job to your Chainlink node\n\n```toml\ntype = \"directrequest\"\nschemaVersion = 1\nname = \"Get \u003e Uint256\"\n# Optional External Job ID: Automatically generated if unspecified\n# externalJobID = \"b1d42cd5-4a3a-4200-b1f7-25a68e48aad8\"\ncontractAddress = \"YOUR_ORACLE_CONTRACT_ADDRESS\"\nmaxTaskDuration = \"0s\"\nobservationSource = \"\"\"\n    decode_log   [type=\"ethabidecodelog\"\n                  abi=\"OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)\"\n                  data=\"$(jobRun.logData)\"\n                  topics=\"$(jobRun.logTopics)\"]\n\n    decode_cbor  [type=\"cborparse\" data=\"$(decode_log.data)\"]\n    fetch        [type=\"http\" method=GET url=\"$(decode_cbor.get)\"]\n    parse        [type=\"jsonparse\" path=\"$(decode_cbor.path)\" data=\"$(fetch)\"]\n    multiply     [type=\"multiply\" input=\"$(parse)\" times=100]\n    encode_data  [type=\"ethabiencode\" abi=\"(uint256 value)\" data=\"{ \\\\\"value\\\\\": $(multiply) }\"]\n    encode_tx    [type=\"ethabiencode\"\n                  abi=\"fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)\"\n                  data=\"{\\\\\"requestId\\\\\": $(decode_log.requestId), \\\\\"payment\\\\\": $(decode_log.payment), \\\\\"callbackAddress\\\\\": $(decode_log.callbackAddr), \\\\\"callbackFunctionId\\\\\": $(decode_log.callbackFunctionId), \\\\\"expiration\\\\\": $(decode_log.cancelExpiration), \\\\\"data\\\\\": $(encode_data)}\"\n                 ]\n    submit_tx    [type=\"ethtx\" to=\"YOUR_ORACLE_CONTRACT_ADDRESS\" data=\"$(encode_tx)\"]\n\n    decode_log -\u003e decode_cbor -\u003e fetch -\u003e parse -\u003e multiply -\u003e encode_data -\u003e encode_tx -\u003e submit_tx\n\"\"\"\n\n```\n\nReplace `\u003cYOUR_ORACLE_CONTRACT_ADDRESS\u003e` with your oracle contract address, enclosed in quotation marks. You can find\nthis value on the configuration page for your Chainlink node.\n\nThe credentials to login to the Chainlink node are `user@example.com/password`.\n\n- Request ETH price\n\n```\ntruffle exec ./scripts/request-price.js --network ganache|qtum|rinkeby\n```\n\n## Running chainlink as a binary\n\nAlternatively, Chainlink node can be ran as a binary by executing following steps (qtum example)\n\n1. Start postgres docker container\n```\ncd postgres\ndocker-compose up -d\n```\n\n2. Create DB for Qtum Testnet\n  \n```\npsql --host=127.0.0.1 -p 5432 --dbname dbchainlink --username=dbuser --password --command=\"CREATE DATABASE qtumtestnet WITH OWNER dbuser\"\n```\n\n3. Start chainlink node\n\n- Source environment vars\n\n```\nsource qtum-testnet.env\n```\n\n- Start chainlink\n\n```\nsource ./chainlink/qtum_testnet.env\ncd \u003clocation of chainlink node repo\u003e/core\ngo run main.go local n -p $NODEPWD -a $APIPWD\n```\n\nor\n```\n./chainlink local n -p $NODEPWD -a $APIPWD\n```\n\n4. Test web Node Operator GUI\n\nhttp://localhost:6688/signin\n\n\n## Deployment addresses\n\n```bash\nNetwork: Rinkeby (id: 4)\n  GanacheChainlinkClient: 0xf58e65d6489208eC56d7F4Fc2EF5DDdE7D915d36\n  LinkToken: 0x86F24969877A4dc4334F7416AF1A6e68D49B8469\n  Migrations: 0x6AE9F1692C7539cc4E90cA91Ca774d3d98B2b1Ed\n  Oracle: 0x4E1d35fE640537558547A61F3E016B6b71C8B203\n```\n\n```bash\n  GanacheChainlinkClient: 0x80d2f667e6bBf6Ab2937d1F6697903f858dd9090\n  LinkToken: 0xE9555c1F9C8C97eeF5D4D9B37f8de07B6B359547\n  Migrations: 0x21Cad20E7a8b6aFb3268A9c2Ba6575356784dC13\n  Oracle: 0x7fD9A5E7a38CC396609cf389364e9504F14A5ee6\n```\n## Miscelaneous\n\n\n### Updating env vars\n\n- frontend\n  \nUpdate `App.js` accordingly:\n\n```javascript\nconst backendURL = \"http://127.0.0.1:3000/demo\";\nconst JANUS=\"ws://54.193.12.166:23889\";\n```\n\n- backend\n\nUpdate `.env` :\n\n```bash\nJANUS=\"http://54.193.12.166:23889\"\n```\n\n- Chainlink\n\nUpdate `qtum_testnet.env`:\n\n```bash\nexport ETH_URL=ws://54.193.12.166:23889\nexport DATABASE_URL=postgresql://dbuser:dbpass@127.0.0.1:5432/qtumchainlinkdev?sslmode=disable\n```\n\n### Wallets\n\nBackend API expects a qtum node running with a local (funded) wallet for address `qUbxboqjBRp96j3La8D1RYkyqx5uQbJPoW`\n\n### Subscribing to Oracle event\n\nYou can subscribe to `OracleRequest` event by running the following golang listener\n\n```bash\ncd utils\ngo run subscribe_oracle.go qtum 23890\n```\n\n### Deployment to Rinkeby\n\nCreate a `.env` file inside `truffle` folder with the infura credentials and seed phrase\n\n```\nMNEMONIC=\"\u003cseed phrase\u003e\"\nINFURA_APIKEY=\"\u003capi key\u003e\"\n```\n\n### Chailink node address\n\nRegular address\n```\nhex: \"0x78Ad4cB180b93Af91D24f3A62A0346DB15E834F3\"\nbase58: qUZTr7kDgpZDn6uctfv6sHZ4esJPJanCKR\n```\n\nEmergency funding address\n```\nhex: \"0x4e07e496c5F6b93Ca913c3f20C1838F772c272e7\"\nbase58: qQfyKQPsTLtnzp2Nnr9e5PuByLzXnVQduM\n```\n\n### start backend API \n\n\n```\nNODE_ENV=production \u0026\u0026 pm2 start npm --name \"qtum-api\" -- start\n```\n\n### frontend web UI\n\n![webui](frontend.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejoacosta74%2Fchainlink-node-oracle-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejoacosta74%2Fchainlink-node-oracle-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejoacosta74%2Fchainlink-node-oracle-demo/lists"}