Hot answers tagged

2

I fixed it. Add this code in app.js: // MetaMask injects its own web3 instance in all pages, override it // as it might be not compatible with the one used here if (window.web3) window.web3 = web3;


2

Get the contract object via: const contract = await new web3.eth.Contract(JSON.parse(interface), smartContractAddress);


2

You can try events, check this out: https://solidity.readthedocs.io/en/v0.5.10/structure-of-a-contract.html?highlight=events#events


1

I changed genesis.json now it is working { "config": { "chainId": 9663080, "homesteadBlock": 0, "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "ethash": {} }, "nonce": "0x0", "timestamp": "0x5d5cdc87"...


1

The simple answer is to use web3.utils.soliditySha3. But the way to use it is what makes all the difference. const theValueYouNeed = web3.utils.soliditySha3( { type: 'bytes32', value: theBytes32Value }, { type: 'address', value: theAddressValue }, { type: 'bytes32', value: 'IfYouAreDirectlyPuttingValueUseQuotes' }); This way you will get the same result ...


1

Methods of a contract can be accessed by methods method of a contract instance. And the transaction can be either called by call() method or sent by send() method. So, you should use smth like that: contractInstance.methods.notarize(item).send((e,r) => {console.log(e,r)}) See more info in the web3js documentation.


1

Something that may be of interest is https://squarelink.com/ Other than that, metamask is ahead of everyone else as far as I know.


1

I think this will work: result.events.numberSaved.returnValues['number']


Only top voted, non community-wiki answers of a minimum length are eligible