We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [solc]

Questions related to the compiler for Solidity: solc

Filter by
Sorted by
Tagged with
29
votes
4answers
6k views

Error while compiling: Stack too deep

When trying to compile, I am getting the following error: "Internal compiler error: Stack too deep, try removing local variables." Is there any way around this? I'm not sure if I'll be able to ...
21
votes
2answers
7k views

How do I find out the solidity compiler version I am using?

Specifically, while using Mist. When I create a contract via the Mist GUI, I want to then be able to verify the source code over at Etherscan. However, Etherscan requires that you provide the ...
17
votes
2answers
2k views

Is there a way to disable a warning in solidity code? [duplicate]

I'm writing unit tests for some contracts and in some of the tests I'm generating a warning on purpose and solc will display this warning when compiling. Is there a way to disable warnings in solc ...
15
votes
2answers
2k views

Etherscan: How can I verify a contract with multiple imports deployed with Truffle?

When I deploy a contract with Truffle that has an import statement, and try to verify it on etherscan, my understanding is that I need to paste in the contents of the imported file. I get an error on ...
12
votes
1answer
399 views

How to generate sugared assembly code from Solidity code?

In the Solidity documentation I see a sample assembly code: { mstore(0x40, 0x60) // store the "free memory pointer" // function dispatcher switch div(calldataload(0), exp(2, 226)) case ...
11
votes
1answer
7k views

How do I install solc on Mac Osx? Error encountered “Error: No formulae found in taps.”

I'm trying to install a solidity compiler on my Mac. I've followed the guide here: https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial The error that I've gotten when installing ccp-...
10
votes
3answers
4k views

Internal compiler error: Accessors for mapping with dynamically-sized keys not yet implemented

I have a mapping(string => Person) public map: struct Person { string name; string description; address primaryAddress; string linkToWebsite; string ...
10
votes
1answer
148 views

Is it dangerous to name my function ccccvKygDv?

For those keeping track at home, the function hash of a function named ccccvKygDv() is 0xffffffff, the same as a null address. pragma solidity ^0.4.0; contract NullFunction { function ccccvKygDv()...
9
votes
1answer
2k views

Link solc with geth problem

After upgrading to geth 1.4.4 I am no longer able to from to reference the compiler from geth. The solc compiler is installed in /usr/local/bin but this is what I get when I check for available ...
8
votes
5answers
11k views

What is the cause of the error: Expected import directive or contract definition

I'm working on the tutorial at https://www.ethereum.org/dao and I'm getting the following error: 1:5: Error- Expected import directive or contract definition. function owned() { ^ When I get ...
8
votes
1answer
1k views

solc bin vs. bin-runtime

Solc says that bin-runtime is the runtime part of the contracts. What exactly is the runtime part and how does it differ from bin output?
8
votes
1answer
453 views

What is the cryptic part at the end of a solidity contract bytecode?

Given the following contract: pragma solidity ^0.4.11; contract Simple { bytes32 public v; function set(bytes32 _v) { v = _v; } } When disassembling, neither remix, solc or evm ...
8
votes
1answer
666 views

How to get a contract verified on etherscan?

I'm having a hard time getting a contract verified on Etherscan. I deployed the contract using Ethereum Wallet, I can effectively find it on Etherscan but when I copy-paste the exact same code to the ...
7
votes
2answers
1k views

All cases when Solidity compiles to invalid jump destination

Solidity generates EVM bytecode that leads to an invalid jump destination when: throw is used ... ? ... ? Can the above list be completed, with examples? To explain the first item, throw in ...
7
votes
1answer
293 views

Tracing back tripped require() to a source code line

What would be the process to map failed transactions (require, throw, etc.) back to the source code line where they occurred? Any examples of such yet?
7
votes
2answers
1k views

Infinite gas estimation from solc for simple function

Here is a simple Solidity contract: pragma solidity ^0.4.16; contract Test { uint[] array; function testGasEstimation() public { array.length = 1; } } Here is the output of ...
7
votes
3answers
929 views

Alternative to deprecated Greeter example code?

After loads of research, it seems the Ethereum.org Greeter example code no longer works. Here's the GitHub issues thread: https://github.com/ethereum/go-ethereum/issues/3793. There are some ...
7
votes
1answer
180 views

When did the Ethereum “free memory pointer” change? (6060… -> 6080…)

I have been digging a bit deeper into the Ethereum bytecode with the specific goal to do contract verification from the source code. I noticed, while doing some tests, that the initial bytes of the ...
7
votes
3answers
719 views

Source “<filename>” not found: File outside of allowed directories. [solidity/solc]

I'm using vim with the syntastic plugin. I'm getting this message: Source "zeppelin-solidity/contracts/token/StandardToken.sol" not found: File outside of allowed directories. [solidity/solc] when ...
7
votes
2answers
2k views

Unhandled rejection Error: Couldn't decode uint256 from ABI

I am working on using a sample Contract using NodeJS, Web3, and Solc but I encountered some error that the given address in the Contract that I've created couldn't decode. Am I doing something wrong? ...
6
votes
1answer
4k views

How to include solidity file into another?

I completely stuck on modules importing into Solidity contract. Here is my files/directory layout: . |-> contracts/ |-> contract1.sol |-> contract2.sol File contract1.sol contains only ...
6
votes
3answers
474 views

Solc Compiler oversight? Innappropriate mapping declaration overwrites storage

I have written a contract that has the mapping storage variable A & B. These variables get initialized with some values in constructor. A method getBalance returns the balance from mapping A & ...
6
votes
1answer
374 views

Getting segmentation fault while compiling solidity contract

Getting segmentation fault when compiling a simple contract on geth on OSX Yosemite web3.eth.getCompilers(); ["Solidity"] source = "contract test { function multiply(uint a) returns(uint d) { return ...
6
votes
1answer
527 views

Compiler Issue or Improper State Variable declaration?

After seeing some unexpected compiler results, I've reduced the issue to this tiny example: The following compiles under 0.4.10 in Remix: contract StorageMapping { struct S { mapping(...
5
votes
5answers
8k views

Solc --version: command not found

I'm trying to use solc with no success. I download solc with npm install solc but when I run solc --version the console output is: command not found. If I list packages npm list I'm able to see ...
5
votes
1answer
3k views

How do I host Ethereum on a server?

I recently tried to get geth and solidity up and running on a virtual server I have some free time on. I got stuck trying to build the Solidity compiler due to issues with the OpenGL library. I've ...
5
votes
2answers
3k views

Install Solc Compiler on Windows 8

I need a command line compiler in order to make an expert system that automatically builds, tests, and deploys systems of smart contracts based only on metadata. I have tried for several days to ...
5
votes
2answers
287 views

How do I fix Javascript stack overflows when compiling very large file with solc?

If I compile a very large file with solc the stack overflows. This will happen most commonly in node because the default stack is only 984kbytes, which is strangely what you would expect for a 1990s ...
5
votes
1answer
2k views

TypeError: 'setSolc' is not a function

I am trying to sync geth and solc. which solc # I get the path to my solc /usr/local/bin/solc Open the geth console geth console 2>>geth.log and now I try to sync admin.setSolc("/usr/local/...
5
votes
1answer
464 views

Solidity compiler doesn't work in the Javascript Console

I'm using Geth 1.4.5-stable along with Solc version 0.3.5-0 both on Linux. It is run on a Digital Ocean server. I have a fully synced testnet chain and I'm trying to compile contracts from within the ...
5
votes
2answers
592 views

Error: Member “assertNotEqual” not found or not visible after argument-dependent lookup in uint256

I am trying to run test cases in sol-unit for Solidity, but when I compile my code with solc compiler I get an error. I don't think the error is critical, but there is very little material on net ...
4
votes
2answers
273 views

Do intermediate memory variables cost gas?

Example without an intermediate variable: uint startTime = 9; uint allowedTime = 7; require(now > startTime + allowedTime); Example with an intermediate variable: uint startTime = 9; uint ...
4
votes
4answers
3k views

web3 contract instantiation

I'm trying to create a contract object with web3. var contract_abi = result['contracts']['Test']["interface"]; //[{"constant":false,"inputs":[],"name":"inc","outputs":[],"payable":false,"type"...
4
votes
3answers
4k views

Installing solidity in Debian Linux

I'm trying to install solidity but apparently there are no online repositories with all dependencies. I have tried using the methods described here. sudo add-apt-repository ppa:ethereum/ethereum ...
4
votes
1answer
1k views

What is the proper way to build and call a specific version of solidity?

I am getting the following error from solc: Error: Source file requires different compiler version (current compiler is 0.4.11-develop.2017.6.22+commit.68ef5810.Darwin.appleclang - note that nightly ...
4
votes
1answer
308 views

Is the Solidity compiler deterministic?

I am aware that you have to specify the Solidity compiler version and whether or not you use the optimisation flag. But even with all that considered - is the compiler deterministic?
4
votes
2answers
748 views

Contract not deploying on blockchain using solc & web3

I am using the npm package of solc to compile the contracts and accessing it as given here. It is compiling my contracts. But when I try to deploy the contract using web3.eth.sendTransaction({data: ...
4
votes
1answer
2k views

Enums in Solidity

Enum's are not working in solc? Just tried to compile demo contract from gihub documentation : contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }; function test() { ...
4
votes
2answers
3k views

Can't install solc on Mac OS X

I can't install solc on Mac OS X. I have tried the following: npm install solc /Users/punddalinni └── solc@0.3.0-1 npm WARN enoent ENOENT: no such file or directory, open '/Users/punddalinni/...
4
votes
1answer
2k views

The solc is not generatig *.abi file with the option --abi and -o build

When I use the --abi option, the abi interface is generated: $ solc Greeter.sol --abi ======= Greeter.sol:mortal ======= Contract JSON ABI [{"constant":false,"inputs":[],"name":"kill","outputs":[],"...
4
votes
1answer
355 views

How to deploy a solidity contract to the blockchain. myContract.new is not a function

I have a contract that compiles in browser solidity and solc. Using either the auto-generated deployment code in browser solidity or my own npm version, I end up with the error "myContract.new" is ...
4
votes
1answer
263 views

Unexpected implicit casting in Solidity's exponential operator

While investigating an incorrect token award bug in an ERC20, it's come to light that there is an apparent inconsistency in casting with regard to the exponential operator a**b. In particular, the ...
4
votes
1answer
759 views

solc returns empty bin for contracts with constructor and inheritance

Having a simple contract structure like this: pragma solidity ^0.4.8; contract A { uint public a1; } contract B is A { uint8 public b1; } I can compile it with: > solc --combined-json "abi,...
4
votes
1answer
139 views

Setting a struct once cause error while compiling: Stack too deep

See my smart contract below : contract Test { struct MyBool { bool initialized; // /!\ if false then 'NA' else fetch value's property bool value; } struct Patient { ...
4
votes
1answer
96 views

Parse contract to retrieve declared identifiers

Node.js Solidity compiler parses contract and returns its ABI, is there any library to retrieve all declared identifiers in a contract? For example, the following contract: contract Person { ...
4
votes
0answers
67 views

What is the keccak256 reference in opcodes from solc? [duplicate]

Opcodes - Opcodes: PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH1 0xE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0xA0 DUP1 PUSH2 0x1C PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 ...
3
votes
2answers
581 views

Error when calling the selfdistruct method in solidity

I am quite new to solidity, and I have not managed to find a solution for this problem. I am passing the function an address but it says the following: "Invalid type for argument in function call. ...
3
votes
3answers
3k views

“[Errno 2] No such file or directory: 'solc' ” Using py-solc and solidity

I installed py-solc and solidity: solc, the solidity compiler commandline interface Version: 0.4.16+commit.d7661dd9.Darwin.appleclang and ran this code in python (with a contract source example): ...
3
votes
2answers
120 views

Using two solc versions within the same truffle project

I am creating an app that has various imports that require two different versions of solidity. AragonOS(0.4.x) and openzeppelin(0.5.x) Of course, there are breaking changes in 0.5.x so my question is ...
3
votes
2answers
3k views

compiling solidity code using solc@0.4.10 on node.js

Trying to compile solidity smart contract on windows using solc@0.4.10. But the code breaks with the below error, and this happens only for the contracts in which import statements are there, other ...