Dynamic pricing for government transport services.
A chainlink model that allows purchase of public transport passes based on volume present at different transport hubs and the number of passes previously purchased.
Used several different blockchain technologies to make this project, going after:
- Government tech prize
- Social impact prize.
- GeoDB (oracle) - used for querying
- MATIC (deployment) - mumbai testnet contract: 0xDB73769d3132DcDE68D27B91E2dd278BD6Be917a
- Plasm (deployment) - testnet contract: 0xbEc5b1faDE897D49A10DC02fD405dCa2aC4C752f
- Moonbeam (deployment) - 0x8B14f0Bdf1feE1941e78E5619cdad6AA65095ED9
- 88mph contract - DInterest contract (currently concept, potentially includable in a future deployment) for pushing funds from government fare purchases to an interest bearing DAI pool.
Ethereum Kovan network: 0xf672b3d4d31b287D9faF733119F5b1bDbDB9b6B8
Covid caused a huge drop in public service usage last year. Using chainlink, the impact on government transport service revenue be mitigated/reduced by offering the public the ability to pre-purchase futures and fare for public transport on blockchain.
Right now I could go buy a bus pass and it always costs $2.50. You don't want to have big chunks of the day or the year where running transport is open. Might as well discount them so you can still fill them up.
They run this at ski resorts because if there's a big event that causes a drop in people they still want to invite attendees. Transport business can get a more stable source of revenue if individuals purchase longer term passes. Customers also win because they know the price isn't going to go way up if the demand goes way up in the future.
- Uses chainlink oracles to model/track attendence at different airport and transportation hubs.
- Determines a real-time price for a given transport contract.
- Generates a receipt representing your pass purchase.
- Optionally pushes funds from transport pass purchases to interest bearing crypto pools.
- Currently deployed on the Kovan, Moonbeam, Plasm, Mumbai testnets.

Collecting payment for a given route using metamask.
TransportChain queries an index of Amtrak/train locations across the US allowing the user to create their own custom route for pass purchase.
A smartcontract determines the pricing of the fare based on the user population/trends at the different stations over the past 2 months.
Upon completing the purchase, the user is redirected to a receipt/completion page linking to the transaction alongside the created pass document as a pdf. Currently supports the Kovan network only.
- Remix (contracts and compilation)
- Metamask/web3 (contract interaction)
- Chainlink (base contract)
- GeoDB (API)
- Plasm (deployment)
- Matic (deployment)
Demo: transportchain.netlify.com
- Integrating the different blockchain technologies in a single chainlink contracts.
- Deploying and configuring the contracts on different provider networks.
- Connecting the FE to the Kovan test network with metamask.
- Support longer term passes
- More historic data to improve the pricing model
- Admin graphs/reporting of purchases made by users
- NPM
- Install truffle
npm install truffle -g- Setup repo
mkdir MyChainlinkProject
cd MyChainlinkProject/- Unbox
truffle unbox smartcontractkit/box- Install dependencies by running:
npm install
# OR...
yarn installnpm testFor 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:kovanYou can also run:
truffle migrate --network kovan --resetIf you want to use truffle commands.
⚠️ 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:devThere are 3 helper scripts provided with this box in the scripts directory:
fund-contract.jsrequest-data.jsread-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 kovanThe 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 kovanThis 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 kovanOnce 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
