New answers tagged

0

From what I see this statement import web3 from './getWeb3'; it is wrong, you are assigning getWeb3() nop web3js object, and it fails because new web3.eth.Contract is invalid as it does not have property eth. IMO in storehash.js you should have import getWeb3 from './getWeb3'; .... export default () => { return getWeb3().then(web3 => new web3.eth....


0

In my case, the answer was that I called the API incorrectly 🤦🏻‍♂️ recoverTypedSignature({ data: createPayload(message), sig: signature }) is correct. I accidentally called it with sign (note the extra "n").


0

Do I need to convert the 132 characters to 65 somehow? No, the line sig = exports.toBuffer(sig) in function fromRpcSig does this for you. However, in order for it to return a buffer of 65 bytes, toBuffer needs to receive an input string of 130 hexadecimal characters, because each character (0-9; A-F) represents 1/2 byte (4 bits). So your 132-character ...


0

The problem is here: data = adData.result[index] adData.result has only one element, while index may easily be greater than zero, as it is index of the address is address list. If you need to save only one source file per smart contract, then change this line like this: data = adData.result[0] If you need to save all the source files, do something like ...


0

The problem is that i is already equal to addresses.length when your timeout callbacks are being executed. Should be: for(i=0; i<addresses.length; i++){ const index = i; // This will not change! setTimeout(function() { $.getJSON('https://api.etherscan.io/api?module=contract&action=getsourcecode&address='+addresses[index]+'&apikey=...


0

Requires c capital of contract(Here: web3.eth.Contract), So it should be var contractAbi = new web3.eth.Contract(abi) look that is C and not c in: web3.eth.Contract


1

Are your strings going to be memory or storage? It can be expensive to use large strings as storage in terms of gas fees, as you have to pay to make other nodes retain that information. I'm not quite sure what you're building, but it often makes more sense to use hashes of large strings, and then store the data somewhere else. Other parties can check the ...


0

$ refers to jQuery, and the Etherscan link you shared also notes that. Check out their docs here. I would recommend downloading their list of addresses, and then iterating over it like so: var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider()); var version = web3.version.api; let addresses = []; // TODO: Read in CSV data for (...


0

Your Bytecode isn't a hex number. Prepend a 0x. For example 0x606060405260018054600160a060020a031916... EDIT: Nevermind you already did that. Here is another try. Convert the string to hex. parseInt("0x6060604...", 16) Take note of the radix 16. Leave this value unchanged.


0

While you can try a web automation tool, this will be slow and often brittle. A better approach would be use npm and a small script which loads web3js and the text file. Then you can parse the text file and submit the transactions via methods of web3js The code under "Usage" should get you started: https://github.com/ethereum/web3.js/


1

Change line 4 to: address payable admin; Hope it helps.


0

To do this in pure chai, you can use these two approaches: const expected = web3.utils.toBN('123.052'); const actual = await meta.getBalance.call(account_two); expect(actual).to.eql(expected); // compare to BigNumber or use strings: const actual = (await meta.getBalance.call(account_two)).toString(); expect(actual).to.equal('123.052'); Note that you have ...


0

In your crCode variable, after Contract Creation Code, you need to append Constructor Arguments. Both pieces of byte-code are available to you at the URL which you have linked in your question. Alternatively, since the Contract Source Code is also available at that link, you can compile it and then deploy it in the "standard way" (using web3.js deploy ...


0

I cannot assign more gas above gas limit of ganache... is it possible to increase this limit.... ? Yes, start Ganache with --gasLimit=someHigherValue. That being said, note that 6721975 is already by itself a pretty high value for a single transaction, so your deployment most likely fails for a different reason ("out of gas" is unfortunately quite a ...


0

With getterFunctionsNameObject[key][j].input, you are passing a single array as input parameter. Use ...getterFunctionsNameObject[key][j].input instead. BTW, I believe that you can use this also for functions which take no input parameters. In other words, the if (funcParmLength == 0) / else part is redundant. Just do res = await myContractInstance....


0

But the functions which can change the status of state variables are not running. In order to execute a state-changing function you should use send instead of call. Is it necessary to send every transaction with signature (even on local ganache)? You can skip that part if you unlock your account on the node that you're communicating with. In Ganache, ...


0

Tools exist to convert the ABI into a Solidity interface, which contains all of the function names. In Python - abi2solc In Javascript - abi2solidity The data in an ABI is generic enough that interfaces can be generated to work with ^0.5.0 or ^0.4.22, or earlier if tuple types aren't used.


1

You're missing () after myContractInstance.methods['0xc4e41b22'].


1

For your question no. 1: Search for "type": "constructor" in your ABI. From this object, you can see the inputs that has an array of parameters along with their name and type. Example: { "inputs": [ { "internalType": "uint256", "name": "_ff", "type": "uint256" }, { "internalType": "string", "...


1

This is failing because the block number passed as the first parameter to eth_gasBlockByNumber must be a hex string. Instead of doing parseInt(res.result, 16), just store res.result directly and pass that in.


1

This is due to the behavior of call(). Call is for read-only, e.g. any state alterations done in the function are not persistent. If you change the instances of instance.addPayment.call() to instance.addPayment(), it will persist the changes. There is another complication of course, that you are using the return value of addPayment, which doesn't really ...


0

What you are doing wrong is in your code myContAddr is string and you are trying access parameters of this variable. To access .methods.getTotalSupply().call() you need to create contract instance using the following code: async function myContractAddress() { var myContAddr = '0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE'; var myContractAbiDefenition =...


0

why here we are not used our private Key for signing during deployment of contract Because your code assumes that account1 is unlocked on the node that you're communicating with (whatever you've initialized your web3 instance to connect to). If account1 is not unlocked on that node, then your code will fail to complete. I'm assuming that account1 is a ...


Top 50 recent answers are included