Create a web application with Web3 to interact with a smart contract — Ethereum

Alvaro Andres Pinzon Cortes
1 min readDec 3, 2019

--

  1. Create a folder for your project and create an index.html.

2. Include the Web3 javascript library in the index.html like this:

Please replace the link to this:

https://raw.githubusercontent.com/ethereum/web3.js/1.x/dist/web3.min.js

3. Create a new object called web3 that is an instantiation of Web3

https://web3js.readthedocs.io/en/v1.2.0/getting-started.html#adding-web3-js

4. Connect to your contract using the address and ABI:

5. Execute the function in the smart contract

6. Run the website locally:

// Python 2
python -m SimpleHTTPServer 8000
// Python 3
python3 -m http.server 8000

Useful resources

Getting started with INFURA

https://blog.infura.io/getting-started-with-infura-28e41844cc89

--

--

No responses yet