Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [solc]

Questions related to the compiler for Solidity: solc

2
votes
2answers
34 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 ...
2
votes
1answer
48 views

What is this evm code produced by solc in this public array checking, and why?

When solc creates code for arrays when they are declared public. In particular, it contains a check on the length of the array. For example, this: contract OutOfBoundsException { uint256[8] ...
0
votes
0answers
20 views

How to compile solidity in the browser without using browser-solc?

I am thinking of implementing an API call to compile some source code entered by a user and then return the bytecode for deployment using metamask. I have tried browser-solc but it had some errors ...
1
vote
1answer
43 views

How can we compile multiple smart contracts by compile.js file?

My compile.js file is below const path = require('path'); const fs = require('fs'); const solc = require('solc'); const ballotPath = path.resolve(__dirname, 'contracts', 'blocktitans_ballot.sol'); ...
1
vote
0answers
14 views

Manually configure EVM Assembly Tag

I have read that Ethereum during the compilation splits the code into tags. The solc optimizer doesn’t optimize across tags. If we consider “1+1”, it can be optimized to 0x2 if under the same tag: /...
1
vote
2answers
56 views

How to compile and deploy smart contracts programmatically with Infura in NodeJs

I understand that i will need to be able to unlock my account in web3 to be able to deploy smart contracts. It's all good except i'm using Infura's hosted network instead which prevents me from ...
2
votes
1answer
31 views

Why solc does not detect issue in this code?

I wrote a sample Solidity code below: in function call() of contract sample_call, I make a call to function add_car() function of another contract sample, but this is a bug, since variable v is never ...
0
votes
1answer
106 views

Can't get contract to contract function calls working

I can't quite seem to figure out an issue preventing contract to contract function calls. I'm feeling fairly confident it's something with how I'm deploying. Preface: I have a Parent and Child ...
1
vote
1answer
114 views

warning about security/enforce-explicit-visibility: No visibility specified explicitly for multiply function [duplicate]

my ide is vs(can find solc version is 0.4.17),but my solcjs is 0.4.24.when I run this simple code `pragma solidity^ 0.4.45; contract test{ function multiply(uint a) constant returns(uint d){ ...
1
vote
1answer
38 views

What is the “clone-bin” output in solc?

When it comes to bytecode solc has three types of outputs: --bin Binary of the contracts in hex. --bin-runtime Binary of the runtime part of the contracts in hex. --clone-bin ...
1
vote
1answer
142 views

Compile multiple contracts

When compiling a .sol file that contains multiple contracts you get multiple binaries. How do I know which one belongs to the root contract? For example looking at etherdelta contract code I can see ...
0
votes
0answers
20 views

Cannot mint when creating contract in Ropsten nor in Remix

Code: https://gitlab.com/snippets/1730722 After I compiled the code using solc I embedded the ABI and the binary data. I instantiated the contract and I'm able to call for example the owner or the ...
0
votes
1answer
23 views

Solidity says my function can by marked as view but my code changes state?

Given the code below, when I compile the code with Remix it says the function processBandPayments() can be marked as view. This concerns me greatly since in my mind, the code is changing state by ...
0
votes
0answers
25 views

solc compiles same contract to different binaries

I'm running solidity compiler over some solidity file to get the binary. I'm running solc once via command line and once via java app that runs solc process. I get 2 binaries at the same length but ...
0
votes
0answers
44 views

Transaction remains pending on RINKEBY network

var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); const fs = require('fs'); const solc = require('solc'); const generateWallet = require('ethereumjs-wallet'); var toAccount = 'TO ACCOUNT';...
0
votes
1answer
36 views

CONNECTION to Rinkeby showing false, contract not getting Deployed

SOURCE CODE var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); const fs = require('fs'); const solc = require('solc'); var web3 = new Web3(); web3.setProvider(new web3.providers....
0
votes
1answer
69 views

How to identify the bytecode of a single function

I am trying to generate the bytecode for a single function. I need to avoid any setup/teardown that may occur in the contract as I am trying to get a precise measurement of the execution time in the ...
0
votes
0answers
94 views

solc: unrecognised option '--add-std' message during loadScript() call

I'm installing a Quorum example using instructions from this page: quorum-docker-Nnodes. ...Using these versions of geth and solc on Ubuntu 16.04.. geth Version: 1.8.10-stable-eae63c51 solc Version:...
3
votes
1answer
42 views

v0.4.22 solc compile failing - not predictable behavior

Error: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. function CappedCrowdsale(uint256 _cap) public { ^ (...
0
votes
2answers
195 views

Solidity Compiler - Error: Identifier already declared

Full source code of the file 'Test.sol' : pragma solidity ^0.4.23; contract Mortal{ address owner; string ownerInfo = "Contract Owner name XYZ"; constructor () public { owner =...
2
votes
1answer
82 views

what's the “Contract Creation Code” in Etherscan Verfied Contract?

what's the difference between "Contract Creation Code" in Etherscan Verfied Contract and the bytecode compiled by Solc?
1
vote
1answer
126 views

Why is my transaction not visible on ropsten.etherscan

I am testing a contract on a Ropsten network using geth 1.8.8 with command line: geth --testnet --datadir="" In order to connect to geth I use web3js version 1, beta 34 running from node.js. ...
0
votes
0answers
18 views

Does the solC compiler work in the geth Javascript console anymore

does the solC compiler work in the javascript console anymore, and if it does how can I install it. I have tried using the compiler methods in the javascript console api however they do not work and ...
0
votes
0answers
23 views

Solc compatibility with various versions of Geth

I'm looking for information about what minimal version of solc is compatible with geth, including older versions of geth (1.6+).
2
votes
1answer
61 views

solc producing different contract binary depending on OS

I have a Linux, and another person has a Mac. We have the same solc compiler version, except for the OS extension (I have 0.4.24+commit.e67f0147.Linux.g++, they have 0.4.24+commit.e67f0147.Darwin....
-1
votes
1answer
93 views

How can I compile my smart contract from an API using solc?

I want to compile my solidity code (smart contract) inside my node.js API using the solc library to get the ABI and bytecode of my solidity. What I want in details is an input that can read solidity ...
1
vote
0answers
23 views

txList.length returns different value for different Solidity versions

I have RLPReader smart contract, took it from here. And I have a function untouched for a while: function deposit(bytes txBytes) public pure returns (uint) { RLP.RLPItem[] memory txList = ...
1
vote
1answer
32 views

Problems with binary generated by solc

I'm compiling a contract with solc and I'm getting something like this (I replaced most of the hexadecimal digits with three dots to make it shorter): 608060405234801561001057600080fd5b5060008054600.....
0
votes
1answer
112 views

Cannot verify a particular smart contract code on Etherscan with optimization enabled

I've already deployed many smart contracts to Ropsten testnet and successfully verified them in Etherscan, but today I encountered one contract which doesn't get verified through all my attempts. This ...
0
votes
1answer
209 views

Deploying a smart contract with several solidity files

I have a contract contains 4 .sol files and when I generate its bytecode and api as follows: > solc --bin GreenToken.sol > solc --abi GreenToken.sol I receive: ======= BasicToken.sol:...
1
vote
2answers
153 views

Calling a function from a contract passed in as an argument

Im Trying to create a DAPP with two contracts generating assets. One is acting as the "factory" for the other contracts. From the latter I try to call a function in the factory without knowing its ...
1
vote
1answer
32 views

Use shared library type in contracts

I want to reuse on type DateRange in two contracts. However, I fail with multiple errors. Currently I have one error: G21FE98E9 Member "endTicks" not found or not visible after argument-dependent ...
1
vote
0answers
22 views

Linker not working on solc v0.4.23

I can't seem to make the linker.linkBytecode() method to work... Here's how I'm using it: const linkedBytecode = linker.linkBytecode(mainContract.bytecode, { 'UserLib': userLibContract....
2
votes
2answers
432 views

How to use Solidity solc to compile A.sol that imports B.sol file?

I know how to install solc via "npm install --save solc" then use solc.compile to compile one sol file. But now I've got A.sol file that imports B.sol file, and when I run node compile.js, no error in ...
0
votes
1answer
69 views

Solidity solc compiler error on code Remix can compile

I am attempting to compile the following solidity code using solc in NodeJS. pragma solidity ^0.4.11; contract helloWorld { string public message; function constructor() public{ message = "...
0
votes
1answer
165 views

Problem updating truffle framework

I have problems updating truffle. I run the command "truffle --version" and i got truffle version 4.0.1 and solc version 0.4.18. So i wanted to upgrade to 4.1.6 which is the latest version. I run "...
1
vote
1answer
62 views

What is ethereum bytecode link references is?

I compiled contract from there and found some strange things in bytecode: <some_bytecode>...__CrowdsaleTokenExt:SafeMathLibExt______6366098d4f9091836000604051...<some-bytecode> As I ...
0
votes
0answers
79 views

How to use solc-js with Jest?

I can't compile solidity code in my Jest files, but without Jest it works fine. Here is a test file: const fs = require("fs") const solc = require("solc") describe("test", () => { test("", () =...
1
vote
1answer
510 views

Deploy smart-contract using nodejs

I am trying to follow the following example. http://hypernephelist.com/2016/12/13/compile-deploy-ethereum-smart-contract-web3-solc.html But I get the following error. Can anybody show me what is ...
1
vote
1answer
94 views

How to deploy a smart contract in a server?

I have developed a smart contract and compiled it with solc and bin and abi fils have been generated. Now, I want to deploy this contract using web3js in a linux server. How can I do it?
0
votes
1answer
211 views

How to install solc and build then build smart contract?

How to install solc on windows and then build smart contract ? I use following command : npm install -g solc Is it enough to use it ? Finally, I want to deploy my smart contract
1
vote
1answer
300 views

Is there a way to compile solidity code to javascript in javascript?

This example constructs the javascript code from a solidity code in a shell script. https://github.com/okue/Hello-Ethereum/blob/master/bin/compile Is there a function in javascript that can convert ...
0
votes
0answers
155 views

Solcjs doesn't use the last version of compiler

I am compiling a contract using the npm package solcjs. The package is at version 0.4.21 (npm view solc). However compilation fails because my pragma is set to ^0.4.21 while solcjs states current ...
0
votes
1answer
42 views

solc compiler; ParserError: Token incompatible with Solidity parser

I am trying to compile this contract (part of an online tutorial, not my contract). I'm running ethereumjs-testrpc (ganace precursor) on one terminal, then on another instantiate web3 object; > ...
0
votes
1answer
280 views

structs, mappings, & enums. How to make them work together?

I have this code. My question pretains to struct variables weapons, armour, & stats enum Armour {Chest, Helm, Boots, Leggings, Gloves, Shield} enum Weapon {Sword, Axe, Wand, Gun, Hammer, Fist} ...
8
votes
1answer
108 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()...
0
votes
2answers
67 views

How would I best resolve this specific type of 'Unused local variable' warning?

I have a function which returns multiple values. In some places I use all of them, while in other places I use only some of them. This short snippet can illustrate the problem: contract A { ...
4
votes
0answers
50 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 ...
1
vote
0answers
285 views

Importing files from an “outside” folder

I am trying to import files from a relative path outside of my Truffle-project folder: import '../../../common/solidity/contracts/token/ERC20/BurnableToken.sol'; import '../../../common/solidity/...
1
vote
0answers
121 views

verifying code deployed with web3.js

I am deploying my smart contracts using web3.js and compiling the code using solc. The contracts are deployed successfully with no issues however I am having a bit of a problem in verifying my ...