I am creating a simple registration and login forms in React.js and connecting it with smart contract in order to use it to store the data from the front and to the blockchain is there any method or command to connect the front end with the smart contract in order to use its functions?

Thank in advance


There are many tuts how to do this basically its as simple as that

import Web3 from 'web3';

let rpcUrl = "https://mainnet.infura.io/ocCdekUYwOyLn7h7OlJM";
let web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl));

const contractabi = JSON.parse('abi.json'); // the ABI
const contractaddress = '0xb51adbdd256930bd6b4c613add6fcca31db49827'; // Address of contract
const myContract = web3.eth.Contract(contractabi , contractaddress);


Take a look at these examples :



| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.