Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

3

Did you try web3's web3.eth.personal.ecRecover? For example, if you sign via web3.eth.personal.sign("Hello world", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "test password!") .then(console.log); > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400" You "recover" via....


2

I think I had similar problem. I couldn't get correct address from ecrecover after message was signed with personal.sign, but it works fine after it was sign with eth.sign. Then I found this on web3 docs: https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#sign "Signs data using a specific account. This data is before UTF-8 HEX decoded and ...


2

I'm also facing same problem. My ganache was running, metamask is also running, web3 is also injected. The problem was web3.eth.accounts and web3.eth.getAccounts().then(...) was returning null. But after lot of searching I found that ethereum.enable() I run this command and one metamask popup was opened, which connected my metamask account to app.


1

To get current account selected in Metamask: web3.eth.accounts[0]. To make above code work with metamask, set coinbase on ganache, and then configure and use custom RPC url (provided by ganache ) in metamask.


1

Metamask performs estimations about how much gas is needed (gas limit). I'd assume it adds some "safety" margin on top of that. Also, the gas estimations are sometimes very inaccurate and/or impossible to perform due to various reasons. The default gas price is probably taken from a gas price prediction system such as https://ethgasstation.info/ . You can ...


1

The data you saw are exactly the data you passed as name, age. The web3, in the background packs function name, input parameters and so on in the data field of transaction so the EVM knows what function it should execute and what are the parameters for it. You can see in this asnwer how the data are created and encoded and then added to the transaction ...


1

Use contract.selector Example: For get contract use this code: def getInfo(abi, address): api = w3.eth.contract(address=address, abi=abi) return api def contractFunction(address, param1, param2): abi = """ json abi code """ return getInfo(abi, address).functions.contractFunction(param1, param2) And when you make ...


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