New answers tagged

0

Normally you cannot buy a token via etherscan. If you are referring to a vanilla ERC20 token, you can only purchase them via an exchange (decentralized or decentralized), peer-to-peer, or through crowdfunding. The eth spent to acquire the token will go to liquidity provider (in case of dencetralized exchanges) or other traders, which could be members of the ...


0

Try calling the createLottery function once in your tests. Without doing that, the return value for getDeployedLottery() would be an empty array, which is a falsy value, so assert.ok would fail.


0

From a development standpoint, Python has fewer keywords than C and C++. Python also has an easier syntax whereas C is more difficult to write. But from a performance standpoint, Python is slower than C as it takes significant CPU time for interpretation. So, speed-wise C is a better option. You can imagine that this is important in a miner that would like ...


0

Geth also supports a feature called static nodes if you have certain peers you always want to connect to. Static nodes are re-connected on disconnects. You can configure permanent static nodes by putting something like the following into <datadir>/geth/static-nodes.json: [ "enode://...


0

If you want to cancel a transaction, don't use +1 Nonce value. Actually replace the nonce value to the nonce value of the transaction you want to cancel. EX. If the stuck transaction's nonce value is 5; then create a new transaction sending 0 ETH to yourself, but customize its nonce to be 5 as well.


0

Assuming you're using EVM compatible blockchain, you can interact with any deployed tokens on the network if you have the token ABI (if it's just simple ERC20 token you can use ERC20 abi) and the contract address. If you want to allow your contract to call another token, first include the token contract interface in your code, initialise a token contract ...


0

Meta transactions are a tricky topic for beginners but kudos for going for it. OpenZeppelin is no longer maintaining Gas Station Network. Check opengsn documentation for latest version. Github: https://github.com/opengsn/gsn/releases Best of luck.


0

After search couple hour I found some idea for accepting ether payment. First of all I need to create new account/address for every payment request where user can send ether and then poll the account balances until the desired amount is received. Once amount is received then it send to master account.


0

I've used web3 API inside of the test file to convert the value into the value that I was expected. web3 API already embedded globally inside of truffle test file. I just need to utilize web3.utils.toWei to convert 100 ether into Wei, and then convert Wei into BN by using web3.utils.toBN, then perform the assertion. it("test", async () => { ...


0

You can't do that, that's 2 separate transactions, you'll have to pay the gas fee for each one.


0

There isn't a single "master Ethereum World State Trie", as said by KFitcher a copy is contained in every full node that participates in the Ethereum network. The current "Ethereum World State Trie" can be constructed by executing all the transactions that were executed in the blockchain, so anyone with a copy of the blockchain could be ...


1

Every full node in the Ethereum network holds a copy of the Ethereum state. So to answer your question literally, it's physically located in the storage (SSD or NVMe commonly) of any full node in the Ethereum network.


0

if someone only send ERC-20 token to the address and no etherum, then how I'll get ethereum to pay as gas fee to transfer the received ERC-20 token to cold wallet You buy ETH and deposit it on the address needing ETH. means if 10000 users do the same thing at the same time, will not it create a problem ? or is there any better solution for this ? Yes. ...


1

Let's look at firstly what is a transaction on Ethereum. A transanction is: State changing. What does it mean? You have an address on evm. And it keeps your balance. You are changing this balance (which is a variable) in thousands of computers. And you are paying gas those guys to process and keep your balance. So, your answer is: Yes. Even if you send 1000 ...


0

It depends on what asset or event you are trying to check. Assuming you have an ERC20 token you want to use to grant access, the basic principle you may want to follow is: Make website unavailable by default and request user exposes their Metamask account. You can use below command. ethereum.request({ method: 'eth_requestAccounts' }) Once you have access ...


1

STF is safe transfer from - double check that you are approving your contract to spend your wallet's tokens, and any other approvals possible.


0

BN will not accept decimal point numbers. You can do as follows: var decimals = 12; var value = (0.001*(10**decimals)).toString(); var amount = web3.utils.toBN(value); Hope this helps


1

Contract accounts can't initiate any transaction on their own. You can program a contract to deploy another contract or a set of contracts, but the initiation would always have to be triggered by an EOA. In the former example, that deployed contract would have a function responsible for deploying all those child contracts. The contracts would only be ...


0

You'll have to iterate the chain to do this as you only have the timestamp and the Etherscan API only has this service for PRO users I recently had to do this and I had to traverse the whole chain, to optimize it, I implemented a Binary Search algo that significantly reduced the time complexity async function getHistoricBlockByTimestamp(historicTimestamp, ...


0

No, unfortunately adding liquidity for the 1st time to a contract does indeed deploy a new UniswapV2Pair contract for which you have to pay the gas fee. And you indeed guessed right, embedding the pair creation in the token contracts constructor just shifts the cost of creating that UniswapV2Pair contract from the 1st liquidity adding to the token contract ...


1

It should be MATIC is an ERC20 token so the address should be the same.


1

You can set max fee with Edit button. Max fee must be lower than your balance. Because it is maximum gas you willing to pay. But if you don't have gas that you are willing to pay, of course It will give an error.


2

The base fee for a transaction is not the block base fee divided by the number of transactions in the block. Each transaction in the block has to pay at least the full base fee for that block, plus an optional tip (priority fee). To send all Ether from an account, you have to use the same max fee and max priority fee, so that the full difference between the ...


0

You wont be able to get it fast from anyone if you want it free. There are paid API services: Infura, Alchemy, Etherscan, etc. etc. etc. Free way: run an erigon node at home. And query that for whatever data you want. https://github.com/ledgerwatch/erigon


0

You didn't set Producer, but checking: require (Producer == msg.sender); Obviously Producer not equal to msg.sender. And Solidity reverting it. It is better to using require with error messages like: require (Producer == msg.sender, "You are not the Producer!"); So you can see where is the error.


1

In ethers, you can use the following: ethers.utils.defaultAbiCoder.decode(['address'], '0x0000000000000000000000002d4cffc2a90e28d90d3404a83bfd774294a3970a')


Top 50 recent answers are included