Chainlink Truffle Box – 链环松露盒区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Chainlink Truffle Box – 链环松露盒区块链毕设代写 是一篇很好的国外资料

Chainlink Truffle Box

Chainlink Truffle Box - 链环松露盒

Requirements

  • NPM

Installation

  1. Install truffle
npm install truffle -g
  1. Setup repo
mkdir MyChainlinkProject cd MyChainlinkProject/
  1. Unbox
truffle unbox smartcontractkit/box
  1. Install dependencies by running:
npm install  # OR...  yarn install

Test

npm test

Deploy

For deploying to the kovan network, Truffle will use truffle-hdwallet-provider for your mnemonic and an RPC URL. Set your environment variables $RPC_URL and $MNEMONIC before running:

npm run migrate:kovan

You can also run:

truffle migrate --network kovan --reset

If you want to use truffle commands.

Local Blockchain

⚠️ Without a Chainlink node deployed locally, requests from smart contracts will not be responded to. We recommend you deploy to the Kovan network

If needed, edit the truffle-config.js config file to set the desired network to a different port. It assumes any network is running the RPC port on 8545.

npm run migrate:dev

Helper Scripts

There are 3 helper scripts provided with this box in the scripts directory:

  • fund-contract.js
  • request-data.js
  • read-contract.js

In addition, for working with Chainlink Price Feeds and ChainlinkVRF there are folders respectively.

They can be used by calling them from npx truffle exec, for example:

npx truffle exec scripts/fund-contract.js --network kovan

The CLI will output something similar to the following:

Using network 'kovan'.  Funding contract: 0x972DB80842Fdaf6015d80954949dBE0A1700705E 0xd81fcf7bfaf8660149041c823e843f0b2409137a1809a0319d26db9ceaeef650 Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

In the request-data.js script, example parameters are provided for you. You can change the oracle address, Job ID, and parameters based on the information available on our documentation.

npx truffle exec scripts/request-data.js --network kovan

This creates a request and will return the transaction ID, for example:

Using network 'kovan'.  Creating request on contract: 0x972DB80842Fdaf6015d80954949dBE0A1700705E 0x828f256109f22087b0804a4d1a5c25e8ce9e5ac4bbc777b5715f5f9e5b181a4b Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

After creating a request on a kovan network, you will want to wait 3 blocks for the Chainlink node to respond. Then call the read-contract.js script to read the contract’s state.

npx truffle exec scripts/read-contract.js --network kovan

Once the oracle has responded, you will receive a value similar to the one below:

Using network 'kovan'.  21568 Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

TODO

  • Add tests for ChainlinkVRF
  • Add tests for Chainlink Price Feeds
  • Refactor tests to use this instead of defining contracts with let
  • Use the Chainlink-published mocks for MockV3Aggregator and VRFCoordinatorMock

Chainlink Truffle Box

Chainlink Truffle Box - 链环松露盒

Requirements

  • NPM

Installation

  1. Install truffle
npm install truffle -g
  1. Setup repo
mkdir MyChainlinkProject cd MyChainlinkProject/
  1. Unbox
truffle unbox smartcontractkit/box
  1. Install dependencies by running:
npm install  # OR...  yarn install

Test

npm test

Deploy

For deploying to the kovan network, Truffle will use truffle-hdwallet-provider for your mnemonic and an RPC URL. Set your environment variables $RPC_URL and $MNEMONIC before running:

npm run migrate:kovan

You can also run:

truffle migrate --network kovan --reset

If you want to use truffle commands.

Local Blockchain

⚠️ Without a Chainlink node deployed locally, requests from smart contracts will not be responded to. We recommend you deploy to the Kovan network

If needed, edit the truffle-config.js config file to set the desired network to a different port. It assumes any network is running the RPC port on 8545.

npm run migrate:dev

Helper Scripts

There are 3 helper scripts provided with this box in the scripts directory:

  • fund-contract.js
  • request-data.js
  • read-contract.js

In addition, for working with Chainlink Price Feeds and ChainlinkVRF there are folders respectively.

They can be used by calling them from npx truffle exec, for example:

npx truffle exec scripts/fund-contract.js --network kovan

The CLI will output something similar to the following:

Using network 'kovan'.  Funding contract: 0x972DB80842Fdaf6015d80954949dBE0A1700705E 0xd81fcf7bfaf8660149041c823e843f0b2409137a1809a0319d26db9ceaeef650 Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

In the request-data.js script, example parameters are provided for you. You can change the oracle address, Job ID, and parameters based on the information available on our documentation.

npx truffle exec scripts/request-data.js --network kovan

This creates a request and will return the transaction ID, for example:

Using network 'kovan'.  Creating request on contract: 0x972DB80842Fdaf6015d80954949dBE0A1700705E 0x828f256109f22087b0804a4d1a5c25e8ce9e5ac4bbc777b5715f5f9e5b181a4b Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

After creating a request on a kovan network, you will want to wait 3 blocks for the Chainlink node to respond. Then call the read-contract.js script to read the contract’s state.

npx truffle exec scripts/read-contract.js --network kovan

Once the oracle has responded, you will receive a value similar to the one below:

Using network 'kovan'.  21568 Truffle v5.0.25 (core: 5.0.25) Node v10.16.3 

TODO

  • Add tests for ChainlinkVRF
  • Add tests for Chainlink Price Feeds
  • Refactor tests to use this instead of defining contracts with let
  • Use the Chainlink-published mocks for MockV3Aggregator and VRFCoordinatorMock

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/22430.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Chainlink Truffle Box – 链环松露盒区块链毕设代写

提供最优质的资源集合

立即查看 了解详情