Most Popular

1500 questions
15
votes
5 answers

How to delete a mapping?

Fixed question: I have a mapping: mapping (bytes32 => mapping (bytes32 => bytes32[])) items; With some elements in it: items["fruits"]["apples"].push("first apple"); items["fruits"]["apples"].push("second…
Edward Ruchevits
  • 1,285
  • 2
  • 15
  • 24
15
votes
10 answers

How to convert an bytes to address in Solidity?

How to convert bytes or string (eg: 0xf2bd5de8b57ebfc45dcee97524a7a08fccc80aef) to address in solidity?
徐欢欢
  • 153
  • 1
  • 1
  • 4
15
votes
5 answers

getting error on max invalid genesis file: hex string has odd length

I am trying to create a genesis block on my mac for a local ethereum network but I am getting the error: invalid genesis file: hex string has odd length when i do it. My code is the following: { "nonce": "0x0000000000000042", "timestamp":…
tony
  • 165
  • 1
  • 1
  • 6
15
votes
5 answers

Hardhat vs foundry, which to use for testing?

I'm looking into smart contract testing and saw that Hardhat and Foundry are the main kits developers are using for testing. Are the two comparable when it comes to testing? Should I include both Foundry and Hardhat tests when testing my smart…
Nal Luksic
  • 1,127
  • 4
  • 17
15
votes
3 answers

Invalid sender error on private chain

I created a transaction in Go, signed it with a EIP155Signer signer, but when I try to publish the transaction through the Go client to the private blockchain, I get the error Invalid sender. Any idea what's happening here? This issue seems to have…
thanos
  • 844
  • 1
  • 8
  • 20
15
votes
1 answer

Solidity filling a struct-array containing itself an array

So, I want to fill an array of a struct residing in an array of another struct: ... struct Answer { bytes32 name; // short name (up to 32 bytes) uint voteCount; // number of accumulated votes } struct Question { bytes32 name; //…
tkdp
  • 185
  • 1
  • 2
  • 5
15
votes
3 answers

Testing for custom error reverts in hardhat

I have a custom error described as such: error AlreadyListed(address nftAddress, uint256 tokenId); And in my tests, I'd like to check to see that it's thrown: expect(await nftMarketplace.listItem(basicNft.address, TOKEN_ID,…
Patrick Collins
  • 11,186
  • 5
  • 44
  • 97
15
votes
5 answers

How do I know when I've run out of gas programmatically?

This keeps coming up on the gitter forums so I thought I'd ask and answer this question: How do you know when you've run out of gas?
Paul S
  • 4,271
  • 1
  • 22
  • 48
15
votes
3 answers

What's the difference between node and peer?

I'm confused between the two objects. As I know, peer is the object or node. But when we create an Ethereum network, at each node, I have to add a peer. So it means there is a difference between node and peer. Please help me. Thanks.
Jame H
  • 251
  • 2
  • 3
15
votes
4 answers

How to experiment with Ethereum without downloading the entire blockchain?

I want to experiment with Ethereum without having to download the entire blockchain. My ISP limits my bandwidth to 50GB and downloading the ETH chain would consume a lot of that, not to mention the time. Is there any SPV like implementation of…
Jus12
  • 356
  • 2
  • 12
15
votes
1 answer

Deploying contract with constructor arguments via Geth RPC

How can I deploy a compiled contract with constructor arguments using geth rpc? I have tested my call deployed the compiled contract bytecode just fine, I just don't understand how I can pass constructor arguments via an rpc call in the…
Samuel Barnes
  • 881
  • 10
  • 26
15
votes
3 answers

Solidity concatenate uint into a string?

How would I concatenate an integer into a string using solidity? For instance, say I have the following: uint myInteger = 12 How can I create the following string "My integer is: 12" with 12 being the value of myInteger. In other words have, "My…
Pabi
  • 1,129
  • 4
  • 11
  • 18
15
votes
1 answer

How does the estimation of gas price change after implementation of EIP-1559?

I understand that after EIP-1559 implementation, the fee structure changes to now have max priority fee and max fee instead of single gas price. The question is though what could be the best strategy to estimate these? In legacy transactions, we…
Prashant Prabhakar Singh
  • 8,026
  • 5
  • 40
  • 79
15
votes
3 answers

Contract's state after a Selfdestruct

What happens to the state of a smart contract when it is selfdestruct. Are the last state variables still visible on the blockchain afterwards?
RFV
  • 633
  • 7
  • 16
15
votes
2 answers

Truffle Migrations Account Locked Error with --network command

I have started a private blockchain using the command, geth --networkid 1337 --datadir ~/home/xyz/testnet --ipcpath /home/xyz/.ethereum/geth.ipc --rpc --rpcapi eth,web3 --rpcport 8545 --rpcaddr localhost --rpccorsdomain "*"; Next, in another…
godimedia
  • 253
  • 2
  • 6