Most Popular
1500 questions
28
votes
4 answers
What is the return of array.push() in Solidity?
I saw these code lines in cryptozombies.io:
uint id = zombies.push(Zombie(_name, _dna)) - 1;
zombieToOwner[id] = msg.sender;
I wouldn't have had a problem had there not been "- 1" after the push() function. I believe the return value of the push…
Kuelf Deez
- 576
- 2
- 7
- 15
28
votes
3 answers
How to check events in Truffle Tests?
What's the best way to check that events were fired in a Truffle test?
nickjm
- 865
- 1
- 7
- 18
28
votes
8 answers
Source code formatter for Solidity?
Most programming languages have tools to format source code according to convention: for example, Python has autopep8 and yapf, and Go has gofmt.
Does a similar tool exist for Solidity source code, ideally according to the Solidity Style Guide?
Pi Delport
- 401
- 4
- 8
28
votes
1 answer
What is the cheapest hash function available in solidity?
AFAIK there are 3 hash functions to choose from in solidity (sha3, sha256, and ripemd). sha3 is native while the others use precompiled contracts.
Which one of these is cheapest (in terms of gas)?
Akhil F
- 1,928
- 3
- 19
- 29
28
votes
2 answers
How do you delete/remove/hide contracts from Ethereum Wallet (aka mist)?
I have tons of experimental contracts I created as part of doing tutorials which I no longer need. I know I can kill the contract (from https://www.ethereum.org/greeter tutorial) but that still leaves the contracts grayed out.
Makoto
- 481
- 1
- 4
- 7
28
votes
1 answer
What is the difference between web3.eth.sign, web3.eth.accounts.sign, web3.eth.personal.sign functions?
Which function should be used to sign message locally? Which function is the most secure?
user652061
- 473
- 2
- 5
- 9
28
votes
6 answers
truffle has not been deployed to detected network
Is it possible to referer to a contract that has been deployed with
Contract.new() with Contract.deployed() ?
When referencing .deployed() in my test it throws :
has not been deployed to detected network (1501794786154)
Obviously the code has been…
trutest
- 351
- 1
- 3
- 3
28
votes
1 answer
Is searching data stored in event logs prohibitively slow?
Augur uses event logs to store data that never needs to be accessed on-contract, since it is about 10x cheaper than on-contract storage. However, I've noticed that retrieving event logs (e.g., using eth_getLogs) takes significantly longer than…
tinybike
- 535
- 5
- 10
28
votes
7 answers
Truffle deployment on test network says: Error: exceeds block gas limit
I'm trying to deploy a sample contract (following this guide) but I'm receiving an error of not enough gas. I changed the numbers a little but could not fix it. I saw this question in stack exchange but there are few things I don't understand in the…
Bush
- 455
- 1
- 4
- 6
28
votes
1 answer
Cannot perform write functions in smart contract - invalid address?
I have the following simple smart contract...
contract SimpleStorage {
uint storedData;
function set(uint x) {
storedData = x;
}
function get() constant returns (uint retVal) {
return storedData;
}
}
Which I…
billett
- 1,255
- 1
- 12
- 18
28
votes
3 answers
How many nodes are there on the Ethereum network?
When looking on the Ethereum Network Status site, only a limited number of nodes are listed. How can I discover how many nodes there are currently running in total?
J-B
- 8,941
- 16
- 46
- 77
28
votes
2 answers
How do I know how much gas to use when calling a contract?
When I am calling (sending a transaction to) a contract how do I determine how much gas to use? Is there a way to calculate this upfront & what happens if I send too much / too few gas?
J-B
- 8,941
- 16
- 46
- 77
28
votes
1 answer
How is the Mining Difficulty calculated on Ethereum?
Having read various pieces of documentation, it's still not completely clear to me what dictates the difficulty rise, and how Ethereum difficulty levels differ to Bitcoin.
In the past week difficulty has jumped from around 11 to over 17, whilst…
Ben Vickers
- 475
- 1
- 4
- 8
28
votes
4 answers
Solidity: Can you return dynamic arrays in a function?
I know I can return dynamic byte arrays in Solidity, such as in the following code:
function createMemoryArray(uint size) returns (bytes) {
// Dynamic memory arrays are created using `new`:
uint[2][] memory arrayOfPairs = new…
user9402
28
votes
4 answers
Possible to store the blockchain in a different directory?
I'm running geth on Linux within a Chromebook. The blockchain is being stored within ~/.ethereum, along with other important files. Problem is, the storage capacity on my Chromebook is quite limited so it is difficult to keep the data under the user…
FugueWeb
- 457
- 1
- 4
- 9