Most Popular
1500 questions
27
votes
4 answers
Why does a Solidity throw consume all gas?
When you throw an exception, all gas is consumed. What is the rationale for this design decision?
Peter Hall
- 625
- 5
- 13
27
votes
2 answers
What does _ (underscore) do?
Browsing through the Ethereum docs I came across this modifier:
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
I am not familiar with usage of _. What does it mean in this context?
nipponese
- 598
- 1
- 5
- 11
27
votes
14 answers
Truffle Webpack starts with error: MetaCoin has not been deployed to detected network
I seem to have followed the truffle guide to a T. But when I open my app in a browser for the first time, I'm getting this error in the console:
Error: MetaCoin has not been deployed to detected network (network/artifact mismatch)
I'm brand new to…
Daniel Patrick
- 393
- 1
- 3
- 8
27
votes
6 answers
How to compile Solidity contracts with Geth v1.6?
I tried to compile the following contract within geth:
pragma solidity ^0.4.8;
contract Test {
uint256 public value;
function Test() {
value = 123;
}
}
using the following commands on the flattened source:
> var testSource…
BokkyPooBah
- 40,274
- 14
- 123
- 193
27
votes
5 answers
How to listen for contract events in JavaScript tests?
I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught.
That's the relevant contract code:
pragma solidity ^0.4.4;
contract CrowdFunding {
uint…
Mindful
- 393
- 1
- 4
- 12
27
votes
1 answer
Create a two-dimensional array in Solidity
How to create arrays addresses using solidity? And we can write two-dimensional array?
bool[2][] m_pairsOfFlags;
Here is an example of the array, but it does not work
M.Sheremain
- 511
- 2
- 6
- 10
27
votes
5 answers
Paying a transaction fee with an ERC20 token
As far as I understand, one of the ERC20 token's features is that you can pay a transaction fee with it. In other words, you can send them without having Ether. I transferred REP tokens to the exchange and back without using Ether on that exchange…
tomo
- 351
- 1
- 3
- 6
26
votes
4 answers
How to unit test smart contracts
How are Ethereum contracts tested? I've seen Truffle which referrers to itself as an Ethereum development framework. Are there any other frameworks and what is their level of maturity? Is there a de facto standard framework used by most contract…
hcvst
- 2,018
- 2
- 21
- 24
26
votes
4 answers
How to fill dynamic in-memory array
For some reason solidity doesn't allow to push values into memory array
Member "push" is not available in bytes32[] memory outside of
storage.
Here is sample contract code:
pragma solidity ^0.4.21;
contract Foo {
function getRange(uint n)…
Alex Zhukovskiy
- 491
- 1
- 5
- 14
26
votes
6 answers
What is address(this) in solidity?
As per my understanding contract`s own address is the address which we assign to owner of contract using msg.sender.
But I saw this question on SE where it was described that a contract can access its own address using address(this) , but when i…
Anam Nizami
- 885
- 1
- 8
- 21
26
votes
4 answers
Can't do any integer division
I'm building a new smart contract but really can't figure out how to perform integer division. I know that fixed point numbers haven't been implemented yet but it should be possible to perform 100/3 = 33, at least.
I hope someone can help me. I have…
Hugo Moreau
- 263
- 1
- 3
- 4
26
votes
6 answers
How do you sign an verify a message in javascript proving you own an Ethereum address?
Is there a js library or even just pure js where I can sign and verify I own an Ethereum address?
Patoshi パトシ
- 4,800
- 7
- 45
- 93
26
votes
2 answers
Understanding logs and log blooms
I'm new to Ethereum and I'm struggling to understand how logs are stored and can be read using geth and plain JSON-RPC (not web3.js). There's a bit of documentation out there and some posts but I'm looking for a more plain English explanation.
So…
migu
- 941
- 2
- 10
- 18
25
votes
7 answers
How to find all ERC721 compliant NFTs owned by an address? (Web3 JS)
It is possible to check which address owns a particular NFT by using the ERC721 standard function:
function ownerOf(uint256 tokenId) public view virtual override returns (address) in ERC721.sol
But I would like to know all NFTs owned by a particular…
Oscar Chambers
- 848
- 1
- 9
- 21
25
votes
2 answers
E/Go: fatal error: thread exhaustion
I am experimenting with the geth-android library with light-client and in-process node from @karalabe. I could successfully sync with the testnet node from @phonikg, unfortunately this one is down now. When trying to sync with the main-net I am…
ligi
- 1,183
- 9
- 28