New answers tagged

0

In Javascript, the type of 0x79fB0E00F4dB8812b04Ae84816BbccAF941E5c90 is Number. Yet, the value of this number is larger than Number.MAX_SAFE_INTEGER, which is 53 bits long. Solidity address types are 160 bits long, and they are passed to/from web3.js functions as strings. Hence, you should always use quotes around any address value in your Javascript ...


0

Turns out I had forgotten to put the contract's instance address in quotes! See last line of this snippet: var ethereumSessionInstance = new web3.eth.Contract([ { "constant": false, "inputs": [ { "name": "_myInt", "type": "uint256" } ], "name": "setTheInt", ...


2

[ethjs-rpc] rpc error with payload in Solidity 0.5.0 happens if the passed parameters to the contract is empty, hence from DApp console log all parameters and see if any values are being passed as empty or null. Once you address the empty values to some concrete values rpc error will go way and transaction will be success.


0

I use "contract.events.Transfer({ fromBlock: 0 }, function (err, data) {" instead of "web3.eth.subscribe('logs', {" ... in order to be informed about all different events that happen (in this case the Transfer event, but you can also add other events too.) If there is an error in the transfer for e.g. I receive the error in the catch(error) section. the "...


0

If MetaMask will stop injecting web3 this means web3.currentProvider is not gonna work anymore properly. My advice is to handle the change and not getting your app crashed by downloading your own web3 library and using ethereum provider. This variable was introduced in the latest versions. Example: const Web3 = require('web3'); // import web3 v1.0 ...


0

for me this did also not work and I do not know why, but I found the following solution using web3. As web3 from Metamask will be deprecated I get web3 not from Metamask, but through: web3 = new Web3(Web3.givenProvider); then setting up the event listener somewhere else later on in the code: web3.eth.Contract(TokenABI, TokenAddress); try { ...


1

import Web3 from 'web3'; At the top of the file and then during a componentwillmount or whatnot, these lines... window.web3 = new Web3(window.ethereum); await window.ethereum.enable();


1

MetaMask does use Web3.js internally. You can check it in the source code on GitHub. Previously, MetaMask would also inject window.web3 in the current page, but that was changed to only inject window.ethereum instead. Dapps can use window.ethereum for safe interaction with a user's wallet.


0

Looks like brute force is near impossible. 16^54 private keys. At 1 million private keys a second, it takes (16^27)/1000000 seconds or 1.028*10^19 years. What about recovery from Metamask data? Is it possible?


1

Your issue is that you are not following the ERC20 spec. You need to follow the spec in order for Metamask to understand that you have tokens. You have two issues with your current code. Your first issue is that you do not have a balanceOf map. Metamask uses this mapping to display your balances. The second is that you do not have a totalSupply variable ...


Top 50 recent answers are included