Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

23

From Solidity - Binary Packages: brew update brew upgrade brew tap ethereum/ethereum brew install solidity


20

You're hitting a StackTooDeepException. The Solidity code doesn't appear to be consistent in the number of variables it sees as a problem, but you've got a limit of around 16 or 17. (Though clearly the lower limit of 16 will be the one that kicks in...) CommonSubexpressionEliminator.cpp and CompilerUtils.cpp: assertThrow(instructionNum <= 16, ...


20

The thing was that my mapping was public, and there are no public accessors implemented for it yet. The solution is just to not declare the mapping as public.


18

Not true in the OP's case, but a cause of this problem is missing a semi-colon from the first line specifiying compiler version, e.g.: pragma solidity ^0.4.6;


15

Mist / Ethereum Wallet now has a built in compiler that is not very well document beyond screenshots in the tutorials in order to create, compile, and deploy contracts. However, the version of Mist's compiler and whether or not it is optimized is...hard to figure out. Go to the Mist releases page. Click on the release you are using. ie: 0.5.2 Click "CODE" ...


15

I deployed a contract using web3js sometime back and I faced the similar problem, I fixed it by defining all dependent contract in an input object and then compiled it. You can take a look at this code for reference - https://gist.github.com/inovizz/1fdc2af0182584b90008e0cf2895554c Hope this helps.


13

TL;DR bin-runtime is the code that is actually placed on the blockchain. The regular bin output is the code placed on the blockchain plus the code needed to get this code placed on the blockchain, the code of the constructor. Longer answer The basics of the Ethereum Virtual Machine is defined in Section 9.1 of the Ethereum Yellow Paper. To answer this ...


10

This is the Swarm hash. It is documented at https://solidity.readthedocs.io/en/develop/metadata.html Extract follows Contract Metadata The Solidity compiler automatically generates a JSON file, the contract metadata, that contains information about the current contract. It can be used to query the compiler version, the sources used, the ABI ...


9

If you have installed through npm install -g solc Here's how you use it. solcjs --version


9

Currently etherscan does not support verification of multifile contracts. But there is discussion on etherscan's reddit about this issue. Concatenating files into one worked some time ago, but since version 0.4.7 Solidity includes hash of contract's metadata at the end of compiled contract. As this metadata contains file names and hashes, you may get the ...


8

Jumps to invalid jump destinations are generated only for (explicit or implicit) exceptions. An explicit exception is when you use the keyword throw. Implicit exceptions happen for runtime errors: array access out of bounds failed sub-call (due to any reason reported by the EVM including invalid jump dest in the sub-call) ether sent to a library fallback ...


8

Something you are looking for is here How to map EVM trace to contract source?. As for me for development purposes I use requireDebugModifier from code below, for production I change requireDebugModifier to requireModifier. contract DebugEvents { event Debug(string message); modifier requireDebugModifier(bool arg, string message) { if (!...


7

I believe this is just a bit mask. The code loads the call data, shifts it to the right, and then does a bitwise AND with 0xFFFFFFFF to get the (now) bottom four bytes (the function selector). Then it compares the four bytes extracted with the known function selector. It doesn't matter that the function signature you're looking for happens to be 0xFFFFFFFF....


6

The problem is solc is not installed on your pc. get it installed through sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc or you can go here


6

There are many cases when the gas estimator reports infinite gas. However, it doesn't necessarily mean that there is an infinite loop in your code or that your code is incorrect but just the estimator is quite restrictive when making decisions about how much gas can be consumed by the code. In particular, any backward jumps or loops in the assembly code will ...


6

I am not sure if your abi is correct.But I am writing the way of interacting with smart contract and generating abi from source code. Generating abi from Source code: Paste your code in remix-online solidity compiler. Click on start to compile to compile your code. If your code is compiled successfully. CLick on Details tab on upper right corner You will a ...


6

Here is more information about storing data in solidity https://solidity.readthedocs.io/en/latest/introduction-to-smart-contracts.html#storage-memory-and-the-stack Those variables, which you defined, will be stored in stack(if there is a space and you keep them in one function). in case if compile will optimize it properly it will be for free, if not, each ...


5

Array Out Of Bounds contract InvalidJump { uint[5] data; function invalidJump1() { uint i = 6000; data[i] = 1; } } And the message is from debug.traceTransaction(...) is: error: "invalid jump destination (PUSH1) 2" (Somewhat Related) Stack Limit Reached 1024 Not what was asked in the question, but interesting anyway. contract ...


5

Depending on your Ethereum Wallet version, the compiler version is different as well. For the latest ones, you should select this version on Etherscan : v0.2.1-2016-01-30


5

seems that if semicolon is removed, it works. Contract should look like: contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } function test() { choices = ActionChoices.GoStraight; } function getChoice() returns (uint d) { d = uint256(choices); } ActionChoices choices; }


5

I solved this by installing solc with apt-get like sudo apt-get install solc Then I typed which solc and it told me it was installed at /usr/bin/solc. So I fired up geth console and used the command admin.setSolc('/usr/bin/solc') to point to the path. Then it worked.


5

There are several ways you can run Ethereum: PyEthApp Python version GoEthereum Go Version (Probably the most popular) EthereumJ Java version Web3 umbrella C++ version All of the above are developed under the Ethereum project an have detailed installation instructions. So I think it really depends on what you want/need. If you're trying to get a sense of ...


5

Compile it using the latest solc version at http://chriseth.github.io/browser-solidity/. If you don't get good output, then you have a bug you can file with the solidity folks. I had a segfault back in January, upgrading to the latest version of Solidity fixed it. Thanks to the advice on the gitter thread, which was "try browser-solidity and report back",...


5

Strings are allowed as keys in mapping. For example, this code works just fine testing in Pyethereum: from ethereum import tester as t code = ''' contract Example { struct Person { string name; } mapping(string => Person) map; function setName(string name, string value) { map[name] = Person({name: ...


5

At least it should be deterministic. We eliminated some sources of non-determinism in May, so it now should always produce the same result on the same input, even on different platforms. If that is not the case, please report a bug.


5

I solved my problem by RTFM. Mac users should install using Homebrew. From Installing Solidity brew update brew upgrade brew tap ethereum/ethereum brew install solidity brew linkapps solidity If you need a specific version of Solidity you can install a Homebrew formula directly from Github.


5

As of Solidity 0.5.0, there are two different address types in solidity: address and address payable. You can only transfer funds to an address payable. Therefore, your problem will be fixed by making admin an address payable: address payable admin;


4

Right now there is no real easy way. I am trying to figure it out myself ;-) When you are running a developer version in electron, you can always go to the folder running the mist code and type: node which then takes you to a node terminal where you can check your solidity version: var solc = require('solc') solc.version() > '0.2.1-91a6b35f/.-...


4

This seems to be a bug in the compiler. Issue created: https://github.com/ethereum/solidity/issues/368 Thanks for reporting!


4

Summary Segmentation fault with solc version 0.3.2-7a51852a/Release-Darwin/appleclang/JIT , fixed with later updated version. UPDATE 26/06/2016 This is a bug in the Solidity compiler. Here is a quick test: user@Kumquat:~$ echo '' | solc Unknown exception during compilation. See eth.compile.solidity fails with solc version 0.3.5 #2703, which links to ...


Only top voted, non community-wiki answers of a minimum length are eligible