Questions tagged [solc]

Questions related to the compiler for Solidity: solc

1
vote
1answer
58 views

How to call a contract function that alters blockchain state on geth console

It should be easy, but I'm having a hard time using a simple smart contract described in the Solidity language reference called SimpleStorage. It only as one attribute, a setter and a getter, and I'm ...
0
votes
0answers
14 views

solcx compile_files Key error

I am using python package py-solc-x for compiling the smart contract. os.path.abspath("D:/new.sol") Gives path where my test contract exits. 'D:\\new.sol' Then i use compile_files to compile the ...
0
votes
0answers
27 views

Why am I getting the error "Expected pragma, import directive or contract/interface/library definition?

I have "pragma solidity ^0.5.9" at the start of the file yet I still get this error. Listing.sol:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition. ...
0
votes
1answer
28 views

extract address of used library

Is there anyway or method to extract the address of a linked library from the contract bytecode (not a verified contract code) or deployment transaction? my question is about step 3: step 1. ...
0
votes
0answers
37 views

Solc complier error “TypeError: Cannot read property 'TestToken.sol' of undefined”

I set up a contract with three files referring to Token Factory. I make a test on remix online tool, they can be successfully compiled. when I'm tring to compile them by solc module in a .js file, ...
1
vote
2answers
54 views

Can't deploy contract with web3.js and ganache-cli

I'm using the solc module to compile a Solidity contract. The compilation step looks to be working correctly, however, when I attempt to deploy the contract to the Ganache network (in a Mocha test), ...
1
vote
0answers
22 views

Importing .sol files from an node_modules folder

Did i miss something in configuration, or will this be fixed in an future version? Best regards # ls -al Makefile README.md build cmd contracts node_modules package.json # ls -al ./contracts Wallet....
1
vote
0answers
13 views

What is the value range of the parameter optimize-runs when running the solidity compiler?

I would like to know what the allowed value range of the parameter optimize-runs is when running the Solidity compiler. I didn't find the answer in the official document of Solidity.
1
vote
0answers
20 views

How to verify a contract in etherscan older than 0.4.11?

It seems that the verification feature of Etherscan supports contracts written since Solidity 0.4.11. I want to verify a contract written with Solidity 0.4.8. Is this possible? I'm wondering if this ...
0
votes
0answers
27 views

Compile two .sol file with solc

I'm trying to compile two different sol file with 1 smart contract each and output the compiled code of each one in two different json file. But when i run the code the .json file return empty, i dont ...
0
votes
1answer
22 views

Why is the data from remix different from that from my computer when compiling the same contract using the same version of solidity complier? [closed]

I downloaded the 0.5.7+commit.6da8b019 version of solidity compiler, compiled an ERC20 contract locally using the compiler, and got the binary data. Then I also copied the ERC20 contract and pasted it ...
0
votes
0answers
29 views

Gas is 0 when executing CALL opcode?

I wrote a very simple smart contract like this: contract Test{ function test1(address payable addr, uint256 value) payable public { addr.transfer(value); } } And I compiled it using ...
0
votes
2answers
128 views

Solc error invalid opcode, but works in truffle

I am trying to compile solidity code in solc(nodejs) but unsuccessful so far. I have created a sample app for demo. Here is sample's directory structure (node.js and truffle combined): │ app.js │ ...
1
vote
1answer
139 views

invalid opcode “0x1c” during smart contract method execution

I have written a smart contract to test event from java project using web3j I have prepared the web3j wrapper java class using solc compiler version "0.5.7+commit.6da8b019.Linux.g++" I am using a ...
2
votes
1answer
282 views

Timeout exceeded during the transaction confirmation process

