New answers tagged

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

According to the Ethereum Yellow paper: nonce: A scalar value equal to the number of transactions sent by the sender; formally Tn. In this case, what I have done in the past is first make a request to get the number of transactions then use this value + 1 as the nonce for the next transaction. Here's an example using web3data.js. Now if you get this ...


0

You can't really be certain unless you store locally the latest known nonce, and secure access to that value using locks. The reason is that several threads could get the current number of transactions for that address (in other words, the nonce) at the exact same time, and they all would end up broadcasting different transactions with the same nonce. Say ...


0

The result of the contract call will be available only inside the init function. In order to make it available to other functions, you can return the result. const contractAddress1 = '0xc1847e91e386e11e4df447b3e333f1b18abd1aca' const contractABI = [{"constant":true,"inputs":[],"................]; var contract1 = new web3.eth.Contract(contractABI, ...


0

This is more of a javascript question rather than related to ethereum. The reason why your variable ot hasn't changed is because method contract1.methods.getTotalSupply() needs some time to query the blockchain for the result. This works on the same principle like Ajax request. What you could do is use async/ await or just place the variable inside the query ...


0

You are printing ot before call result was stored to it. Try this code: var ot="raw"; contract1.methods.getTotalSupply().call().then(function(result){ console.log(result) ot = result; console.log("ot : ", ot); }); Explanation: You are calling contract asynchronously, which means that result is not available immediately, but rather after some time. ...


0

In Remix: Create the ABI with the skeleton of the contract, for instance in Remix. Then in NodejJs: Get the mnemonic or the private key that you want to use to interact with Ethereum. Create a Web3 instance with a HDWalletProvider to connect to Infura.io. Create a Web3 contract instance with the ABI and the deployed address. Interact with this contract ...


0

You may use "Write Contract" feature of Etherscan.io: https://etherscan.io/address/0xdb25f211ab05b1c97d595516f45794528a807ad8#writeContract, but your contract has to have verified source code on Etherscan.io and you need to use Web3 enabled browser such as Metamask.


0

Look carefully at what you are writing: gas: gasPrice, gasPrice: gasEstimate, It should be: gas: gasEstimate, gasPrice: gasPrice,


0

OP didn't say if this is sales tax, income tax, or something else so we have no information about how it is calculated. I'm going with a tax form/tax remittance scheme as it seems the most likely. On the surface, this sounds like a "request payment" app, and little more. If confidentiality is a concern, then it takes diligent efforts to protect it and one ...


1

If I make this function without payable and don't take any money from the caller then return value accurately returns me the code. You are on the right track but misinterpreting what you see. I'll break it down. accurately returns me the code I think you mean returns(string memory). without payable Payable has nothing to do with it. You have to ...


Top 50 recent answers are included