Most Popular

1500 questions
40
votes
4 answers

Is CPU mining even worth the Ether?

I would like to start mining Ether, but my GPU isn't the greatest and I don't really want to spend the money on a dedicated rig. Is mining from my CPU (in a Linux environment) still worth the Ether? Or will I not be able to keep up?
Donavan Theodor
  • 1,943
  • 3
  • 20
  • 28
40
votes
1 answer

How to delete an element from a mapping?

I have a mapping like this: struct data { string name; string nickname; } mapping(address => data) public user; What is the correct way to delete one element from the variable user? Do I only have to call delete(user[address]) or do…
Bumblebee
  • 1,751
  • 3
  • 14
  • 23
40
votes
3 answers

What was the reason to invent the EVM?

What was the reason to invent the Ethereum Virtual Machine (EVM)? Why not use an existing virtual machine like the Java-VM. The big advantage would be that the existing toolsets for Java development could be used.
mKoeppelmann
  • 7,616
  • 8
  • 36
  • 48
40
votes
5 answers

Ropsten testnet is under kind of attack? What can we do?

For the last approximately 24 hours, Ropsten testnet is under an attack in my opinion. The gas limit is raised to 200m and the attacker was proposing blocks with more than 4,000 internal txs transfering 1 wei to different addresses. Mining reward is…
vutran
  • 802
  • 10
  • 15
40
votes
3 answers

Difference between Memory and Storage?

What is the difference between Memory and Storage ? From both the EVM point of view and the contract design one. Thanks!
Hcharlanes
  • 1,135
  • 1
  • 11
  • 10
40
votes
2 answers

What is the difference between bytes and bytes32?

I know bytes32 stores 32 bytes, but what does bytes store? And what is the difference between the two?
cryptorenaisance
  • 593
  • 1
  • 6
  • 8
39
votes
1 answer

Ways to see if address is empty

Is owner > 0x0 a good way to test if an address owner was set in Solidity? I am not sure if this could break something in the future and if there are better ways to see if the address was set. What is the best solution?
Roland Kofler
  • 11,638
  • 3
  • 44
  • 83
39
votes
6 answers

How to get ether on public testnet?

I am a newbee to Ethereum and doing some research. I have installed the Ethereum Wallet app and synchronized the testnet. However, to deploy my first contract in testnet, it requires some Ether, so can someone guide how to get that? I have tried to…
Sanjeev Azad
  • 391
  • 1
  • 3
  • 5
39
votes
7 answers

How to convert a uint to bytes in Solidity?

Is there an easy way to convert a uint to bytes in Solidity?
eth
  • 85,679
  • 53
  • 285
  • 406
39
votes
2 answers

Why do Solidity examples use bytes32 type instead of string?

In many Solidity examples I read that use strings for parameters or return values, I see they are typed as bytes32 although there's a string type. What is the real reason for that? Thanks.
Nicolas Massart
  • 6,783
  • 2
  • 29
  • 63
39
votes
5 answers

Returning a struct and reading via Web3

I am storing data in my contract using a mapping of structs. For examples sake, say I'm storing employee info (name/address/salary), mapped by their employee ID. Via a web front-end, I'd like to be able to specify an employee ID, and call a…
Amer Ameen
  • 825
  • 2
  • 8
  • 8
39
votes
2 answers

Is each Ethereum address shared by (theoretically) 2 ** 96 private keys?

Summary This is an extended question to How are ethereum addresses generated?. In Ethereum, a private key is 256-bit long, but an address is only 160-bit long. By "Pigeonhole Principle", it guarantees that some unique private keys map to the same…
38
votes
2 answers

How can you call a payable function in another contract with arguments and send funds?

I have a contract named Call: contract Call { ... function () payable { // TODO: Call the call function in the main contract // and forward all funds (msg.value) sent to this contract // and passing in the following data: msg.sender …
Pabi
  • 1,129
  • 4
  • 11
  • 18
38
votes
4 answers

Why are there two methods encoding arguments? "abi.encode" and "abi.encodePacked"

When we call a function on an external contract, the EVM computes a bytes buffer which contains the function signature and arguments. There are two ways to serialize arguments: abi.encode() abi.encodePacked() The differences between the two…
Bob5421
  • 1,457
  • 1
  • 12
  • 38
38
votes
14 answers

Source File requires different compiler version

I am using solidity version "pragma solidity ^0.4.20;". When I checked JSON files of contract, compiler version shows : "compiler": { "name": "solc", "version": "0.4.21+commit.dfe3193c.Emscripten.clang" } Still I am getting error…
angelmaria
  • 1,061
  • 1
  • 13
  • 25