Questions tagged [solc]

Questions related to the compiler for Solidity: solc

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

Easiest way to compile solidity in user's browser?

I'd like to compile solidity in the browser. web3 has deprecated compile() features so you can't call web3.eth.compile.solidity() anymore. I tried to browserify require('solc') / require('solc/wrapper'...
12
votes
1answer
426 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 ...
8
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 ...
0
votes
1answer
438 views

Where truffle save the compiled contract

I'm trying to find where truffle store the compiled code. I'd like to take this bytecode and to deploy it manually with MyEtherWallet
0
votes
1answer
1k views

Can't compile contract - pragma error and Cannot read property 'interface' of undefined

I am trying to compile this simple contract: pragma solidity ^0.4.18; contract Tasks { struct TaskOwner { address TaskOwnerAddress; bytes32 TaskOwnerName; } mapping (address ...
7
votes
3answers
1k 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 ...
2
votes
1answer
747 views

Truffle Bytecode Different from Etherscan Bytecode

I am having difficulty verifying my contract code on Etherscan using the code generated by Truffle. Using Etherscan VerifyContract V1: https://rinkeby.etherscan.io/verifyContract Truffle produced ...
2
votes
0answers
128 views

Is it possible to get compiler version from the bytecode and smart contract code?

The problem is that I have deployed some contract on the etherscan.io some time ago. Now I want to verify it, so I need to specify: Smart contract code Compiler version ABI encoded constructor ...
1
vote
2answers
2k views

Why is my web3j wrapper failing to generate?

I've created a smart contract in solidity which I've compiled with solc into a .bin & a .abi file. However, when I run the generator on the .abi and .bin files it returns a JSONParseException ...
1
vote
1answer
1k views

Where are Solidity mappings stored?

Are Solidity mappings stored in memory or storage? I know that keys are hashed to a unique identifier for the value, which is stored where? I can't seem to find any clue in the documentation.
1
vote
1answer
46 views

Prevent Remix from recompiling in real time?

How do I prevent online Solidity Compiler called "Remix" from recompiling my code real-time? When using features like Oraclize, the recompilation takes long and happens all the time, making the ...
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? ...
0
votes
1answer
162 views

In Node.js connected to Geth : solc.compile prefixes an additional ':' before contractName

I'm trying the following script on Node.js while running a node connected to Rinkeby Testnet (from https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract): const fs = require("fs"); ...
3
votes
3answers
4k 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): ...
0
votes
1answer
216 views

Solc “bin-runtime” not a command?

I can generate the .bin of a contract with solc as follows: solcjs --bin -o output contract.sol However running the following command: solcjs --bin-runtime -o output contract.sol Generates the ...
2
votes
1answer
299 views

How to compile solidity release version

I've followed instruction to build solidity. But when it finished, i've got develop version: Version: 0.4.16-develop.2017.8.31+commit.d7661dd9.mod.Linux.g++ I've tried to run make with argument ...
1
vote
0answers
582 views

How to query the blockchain data ?

I am developing an KYC dapp where I am keeping customer information like name, dob, age etc. Each customer is having an account address ( i.e Ethereum account). Basically this is a private blockchain. ...
0
votes
1answer
2k views

Solidity compiler command-line utility (solcjs) various problems

I am trying to compile a file using solcjs from a command-line, and running into various problems. First of all, I need to supply in the command-line all the files that are imported by the primary ...
2
votes
1answer
620 views

Node JS module in Geth is not found

I have installed solC module with command: npm install solc How can I use this module in Geth? When I execute var solc = require("solc") in Geth's console, interpreter throws: Error: Cannot find ...
2
votes
0answers
251 views

what does the UnimplementedFeatureError mean?

I'm getting the following error in remix.UnimplementedFeatureError: Non-padded store for function not implemented.
8
votes
1answer
550 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 ...
2
votes
2answers
326 views

How to compile solidity AST to binary code?

I want to do some automatic transformation of solidity source code. For this reason, I thought to get its AST representation using solc --ast or solc --ast-json and modify it. My questions are: ...
2
votes
1answer
889 views

TypeError when trying to deploy a contract with web3 1.0.0-beta.11

I'm trying to figure out how to deploy a contract with web3 in version 1.0.0-beta.11, and I don't know if I'm hitting a bug in web3, an incompatibility issue with the version of solc I'm using, or if ...
3
votes
1answer
493 views

solc.loadRemoteVersion is not a function error

I'm trying to load another version of solc using the following code var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); var solc = require('solc'...
2
votes
0answers
101 views

Accepting Map or JSON in a constructor or method

I have a question: Can a Contract accept a HashMap kind of a data structure or some kind of a JSON structure of the following format in its Constructor? [ {key1 -> {val1, val2, val3}}, {key2 ->...
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 ...
1
vote
1answer
66 views

Problem while retrieving from array

I have the following simple structure and array of that structure: struct Document { bytes32 ownerID; bytes32 documentID; bytes32 name; } Document[] public documents; I'...
0
votes
2answers
29 views

What's wrong in this mapping code?

Could someone please point out what is wrong in this code? It seems that when I call the registerClient() function, it succeeds and returns TRUE. But when I call the getRegisteredClients() method, it ...
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 ...
4
votes
2answers
2k 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 ...
1
vote
1answer
169 views

The Solc Compiler on OSX - Hello World

I'm trying to do the hello world app seen here https://www.ethereum.org/greeter#compiling-your-contract. It says I should be able to do eth.getCompilers() The first you can get by using a ...
7
votes
3answers
948 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 ...
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 ...
2
votes
1answer
568 views

Downgrade Geth from 1.6 to 1.59 to have solc integrated in Geth

I have this project on ropsten testnt that don't want to keep developing but keep on running. Since they took solc out of Geth on v1.6, I get the error method eth_compilesolidity does not exist. Is ...
1
vote
1answer
380 views

“Skipping non-existent input file” error using solc docker on Windows

I'm trying to setup a local build environment for Solidity on Windows (10). One of the options recommended in the Solidity docs is docker. Superficially, the docker image runs fine: C:\work\eth>...
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 ...
3
votes
1answer
738 views

Deploying the smart contract using Web3.js gives error?

I'm deploying a smart contract using the following guide but getting a strange error - Guide: https://tokenmarket.net/blog/creating-ethereum-smart-contract-transactions-in-client-side-javascript/ ...
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/...
1
vote
0answers
197 views

(web3.js) The method eth_compileSolidity does not exist/is not available [duplicate]

I have tried to develop a javascript function with web3.js to compile a solidity contract. In html/javascript code, I have prepared the following. var contract_code = "pragma solidity ^0.4.....[omit ...
6
votes
1answer
558 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(...
9
votes
1answer
2k views

What's the difference between solc's bin bytecode versus bin runtime?

Solc says that bin-runtime is the runtime part of the contracts. What exactly is the runtime bytecode part and how does it differ from bin bytecode output?
1
vote
0answers
588 views

Why is the balance of the ethereum account still zero after I create a token based on the private chain I built?

0 down vote favorite I used the contract codes available on the ethereum official website,to create an advanced token on the private chain run in geth console. The version of geth is 1.5.5,and the ...
4
votes
1answer
287 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 ...
6
votes
3answers
541 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 & ...
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":[],"...
1
vote
0answers
29 views

Solidity compilation issue on Linux Mint [duplicate]

I have a smart contract which I am invoking through webjs. Everything works well untill I am on Windows. Recently i had to move to Linux Mint. Now when i compile the contract. I get stdin in the ...
4
votes
1answer
828 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,...
1
vote
2answers
611 views

How do we convert uint8[3] to uint8[]?

So the code is struct A { uint8[] a; } I want to initialize A by A a = A([1,2,3]);. However, solc says that can't convert uint8[3] to uint8[]. In conclusion, I am looking for a way to convert ...
3
votes
1answer
1k views

How to call imported Contract using Solidity?

Inside my contract I want to use importkeyword to load other contracts and libraries to make my code more clean. As an example, I carried DateTime.sol contract to another file and import it inside ...
4
votes
1answer
149 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 { ...