2

I am new to ethereum block-chain. I created a ERC20 smart-contract with help of open-zeppelin framework. I used py-solc package for solidity compilation with python. I imported compile_files function form solc. And use the function to compile solidity files. I got error when I intelize solidity file to compile.

So, my source code of python files is:-

import json
from web3 import Web3, HTTPProvider,TestRPCProvider
from solc import compile_source, compile_files
from web3.contract import ConciseContract

#Intelize solidity files to compile
compiled_sol = compile_files(["/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol"])
print(compiled_sol.keys())

# Compiled solidity code
contract_interface = compiled_sol['/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol:DappToken']


# web3.py instance
w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:7545"))

# Instantiate and deploy contract
contract = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])
print(contract)

# Get transaction hash from deployed contract
tx_hash =  contract.transact({'from': w3.eth.accounts[0]})
print(tx_hash)

Source Code of ERC20 Solidity file is:-

  pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "openzeppelin-solidity/contracts/token/ERC20/PausableToken.sol";
/**
 * The contractName contract does this and that...
 */
contract DappToken is MintableToken,PausableToken,DetailedERC20 {
            constructor(string _name, string _symbol, uint8 _decimals)
                    DetailedERC20(_name, _symbol, _decimals)
                    public
            {

                }

 }

I got error like this:-

Traceback (most recent call last):
  File "/home/anupam/Documents/workspace/DjangoProject/ico_application/users/common/ERC20.py", line 7, in <module>
    compiled_sol = compile_files(["/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol"])
  File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/main.py", line 135, in compile_files
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/wrapper.py", line 169, in solc_wrapper
    stderr_data=stderrdata,
solc.exceptions.SolcError: An error occurred during execution
> command: `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc /home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol`
> return code: `1`
> stderr:

> stdout:
Invalid option to --combined-json: clone-bin

Query 1:- Why this error came??

Quary 2:- Where I do mistakes in a code??

Please resolve my query as soon as.

5
  • Which version of solc are you using? Commented Sep 14, 2018 at 13:23
  • I am using 0.4.24 solidity version Commented Sep 14, 2018 at 13:26
  • Yes, that's your contract versioning. What is the actual solc binary version? Commented Sep 14, 2018 at 15:13
  • It is also 0.4.24 Commented Sep 14, 2018 at 17:34
  • Sorry I checked again my solc binary version is 0.4.25. So I have to degrade it. Commented Sep 17, 2018 at 4:59

1 Answer 1

1

I am able to answer my own question.

Why this error came??

This error comes because I am using latest or pre-release version solidity binary version(0.4.26) in ubntu.

I uninstall this solidity version. And again install stable solidity binary version(0.4.25).

And again run python code so error is resolve.

Where I do mistakes in a code??

I was doing very silly mistakes. I was using pre-release solidity compiler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.