Most Popular
1500 questions
30
votes
4 answers
How to get return values when a non view function is called?
I am writing below a simple contract which stores all results of questionnaires for each ID.
contract answer{
mapping(address => mapping(string => bool)) voters;
struct qList {
uint count; //The number of respondents
mapping(address =>…
A. Take
- 425
- 1
- 4
- 10
30
votes
6 answers
How to make miner to mine only when there are Pending Transactions?
As of now the geth miner running on my system mines even empty blocks.
All i wanted is miner should mine only when there are Transactions to mine, after mining the miner should immediately sleep.
How to achieve this?
Subhod I
- 927
- 1
- 9
- 18
30
votes
2 answers
What is uint256?
With regard to Solidity, What is UINT256?
From the token example at https://ethereum.org/token :
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
Beyond being a variable type in general computing, I'd…
Bruce Seymour
- 438
- 1
- 4
- 9
30
votes
4 answers
How to programmatically detect and accept ETH and ERC20 deposits
I'm looking to replicate the functionality provided by cryptocurrency exchanges such as Kraken and Poloniex when it comes to depositing ETH and tokens. Namely:
Users can generate and send funds to one or more deposit addresses for ETH, EOS, OMG,…
Bill B
- 451
- 1
- 4
- 6
30
votes
6 answers
Solidity: How can we write a error message in "require"?
Im learning Solidity. As far as I'm aware, it's recommended using "require" to handle errors. But, I'd like to inform the users about the kind of errors they make, e.g. an argument is invalid or out of range, etc.
Question: How to write a error…
Aydin
- 2,117
- 6
- 25
- 41
30
votes
1 answer
How to convert string to bytes32 in web3js?
I have a contract with a public variable that's bytes32. If I enter the value 20160528 then it auto converts to bytes32. Is there anyway to convert it back from the nodejs terminal? I've been trying
web3.toAscii(testInstance.Date.call())
but…
thefett
- 3,873
- 5
- 26
- 48
30
votes
2 answers
web3.js execution - server vs browser
I'm a little bit far from web development, so I have one misunderstanding.
As far as a know, node.js code should be run at the server-side, and web3.js is designed to work at the server side (not sure) because it uses directive "require" and…
Alexey Barsuk
- 2,259
- 2
- 17
- 25
30
votes
4 answers
What is the purpose of "unchecked" in Solidity?
According to Solidity documentation:
Prior to Solidity 0.8.0, arithmetic operations would always wrap in
case of under- or overflow leading to widespread use of libraries that
introduce additional checks.
Since Solidity 0.8.0, all arithmetic…
Alexander Herranz
- 1,858
- 2
- 17
- 35
29
votes
3 answers
Which database(s) do the ethereum clients use and why?
Ethereum clients (such as geth, eth, pyethapp, ethereumj, and ethereumH) download the Ethereum blockchain from their peers and then store a copy of it locally, presumably indexed within some sort of database for efficient lookup and retrieval. …
Jeff Coleman
- 22,059
- 17
- 77
- 91
29
votes
1 answer
Stack too deep, try removing local variables
When I set more than eight values as function’s return , the following error occurred. ( When the num of values is less than seven, the error didn’t occur)
Could you tell me how can I get more than 8 return values by a function?
Code
struct …
Toshi
- 2,357
- 8
- 23
- 34
29
votes
7 answers
What are the differences between Bitcoin blockchain and Ethereum blockchain?
Ethereum has been debated in the bitcoin ecosystem and was criticized. In order to understand better both projects, what are the main differences between BTC and ETH regarding the blockchain composition?
nelruk
- 555
- 1
- 7
- 11
29
votes
2 answers
How can I return multiple strings from a contract function?
In solidity it's obvious how to get a single string returned from a function. But, I'd like to have the smart contract return multiple string values. Is there a way to do this?
Ethan Wilding
- 4,821
- 7
- 24
- 31
29
votes
2 answers
Can Solidity function modifiers access function arguments?
I would like to have a modifier that looks like this:
modifier restrictTargetType(uint contractType) {
if (contractTypes[target] != contractType) { throw; }
_
}
Where target is an address passed as a function argument. Simply naming the…
PeterBB
- 615
- 1
- 6
- 11
29
votes
3 answers
How do gas refunds work?
Gas refunds are provided when clearing storage or calling SELFDESTRUCT on contracts.
The Yellow Paper mentions that refunds are "being capped up to a maximum of half...". What exactly is this "half" and the other components that sum up to a refund?…
eth
- 85,679
- 53
- 285
- 406
29
votes
2 answers
Is there a way to stop the Geth console from printing syncing information?
Is there a way to stop the Geth console from printing syncing information?
I start Geth with geth console.
Actually, I do not want to see all that syncing information constantly. Can I turn it off somehow without using geth attach?
Vesa
- 1,322
- 2
- 16
- 30