Questions tagged [solidity]

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

Filter by
Sorted by
Tagged with
2
votes
2answers
2k views

Attaching an address for a contract to call another contract

I am writing code where I want to call other contracts within my current contract. Bank.sol contract Bank { address owner; mapping (address => uint) balances; function init() ...
34
votes
5answers
21k views

How to concatenate strings in solidity?

I'm trying to concatenate two strings in solidity. I tried with + or . but neither option works. There is not much documentation on string concatenation yet. Is it even possible? If not, can I ...
4
votes
2answers
671 views

Why isn't my contract getting a msg.sender? (solc 0.2.0-1)

TL;DR: Second's msg.sender isn't being set when it should. Consider these two contracts: First.sol: import "Second.sol"; contract First { address public second; function First() { } ...
23
votes
1answer
8k views

How can I verify a cryptographic signature that was produced by an Ethereum address key pair

If I have a cryptographic signature from an Ethereum address key pair, how can I verify that signature?
23
votes
1answer
2k views

How does the solidity optimizer work?

The compiler for solidity supports the flag --optimize which performs some set of optimizations to the compiled solidity code, typically resulting in a reduction of gas costs. How does the optimizer ...
12
votes
2answers
5k views

What does a “bad JUMPDEST” error mean?

When I send a transaction to call my contract, it's causing a bad JUMPDEST error. The Ethereum wiki says this error is caused when a JUMP instruction jumps to a location that wasn't marked as a jump ...
8
votes
1answer
453 views

How to handle library function prototype changes?

One great thing about using a library is that the library code can be modified, and as long as the api function prototype stays the same, all we need to do is point to the new address of the updated ...
18
votes
2answers
15k views

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?
25
votes
2answers
9k views

'internal' keyword in a function definition in Solidity

Does the internal keyword in a function definition such as: function doSomeThing(uint _param) internal {...} work similar to designating a method as private in other languages and thus makes the ...
3
votes
1answer
805 views

Getting a solc error: uint176 - Identifier not found or not unique

I'm working on an "Infosphere" contract, an arbitrary key/value store any individual or contract can use. You can take a look at it here: https://github.com/SafeMarket/dapp/blob/...
12
votes
1answer
5k views

How to write my first Solidity “Hello World” smart contract?

I have never written a smart contract before because there is a lot attached to it getting it working. But I finally want to learn it now. I want to write a simple mininmal working smart contract ...
20
votes
2answers
6k views

Why aren't Solidity sha3 hashes not matching what other sha3 libraries produce?

Solidity has a function named sha3 and I tested it with an empty string input. It is not matching what other sha3 libraries produce. I see contracts written by others using the same sha3 function ...
9
votes
1answer
704 views

How to avoid/detect multiple internal transaction out-of-gas side effects?

Following an issue I opened in github, this bothers me. The operation described in the issue, which happened during following avsa's tutorial on creating a DAO, generated two internals transactions as ...
10
votes
1answer
702 views

Why are contracts limited to only the previous 256 block hashes?

Why are contracts limited to only the previous 256 block hashes using the BLOCKHASH opcode (and corresponding functions in Solidity and Serpent)? Why does another contract, such as this, need to be ...
5
votes
1answer
325 views

Is there available source code for the Ethereum parser (JS/Solidity or Python/Serpent?

I've tried looking at the source code, but I'm unfamiliar with the structure. I can't seem to find a parser module or source code. I'm attempting to understand the parser and perhaps write one from ...
25
votes
6answers
4k views

What are common pitfalls or limitations when coding in Solidity?

What would be on your list to warn other developers about? What works in most other languages that does not work, or behave as expected, in Solidity? For example only: what parameters can be passed ...
13
votes
1answer
1k views

How was Solidity conceived and what design tradeoffs were made when building it?

Solidity is a new language designed specially for writing Ethereum smart-contracts. As compared with Serpent, which is an extension to Python semantics, Solidity is completely new and borrows ...
48
votes
7answers
7k views

How can I verify that a contract on the blockchain matches the source code?

Given the (Solidity) source code of a smart contract, is there a way to deterministically compile the code and compare it with the code on the blockchain? I want to verify that the contract does what ...
53
votes
5answers
13k views

How can you decompile a smart contract?

On the blockchain I can inspect the code of a contract, and see the EVM opcodes. Is there a way to decompile this and convert it back to (Solidity) source code?
21
votes
3answers
5k views

Fundamental limitations between Solidity and Serpent

Solidity can be considered a "higher level" language than Serpent. Are there any "low level" features in Serpent or that could be implemented in Serpent, that are either impossible or infeasible to do ...
7
votes
1answer
434 views

What's the limitation that requires Solidity array dimensions to be declared backwards?

From docs: In Solidity, array dimensions are declared backwards from the way you might be used to declaring them in C or Java, but they are access as in C or Java. For example, int8[][5] ...