New answers tagged

0

Transaction is failed because the gas limit you allocated in Metamask is less than what required. When we compare, _init() consumes gas more than revert(). So, you need to set gas limit of transcartion as much as necessary in the part indicated in the photo: Good Luck.


0

This is solved. I should not use async mode and await in getWeb3, removal of them can solve the problem.


0

You are using poor naming conventions. The provider in Web3 is what you use to build a Web3 instance, such as window.web3.currentProvider or window.ethereum. window.ethereum is not a Web3 instance, it is a Web3 provider. So you have to do: web3Provider = new Web3(window.ethereum);. When you have a contract, you need to tell it to use the Web3 instance of ...


0

I'm pretty sure web3.eth.defaultAccount got deprecated in the new dapp browsers. This is how you can get current account now: async function getAccounts(callback) { var accounts = await ethereum.enable(); if (typeof(callback) == 'function') { callback(accounts); } } getAccounts(function(accounts) { if (accounts != undefined) { ...


2

MetaMask does not provide a way to get the private key through code by design. Any interaction with accounts in MetaMask has to be done through the Web3 API, to prevent a (malicious) website from stealing a user's private keys.


0

You can use the eth_accounts JSON-RPC call which returns the list of accounts owned by the client. Metamask API implements it with : const accounts = await ethereum.request({ method: 'eth_accounts' }); const currentAccount = accounts[0]; The first item of the list should return the current used account. Then just compare the returned value with the ...


0

this helped "Switch networks up top by clicking on "Main Ethereum Network", and then switching back again."


1

You are trying to send ether to a contract, rather that to an Externally Owner Address (EOA). This means that contract's code will executed and the contract will decide whether to accept your transfer and what to do with ether you've sent. As long as your transaction failed and didn't use all the gas you allowed it to use, one of the following probably took ...


0

Looks like the gasEstimation for our contract was not able to be done due to a stack depth - although there were no errors for stack depth, when changing the contract around to identify what was causing metamask to throw the invalid error we did get a stack depth issue. So since this section of the contract that was very close to stack depth limitations, I'm ...


0

I'm new to this with in 2 years. But, I try to do my homework. And what I conclude and do is strictly tied to my Crypto. Get away from any computer, except a MAC 2)All seeds should be written, not stored, saved,or screen shot If you have money to buy Crypto you have money to separate the best way you can. Use 1 wallet to store and save, only you will ...


1

You can look into https://app.gitbook.com/@arkane/s/widget/ Arkane allows you to easily integrate your app with several blockchains, whether you already have an app integrated with web3 or are building a new application from scratch.


0

The last steps in the vmtrace in etherscan [106] 6358 DUP2 5220808 3 1 [107] 6359 DUP7 5220805 3 1 [108] 6360 DUP1 5220802 3 1 [109] 6361 EXTCODESIZE 5220799 700 1 [110] 6362 ISZERO 5220099 3 1 [111] 6363 DUP1 5220096 3 1 [112] 6364 ISZERO 5220093 3 1 [113] 6365 PUSH2 5220090 3 1 [114] ...


0

Looks like Metamask added functionality for this. You can use their following API commands: getEncryptionPublicKey(address) & decryptMessage(address, data)


1

You can import IERC20 interface from OpenZepplin to use with your token address: import {IERC20} from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; contract Test { function foo() public { // Reference to deployed token IERC20 token = IERC20(0x0000000000000000000000000000000000000023); // Obtain sender ...


1

Truffle is a development tool. It helps you to build and deploy smart contracts to an Ethereum based blockchain (such as the mainnet or in your case Ganache). Ganache is a test blockchain that makes developing much, much easier. It runs locally on your own machine and truffle can interact with it as if it were the real blockchain. The 'block times' are ...


Top 50 recent answers are included