[Workshop] Beyond Cryptocurrency
Blockchain, Smart Contracts & Oracles
This is the workshop portion of an example presentation. The purpose of this workshop is to demonstrate the use of an oracle to initiate a request for real-world data from a blockchain smart contract and update the state of the smart contract with the oracle's response.
Preparation & Requirements
This workshop assumes a basic familiarity with Ethereum smart contract development. Workshop participants will need access to a web browser and an Ethereum "wallet", such as Metamask or the built-in wallet of the Brave browser. In order to use the wallet to interact with the Ethereum blockchain, it is necessary to fund it with Ether.
Steps
- Navigate to the Remix web IDE and load the workshop code from GitHub.
- Use the Remix Solidity compiler to compile the workshop code. You can safely ignore any compiler warnings.
- Use Remix and the Ethereum wallet to deploy the compiled YoutubeViews contract to the Ropsten Ethereum network.
- Ensure that the wallet is connected to the Ropsten network.
- Ensure that Remix is using the Injected Web3 environment.
- Once the contract has deployed, use Remix to inspect the value of the deployed contract's viewsCount state variable; its value should be the empty string.
- Use Remix to invoke the update function on the deployed contract with the following settings:
- Gas limit: 8000000
- Value: 1 ether
- After the transaction has been confirmed, use Remix to inspect the value of the viewsCount state variable; its value should be (roughly) equivalent to the text that specifies the number of views on this YouTube video.