This video is available to students only

Reading Values from Ethereum in JavaScript with Web3

In this video, we'll write our first Solidity smart contract

Now that we know we have a connection between our browser and our Ethereum node Let's make a connection to our contract

Remember that in order to create a JavaScript representation of our contract, we need to load the abi

Let's copy the abi that we compiled earlier into this project. Only I'm going to rename it to counter_sol_Counter_abi.json

In the code, we can require this .json file -- this is possible because of the nwb config, if you're building using another method you could always just copy and paste the abi here in the code t counterAbi = require('./counter_sol_Counter_abi.json');

We can log it out and make sure it loaded. Great nsole.log(counterAbi);

Also remember that our particular instance of the counter contract lives at a specific address on the blockchain. I hope you saved the contract address from last time.

let contractAddr = '0x4575e7fcf12a110060ebc1e3b2b85706ddfbc97e';
 

This page is a preview of Intro to Programming Ethereum ĐApps

Please select a discussion on the left.