I am trying to figure out the right syntax for solc 0.5.7 and web3 1 beta 52 Follow my source code: contract.sol pragma solidity ^0.5; contract Hello { string public message; constructor (...
0
votes
3answers
58 views

Truffle and Remix compiles differently

I have a smart contract that outputs a different bytecode when compiled with truffle, and with remix, even though both seem to use the same compiler version: 0.5.7+commit.6da8b019 Is that a known ...
0
votes
1answer
55 views

I have written a javascript code for compiling the solidity code but it's showing error

I was trying to compile my contract using solc compiler but it returning me some errors. I will place my solidity code along with the error that I am getting here. Please help me out to sort this ...
1
vote
1answer
83 views

Cannot deploy contract

I'm having difficulty deploying a solc-compiled contract to ganache test network using web3. package.json { "name": "smartinvoice", "version": "1.0.0", "description": "", "main": "index.js", ...
0
votes
1answer
20 views

Deploy.js script is inifinite, does not show any errors

This is the deploy.js file: const assert = require('assert'); const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const cF =...
1
vote
1answer
71 views

Solc: Build from source code failed. Error: ‘mod’ is not a member of ‘z3’

I tried to build solidity compiler (solc) from source code, which was cloned from Solidity Git Repository. I followed the instructions in Solidity Documentation, but I ran into an error when execute: ...
1
vote
1answer
108 views

HDWalletProvider & truffleconfig: 'truffle migrate' will compile but not do anything else

I am trying to build a React app with Truffle. Firstly, my file structure is like so, with root_dir being the project root directory: root_dir/node_modules/src/libs/truffle All of truffle's files, ...
0
votes
1answer
65 views

I am getting solc error while compiling solidity code via py-solc. Is it due tonew update of py-solc ? how to fix it?

from . import views File "/home/manzik/Desktop/Ethereum Voting/voting/home/views.py", line 5, in import commission.views as comm File "/home/manzik/Desktop/Ethereum Voting/voting/commission/...
0
votes
2answers
57 views

No such file or directory: 'solc': 'solc'

I have been trying to follow the following tutorial [https://github.com/adamyala/Your_First_Decentralized_Application_Python] But the following error occurs: I have followed all the steps in ...
0
votes
0answers
16 views

Unexpected behaviour. Huge size increase when adding new SubContract()

I have a contract similar to: contract Contract01 { SubContract _refContract; ... constructor() public { refContract = new SubContract(); } function setSubContractRef(SubContract ...
0
votes
0answers
26 views

solc command is generating empty .bin files

Firstly, this is not an inheritance problem like in this post I have the following two files ( ManagedWallet.sol & ManagedWalletLookup.sol ) pragma solidity ^0.4.24; contract ...
2
votes
0answers
49 views

Why truffle deploy fail with address value=0 after I upgrade to version 5.0.5?

I have a truffle 2_deploy_contracts.js something like this : const sample = artifacts.require('./Sample.sol'); module.exports = function(deployer) { deployer .then(()=>deployer.deploy(...
1
vote
1answer
251 views

How to compile solidity files in nodejs using solc@0.5.4? [duplicate]

I am using node@10.14.2 and solc@0.5.4 to compile solidity files using the following code: var solc = require('solc'); var input = { language: 'Solidity', sources: { 'Bon.sol':{ content:...
1
vote
2answers
258 views

Unable to get abi and bytecode when compiling using solc

I am new to solidity and am following a tutorial that uses solidity compiler version 0.4.25. In the tutorial, solc.compile is used in a compile.js file followed by extract abi and bytecode and ...
2
votes
1answer
53 views

UnimplementedFeatureError: Only byte arrays can be encoded from calldata currently

I received the error message UnimplementedFeatureError: Only byte arrays can be encoded from calldata currently from the compiler, but without any reference to a file or line. In a big project, and ...
2
votes
1answer
105 views

What is the behavior of solc with optimizer disabled?

When enabling the optimizer the documentation of solc tells you that you can choose between optimizing the gas cost at deployment or the gas cost at execution by setting the runs parameter. But what ...
1
vote
1answer
181 views

Importing in SOLC to deploy smart contract

I don't run an Ethereum framework like Truffle and I want to deploy a smart contract using infura node. The smart contract is very simple: pragma solidity ^0.5.2; import "http://github.com/...
0
votes
1answer
268 views

Upgrading to solidity version 0.5.0 getting deployment failed error with same smartcontract perfectly deployed on 0.4.24

The same smart contract is running smoothly in solidity version 0.4.24 but now when I update the solidity version and solving a lot of bugs inside my smart contract I intended to deploy that in ...
0
votes
0answers
39 views

Why the same contract has more bytecode size in solidity 0.5 in compare to 0.4.24?

My earlier contract was compatible with solc@0.4.24. Now I am upgrading my contract to make it compatible with solidity 0.5 but it leads to an increase in bytecode size. AFAICT There is no change in ...
2
votes
1answer
537 views

Switch solc compiler versions

I have solc v0.5.2 on my system, but I have several contracts, that require solc < v0.5, so that I get errors: Error: Source file requires different compiler version What is the best way to run ...
1
vote
0answers
12 views

Compile Solidity on openbsd

i have tried several branches and all fails, has anyone got this working on openbsd? an issue has been created on github about this aswell https://github.com/ethereum/solidity/issues/5728
0
votes
0answers
42 views

solc/wrapper not working with reactjs

My compile.js code: var wrapper = require('solc/wrapper') var solc = wrapper(window.Module) const Compile = (code,name) => { return solc.compile(code, 1).contracts[':'+name]; }; export default ...
0
votes
1answer
487 views

Not able to get rid of error from solc-js “AssertionError [ERR_ASSERTION]: Invalid callback specified.”

const path=require('path'); const fs=require('fs'); const solc=require('solc'); const InboxPath=path.resolve(__dirname,'contracts','Inbox.sol'); const source=fs.readFileSync(InboxPath,'utf8'); solc....
2
votes
1answer
271 views

Solc compile contracts with 5.0.0 [duplicate]

I was following this guide for compiling my contracts How To: Compile a Solidity Smart Contract Using Node.js but "solc.compile(input, 1)" is not working anymore. I have problems understanding how to ...
1
vote
0answers
31 views

Web3JS throws InvalidResponse without Ganache core ever receiving a request?

Versions: Ubuntu 18.04 LTS Node.JS: 8.3.0 WebJS: web3: ^1.0.0-beta.37 web3-utils: ^1.0.0-beta.36 npm: 5.6.0 Truffle version 5.x (latest) I have traced through the HttpProvider code in the Web3 ...
1
vote
1answer
109 views

“Cannot import url”, “File outside of allowed directories” using --standard-json

I'm trying to understand how to use solidity's JSON input-output API. Here's my json file; { "language": "Solidity", "sources": { "StandardToken.sol": { "urls": [ "file:///home/...
2
votes
1answer
170 views

Recently upgraded Solc and Web3. Transactions with zero addresses now reverting with “invalid address” message?

I recently upgraded Web3JS and Solc. Now every time I pass a zero address to a Solidity contact method the transaction reverts with an "invalid address" message. This message appears to be coming ...
2
votes
2answers
460 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. ...
2
votes
1answer
28 views

What about calls you can do safely in constructor?

As a matter of fact, there is more than one discussion about what are the call you can safely do in the constructor. Someone thinks “avoid all external call”, some other says “avoid to use ‘this’ or ...
3
votes
1answer
38 views

SOLIDITY: is anywhere formalized the assignment operator behaviour in nested statements?

As a matter of fact, solidity seems to have same behaviour of C in nested assignment. I.e. running the sample test contract below, calling nestedSum(1) results in the following: a=38, b=16, c=4 ...
2
votes
1answer
676 views

I got error when npm install -g solc [closed]

I got error when try to install solc using npm install -g solc here is the error: erfans-MacBook-Pro:01 erfanandesta$ npm uninstall -g solc npm WARN checkPermissions Missing write access to /usr/...
1
vote
1answer
528 views

How to access string arguments from calldata in external functions? (0.5.X)

With the introduction of Solc 0.5.X , parameter memory locations for arrays (and strings/bytes) must be made explicit. For external functions, this memory location is required to be specified as ...
1
vote
1answer
57 views

How come npmjs website shows that Truffle latest version is 4.1.14, and that it was published 3 days ago?

According to this page, Truffle latest version is 4.1.14, and it was published 3 days ago. However: I have been using this version for months now. I have noticed this "published 3 days ago" several ...
1
vote
1answer
906 views

solc.compile() @0.5.0 is not working like 0.4 version

I read the solc document and followed the instruction. When I am using solc@0.4.24 version, compile command is working fine solc.compile(smartContractPath, 1); When I switched to solc@0.5.0 version, ...
7
votes
1answer
146 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 ...
3
votes
1answer
88 views

How to match the etherscan.io bytecode using the solc compiler?

Trying to do some simple sanity checks between the verified contracts on etherscan.io and the bytecode available on the blockchain for those contracts. I picked a random contract to test: https://...