[Smart Contract] Run "Hello, World!" Job
How to run a cowsay job from a Smart contract!
Last updated
How to run a cowsay job from a Smart contract!
Last updated
Open the Contract
Click this link to open the ExampleClient.sol contract in remix
Alternatively, open the Remix IDE in your browser and copy in the below ExampleClient.sol contract:
Connect to the Testnet
Connect MetaMask to the Lalechuza testnet & ensure you have testnet lilETH funds.
In the deploy tab in remix [fourth tab in the side bar], ensure you set the environment to "Injected Provider - MetaMask"
Deploy the Contact In remix, compile the ExampleClient.sol contract [third tab in the side bar]
Deploy a new contract by pasting in the Modicum contract address (found here) to the constructor
Deploy an existing ExampleClient.sol contract by using the "At Address" with the following pre-deployed contract address: 0x035C7593D3355b9bE0459dF2296053f887d051f1
Call the runCowsay function
The moment of truth! Let's run the cowsay example!!
β οΈβFirst, ensure you set remix to pay 2 lilETH to the function by setting the "value" field
Then add the string parameter for what you want the cow to say and click the transact button! Your MetaMask wallet should pop up asking you to confirm the transaction.
Wait a couple of minutes for the job to complete on the compute network. Then you will be able to click the fetchAllResults button to get your IPFS CID result.
See the Results π
Open the string starting with "https://ipfs.io/" in your browser which contains the output of the compute job:
The cowsay result is found under "stdout"
Congrats!