New answers tagged

0

First, add "web3": "1.2.1" to your package.json file and run npm install (or simply run npm install web3). Second, try the following node script: const Web3 = require("web3"); async function run() { const abi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}...


0

It is the sender's responsibility to know their account nonce. You can't inspect the node for pending transactions as a substitute for tracking account nonce-not reliably. Generally, a wallet keeps track of the nonce so the user doesn't need to worry about it. You need to be aware of a few details to reliably send transactions at scale. See this answer ...


1

The CREATE2 is a new opcode introduced in the Constantinople update earlier this year. It's otherwise similar to the traditional CREATE opcode which creates a new smart contract but with CREATE2 you can more freely influence the resulting contract address - for example to create a contract to the same address where another contract existed earlier (but which ...


0

It solved by updating truffle version.


0

Well it's a decentralized world. There is no "official" way of doing things. It's also probably quite difficult to know what format "most" wallets support (if any). I was reading through the EIP67 and it's not obvious whether the value should be in Ethers or Weis. A comment here suggests weis: https://github.com/ethereum/EIPs/issues/67#issuecomment-...


0

I couldn't find any decent official specification, but Coinbase generates QR code in such format: ethereum:0xaaaaaaaaaaaaaaaaaaaaaa?value=500000000000000 where value is in Wei and not ETH (1 ETH = 1,000,000,000,000,000,000 Wei).


0

Web3 has been updated since @Vanja Dev's answer var tokenInst = new web3.eth.Contract(tokenABI,tokenAddress); tokenInst.methods.balanceOf('0x260c25f991171850f48889eb9d8aF11998D20c30').call().then(function (bal) { console.log(bal); })


6

At the point of writing this the supply of ether is still "infinite". Every 15 seconds two new Ether are generated. Currently we are at 107,682,753.47 Ether. These are from: Genesis (60M Crowdsale 12M Other): 72,009,990.50 Ether Mining Block Rewards: 33,168,789.59 Ether Mining Uncle Rewards: 2,503,973.38 Ether The change to PoS got delayed a few times ...


0

getsourcecode Etherscan API endpoint returns the name of a contract. You can find the description of the endpoint here: https://etherscan.io/apis#contracts https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken It returns `` in the resulting JSON: { "...


1

I found the answer at etherscan. It is currently ~173GB.


1

Send a message to a user. It depends on what you mean by "send a message" and "to a user". If you mean SMS, Email, push notification, etc., then no. This is because a fundamental limitation is that contracts can have only very limited interaction with the outside world. Users sign transactions (input) Functions can return values to other contracts (...


0

Ganache does not support personal_signTransaction. The alternative is to unlock the personal account then sign the transaction: web3.personal.unlockAccount(addr, pass); const toAddress = "0x....; //address of the recipient const amountToSend = web3.toWei(2, "ether"); //convert to wei value var send = web3.eth.sendTransaction({from:addr,to:toAddress, value:...


2

I'm assuming you would like to send a message along with a transaction that goes to a "normal" account, not a "smart contract" account. Maybe even from a "normal" account as well. What you can do is convert your text message to hex, using any online converter, for example this one. Most wallets have a data field for a transaction, where you then paste the ...


1

The data field is used especially when calling functions in contracts - all the data (called function name and arguments) go in that field. So your contract can simply call a function in another contract with parameters - assuming the function accepts such parameters. So contracts take in extra data but calls to EOAs (Externally Owned Account) don't take ...


0

The original chain would still work as long as there are still miners but since there is barely anybody using it, it would be worth close to nothing. 1) To achieve "chain consistency" the fork needs to be popular with users to stop them from just staying on the old network. Let me know if you need clarifying.


1

By default all full nodes contain every single contract and transaction on the Ethereum network. I don't know how you would filter only contracts though and there would also be far to many contracts to check them all. Mabye you could make a system where a user would post about a smart contract instead of reviewing one.


3

You can do this by querying the blockchain directly instead of using your web scraper. For this, you would need to run a node and check each block's transactions to see if the associated addresses are contracts.


3

Fallback function in Solidity is provided only 2300 gas to get executed successfully. As a result, inside a Fallback function, the operations like sending ether, deploying contracts which consume more gas than 2300 gas cannot be performed. In contract A, fallback function accesses block number and saves it only. So it works well. But in case of contract B, ...


0

Another way to check is if you also have the public key of the ethereum address. The Ethereum Foundation's official eth-keys Python library can be used, and is now part of their Github repo and can be seen here and contains a suite of tools that include ways to check address validity, such as using the PublicKey().checksum_address() method (see below example)...


Top 50 recent answers are included