Giter Site home page Giter Site logo

ethereum / py-solc Goto Github PK

View Code? Open in Web Editor NEW
182.0 20.0 232.0 160 KB

Python wrapper around the solc Solidity compiler.

License: MIT License

Makefile 1.68% Python 98.32%
ethereum solidity solc solidity-compiler python-wrapper py-solc blockchain python python3

py-solc's Introduction

py-solc

Build Status PyPi version

Python wrapper around the solc Solidity compiler.

Dependency

This library requires the solc executable to be present.

Only versions >=0.4.2 are supported and tested though this library may work with other versions.

solc installation instructions

Quickstart

Installation

pip install py-solc

Development

Clone the repository and then run:

pip install -e . -r requirements-dev.txt

Running the tests

You can run the tests with:

py.test tests

Or you can install tox to run the full test suite.

Releasing

Pandoc is required for transforming the markdown README to the proper format to render correctly on pypi.

For Debian-like systems:

apt install pandoc

Or on OSX:

brew install pandoc

To release a new version:

bumpversion $$VERSION_PART_TO_BUMP$$
git push && git push --tags
make release

How to bumpversion

The version format for this repo is {major}.{minor}.{patch} for stable, and {major}.{minor}.{patch}-{stage}.{devnum} for unstable (stage can be alpha or beta).

To issue the next version in line, use bumpversion and specify which part to bump, like bumpversion minor or bumpversion devnum.

If you are in a beta version, bumpversion stage will switch to a stable.

To issue an unstable version when the current version is stable, specify the new version explicitly, like bumpversion --new-version 4.0.0-alpha.1 devnum

Standard JSON Compilation

Use the solc.compile_standard function to make use the [standard-json] compilation feature.

Solidity Documentation for Standard JSON input and ouptup format

>>> from solc import compile_standard
>>> compile_standard({
...     'language': 'Solidity',
...     'sources': {'Foo.sol': 'content': "...."},
... })
{
    'contracts': {...},
    'sources': {...},
    'errors': {...},
}
>>> compile_standard({
...     'language': 'Solidity',
...     'sources': {'Foo.sol': 'urls': ["/path/to/my/sources/Foo.sol"]},
... }, allow_paths="/path/to/my/sources")
{
    'contracts': {...},
    'sources': {...},
    'errors': {...},
}

Legacy Combined JSON compilation

>>> from solc import compile_source, compile_files, link_code
>>> compile_source("contract Foo { function Foo() {} }")
{
    'Foo': {
        'abi': [{'inputs': [], 'type': 'constructor'}],
        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
        'code_runtime': '0x60606040526008565b00',
        'source': None,
        'meta': {
            'compilerVersion': '0.3.5-9da08ac3',
            'language': 'Solidity',
            'languageVersion': '0',
        },
    },
}
>>> compile_files(["/path/to/Foo.sol", "/path/to/Bar.sol"])
{
    'Foo': {
        'abi': [{'inputs': [], 'type': 'constructor'}],
        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
        'code_runtime': '0x60606040526008565b00',
        'source': None,
        'meta': {
            'compilerVersion': '0.3.5-9da08ac3',
            'language': 'Solidity',
            'languageVersion': '0',
        },
    },
    'Bar': {
        'abi': [{'inputs': [], 'type': 'constructor'}],
        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
        'code_runtime': '0x60606040526008565b00',
        'source': None,
        'meta': {
            'compilerVersion': '0.3.5-9da08ac3',
            'language': 'Solidity',
            'languageVersion': '0',
        },
    },
}
>>> unlinked_code = "606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273__TestA_________________________________90630c55699c906064906000906004818660325a03f41560025750505056"
>>> link_code(unlinked_code, {'TestA': '0xd3cda913deb6f67967b99d67acdfa1712c293601'})
... "606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273d3cda913deb6f67967b99d67acdfa1712c29360190630c55699c906064906000906004818660325a03f41560025750505056"

Setting the path to the solc binary

You can use the environment variable SOLC_BINARY to set the path to your solc binary.

Installing the solc binary

This feature is experimental and subject to breaking changes.

Any of the following versions of solc can be installed using py-solc on the listed platforms.

  • v0.4.1 (linux)
  • v0.4.2 (linux)
  • v0.4.6 (linux)
  • v0.4.7 (linux)
  • v0.4.8 (linux/osx)
  • v0.4.9 (linux)
  • v0.4.11 (linux/osx)
  • v0.4.12 (linux/osx)
  • v0.4.13 (linux/osx)
  • v0.4.14 (linux/osx)
  • v0.4.15 (linux/osx)
  • v0.4.16 (linux/osx)
  • v0.4.17 (linux/osx)
  • v0.4.18 (linux/osx)
  • v0.4.19 (linux/osx)
  • v0.4.20 (linux/osx)
  • v0.4.21 (linux/osx)
  • v0.4.22 (linux/osx)
  • v0.4.23 (linux/osx)
  • v0.4.24 (linux/osx)
  • v0.4.25 (linux/osx)

Installation can be done via the command line:

$ python -m solc.install v0.4.25

Or from python using the install_solc function.

>>> from solc import install_solc
>>> install_solc('v0.4.25')

The installed binary can be found under your home directory. The v0.4.25 binary would be located at $HOME/.py-solc/solc-v0.4.25/bin/solc. Older linux installs will also require that you set the environment variable LD_LIBRARY_PATH=$HOME/.py-solc/solc-v0.4.25/bin

Import path remappings

solc provides path aliasing allow you to have more reusable project configurations.

You can use this like:

from solc import compile_source, compile_files, link_code

compile_files([source_file_path], import_remappings=["zeppeling=/my-zeppelin-checkout-folder"])

More information about solc import aliasing

py-solc's People

Contributors

1ultimat3 avatar 4gn3s avatar artenator avatar cag avatar carver avatar miohtama avatar movermeyer avatar pipermerriam avatar voith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-solc's Issues

Cannot find import file

  • py-solc Version: 3.1.0
  • solc Version: 0.4.24
  • Python Version: 3.7
  • OS: osx

What was wrong?

  • full output of the error you received

/usr/local/bin/python3.7 /Users/sam/work/tutorial/test/web3_test.py
Traceback (most recent call last):
File "/Users/sam/work/tutorial/test/web3_test.py", line 80, in
compiled_sol = compile_source(contract_source_code, allow_paths=PROJECT_ROOT) # Compiled source code
File "/usr/local/lib/python3.7/site-packages/solc/main.py", line 108, in compile_source
stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
File "/usr/local/lib/python3.7/site-packages/solc/utils/string.py", line 85, in inner
return force_obj_to_text(fn(*args, **kwargs))
File "/usr/local/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 --allow-paths /Users/sam/work/tutorial
> return code: 1
> stderr:

    > stdout:
    <stdin>:2:1: Error: Source "interfaces/ISimpleStorage.sol" not found: File not found.

import './interfaces/ISimpleStorage.sol';
^---------------------------------------^

  • the code that caused the failure
    There is an import in the solidity contract that I try to import another contract. But the program cannot find it.

in my python code:

contract_source_code = open('../contracts/storage/SimpleStorage.sol', 'r').read()
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
compiled_sol = compile_source(contract_source_code, allow_paths=PROJECT_ROOT)  # Compiled source code

in my SimpleStorage.sol:

pragma solidity ^0.4.24;
import './interfaces/ISimpleStorage.sol';

Tree:
.
โ”œโ”€โ”€ Migrations.sol
โ”œโ”€โ”€ SimpleStorage.sol
โ”œโ”€โ”€ storage
โ”‚ย ย  โ”œโ”€โ”€ SimpleStorage.sol
โ”‚ย ย  โ””โ”€โ”€ interfaces
โ”‚ ย ย  โ””โ”€โ”€ ISimpleStorage.sol
โ”œโ”€โ”€ token
โ”‚ย ย  โ”œโ”€โ”€ ERC20Token.sol
โ”‚ย ย  โ””โ”€โ”€ interfaces
โ”‚ย  ย  โ””โ”€โ”€ IERC20Token.sol
โ””โ”€โ”€ utility
โ””โ”€โ”€ Utils.sol

Cute Animal Picture

cc

get_platform() function not used in install script

  • py-solc Version: 1.2.1
  • solc Version: 0.4.8
  • Python Version: 2.7.12
  • OS: linux (Ubuntu 16.04)

Output:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/solc/install.py", line 463, in <module>
    install_solc(identifier)
  File "/usr/local/lib/python2.7/dist-packages/solc/install.py", line 441, in install_solc
    ', '.join(sorted(INSTALL_FUNCTIONS.keys())),
ValueError: Installation of solidity is not supported on your platform (linux2). Supported platforms are: darwin, linux

This is the output I get when I try to run:
python -m solc.install v0.4.8

I believe the issue is because the get_platform function is not actually used.

def get_platform():
    if sys.platform.startswith('linux'):
        return LINUX
    elif sys.platform == OSX:
        return OSX
    elif sys.platform == WINDOWS:
        return WINDOWS
    else:
        raise KeyError("Unknown platform: {0}".format(sys.platform))

As you can see, this uses "startswith" which would allow my "linux2" kernel to pass. But this function is not actually used... see below.

def install_solc(identifier, platform=None):
    if platform is None:
        platform = sys.platform

    if platform not in INSTALL_FUNCTIONS:
        raise ValueError(

solc.compile_source() Failed

  • py-solc Version: 2.1.0
  • solc Version: 0.4.21 (here is solcjs)
  • Python Version: 3.5.4
  • OS: linux(ubuntu)

What was wrong?

Use compile_source(source) fail !!

My commands:

Install solc: npm install -g solc
Install py-solc: pip3 install py-solc
Use solc in python3:
from solc import compile_source
compile_source('pragma solidity ^0.4.0; contract A{ funcion A() public{}}')

Details:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/solc/main.py", line 106, in compile_source
stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
File "/usr/local/lib/python3.5/dist-packages/solc/utils/string.py", line 85, in inner
return force_obj_to_text(fn(*args, **kwargs))
File "/usr/local/lib/python3.5/dist-packages/solc/wrapper.py", line 165, 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
return code: 1
stderr:

stdout:
Must provide a file

Cute Animal Picture

put a cute animal picture here.
animals-smile_3379238k

Unable to load Solidity contract using `compile_standard` function due to error `Second argument needs to be a buffer`

  • py-solc Version: 2.1.0 (shown when running pip list)
  • solc Version: 0.4.18+commit.9cf6e910.Emscripten.clang (shown when running solc --version)
  • Python Version: 3.6.4rc1 (shown when running python --version)
  • OS: osx - macOS 10.12.6

What was wrong?

I used PyEnv to install and switch to the latest Python version 3.6.4rc1 https://github.com/pyenv/pyenv. I then installed the following Python packages:

pyenv install 3.6.4rc1
pyenv versions
pyenv global 3.6.4rc1
python -m pip install py-solc==2.1.0
python -m solc.install v0.4.18
python -m pip install web3==4.0.0b5 
python -m pip install ethereum==2.1.5
python scripts/main.py

I then created and executed a Python file i.e. main.py with python main.py:
main.py

import solc
from solc import compile_files
compiled_sol = compile_files(["FixedSupplyToken.sol"])

Note that the Solidity file I am using is in my repo here https://github.com/ltfschoen/geth-node/blob/master/contracts/FixedSupplyToken.sol, and it compiles successfully with solc v0.4.18, as I've done so in MIST and deployed it to a Private Network previously already.

I'm trying to replicate using Web3.py and py-solc the same functionality that worked when I used Web3.js and solc-js here: https://github.com/ltfschoen/geth-node/blob/master/scripts/main.js

In the file I use py-solc to compile Solidity source code from a file using the function compile_files, but I get a full output error in Bash terminal as follows:

$ python main.py 
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    compiled_sol = compile_files(["FixedSupplyToken.sol"])
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/main.py", line 133, in compile_files
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/wrapper.py", line 165, 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 FixedSupplyToken.sol`
> return code: `1`
> stderr:

> stdout:
Invalid option selected, must specify either --bin or --abi

I then looked closer at the Py-Solc documentation here: https://github.com/ethereum/py-solc#standard-json-compilation, and changed my code to use the same syntax as the second example under the heading "Standard JSON Compilation":
main.py

import solc
from solc import compile_standard
compiled_sol = compile_standard({
  'language': 'Solidity',
  'sources': {'FixedSupplyToken.sol': 'urls': ["./contracts/FixedSupplyToken.sol"]},
}, allow_paths="./contracts/")

But when I run this it gives another error in the Bash terminal, which is because the example is missing a { just before 'urls':

$ python main.py 
  File "main.py", line 5
    'sources': {'FixedSupplyToken.sol': 'urls': ["FixedSupplyToken.sol"]},
                                              ^
SyntaxError: invalid syntax

So I added the missing {, and I used a JSON Validator to make sure the argument was valid json format:

main.py

import solc
from solc import compile_standard
compiled_sol = compile_standard({
  "language": "Solidity",
  "sources": {
    "FixedSupplyToken.sol": {
      "urls": ["file:///Users/Ls/code/blockchain/geth-node/contracts/FixedSupplyToken.sol"]
    }
  }
}, allow_paths="file:///Users/Ls/code/blockchain/geth-node/contracts/")

But then it gave me error:

$ python main.py 
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    }, allow_paths="./contracts/")
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/main.py", line 161, in compile_standard
    **kwargs
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/Users/Ls/.pyenv/versions/3.6.4rc1/lib/python3.6/site-packages/solc/wrapper.py", line 165, in solc_wrapper
    stderr_data=stderrdata,
solc.exceptions.SolcError: An error occurred during execution
        > command: `solc --allow-paths file:///Users/Ls/code/blockchain/geth-node/contracts/ --standard-json`
        > return code: `1`
        > stderr:

        > stdout:
        /Users/Ls/.nvm/versions/node/v8.7.0/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:144
        throw er
        ^

TypeError: Second argument needs to be a buffer
    at Object.fs.readSync (fs.js:682:18)
    at Object.readSync (/Users/Ls/.nvm/versions/node/v8.7.0/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:138:28)
    at Object.<anonymous> (/Users/Ls/.nvm/versions/node/v8.7.0/lib/node_modules/solc/solcjs:65:18)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)

So then I clicked the link that says "Solidity Documentation for Standard JSON input and ouptup format" (FYI, note the typo here in the word "output") http://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description, specifically the section http://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description.

It highlighted that that object we are passing to compile_standard is an Input JSON Description, which the compiler API expects to be in JSON format, and it outputs the compilation result in a JSON formatted output.

When looked more closely at the error, which says solc --allow-paths file:///Users/Ls/code/blockchain/geth-node/contracts/ --standard-json, it's clearly missing a JSON file as an input argument at the end.
Is this something that the compiler is supposed to automatically generate? A similar error was raised in the solc-js repo issues here ethereum/solc-js#126

I tried experimenting a bit more trying to find an alternative and found that I'm able to manually created ABI files in Bash terminal with the command: solc --abi FixedSupplyToken.sol --output-dir ./build, which generates the following in the ./build/ folder:

  • __FixedSupplyToken_sol_ERC20Interface.abi
  • __FixedSupplyToken_sol_FixedSupplyToken.abi

But I don't know how to load these generated ABI files into the variable contract_interface in main.py. Currently my code is contract_interface = compiled_sol['<stdin>:FixedSupplyToken'],

I then tried copying the JSON argument into a file called test.json.
test.json

{
  "language": "Solidity",
  "sources": {
    "FixedSupplyToken.sol": {
      "urls": ["file:///Users/Ls/code/blockchain/geth-node/contracts/FixedSupplyToken.sol"]
    }
  }
}

I then ran the following:

solc --standard-json test.json --output-dir ./build

But it just returned the following;

Empty input was read

So I don't even understand how to use the CLI.
Any help greatly appreciated
I've pushed my latest code here: https://github.com/ltfschoen/geth-node/blob/master/scripts/main.py

Cute Animal Picture

Python

(feature request) from solc import __version__

  • py-solc Version: x.x.x

that is my question - how to query that?

from solc import get_solc_version
print (get_solc_version())

is not the answer.

It is in 2 places - in .bumpversion.cfg and setup.py - please create some wrapper, perhaps like this?

What was wrong?

Nothing. All good.

But Ethereum's standards are changing too often, so I'd like to always print version numbers for the ethereum toolchain - to avoid troubles like this, I am going to import specific versions.

Current situation seems to be:

versions: web3 4.2.0, py-solc: TODO, solc 0.4.23+commit.124ca40d.Linux.gpp, testrpc 1.3.4, python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]

Cute Animal Picture

put a cute animal picture here.

https://i.pinimg.com/736x/7b/70/c2/7b70c217a54aafd30de9ad938dd744ef--ascii-text-unicorns.jpg

Unable to import Solidity contract from a file using `compile_files`

  • py-solc Version: 2.1.0 (shown when I run pip3 list)
  • solc Version: 0.4.17+commit.bdeb9e52.Linux.g++
  • Python Version: 3.6.3
  • OS: Docker VM on macOS 10.12.6 - Linux version 4.9.49-moby (gcc version 6.2.1 20160822 (Alpine 6.2.1) )
  • Solc v0.4.17 (see where I load Solc dependency in my Dockerfile)
  • Source Code: https://github.com/ltfschoen/pyethfinality/blob/master/main.py

What was wrong?

How to reproduce the issue

Follow steps in the "Quickstart Guide" of my Github repo https://github.com/ltfschoen/pyethfinality#chapter-0

  • Run the Python script in the 1st Bash Terminal tab's Docker shell
python3 main.py

What was the result of the issue. What the expected behaviour is

In the web3.py Quick Start example code https://github.com/pipermerriam/web3.py, they load the Solidity contract "inline" and store it in variable contract_source_code and then compile the source code with compiled_sol = compile_source(contract_source_code), which is then assigned to the contract_interface = compiled_sol['<stdin>:Greeter'].

But I want to load the Solidity contract from a "file", so I added compile_files to the list of imports from solc import install_solc, compile_source, compile_files and compiled the source code with compiled_sol = compile_files([โ€œ./Greeter.solโ€]), but I get the following error on the above mentioned line of code that assigns to the contract_interface variable.

Traceback (most recent call last):
  File "main.py", line 42, in <module>
    contract_interface = compiled_sol['<stdin>:Greeter']
KeyError: '<stdin>:Greeter'

Note: I need to load the Solidity contract from a file so I can implement unit tests.

Cute Animal Picture

alt text

Is `tox` test suite broken on travis.ci?

  • py-solc Version: 3.2.0
  • solc Version: 0.4.25
  • Python Version: 3.6.6
  • OS: linux

What was wrong?

Test suite seems to be broken. A lot of tests are in red. For example, test contracts defined in conftest.py produce warnings on newer versions of solc and that warning does not pass is_benign check.

All while tox passes tests on travis.ci somehow.

Example of failed pytest run. Command:
python -m pytest -k test_providing_stdin

It's output:

================================================================================= test session starts ==================================================================================
platform linux -- Python 3.6.6, pytest-3.8.2, py-1.7.0, pluggy-0.7.1 -- /home/pepesza/code/py-solc/venv/bin/python
cachedir: .pytest_cache
rootdir: /home/pepesza/code/py-solc, inifile: pytest.ini
collected 58 items / 57 deselected                                                                                                                                                     

tests/core/wrapper/test_solc_wrapper.py::test_providing_stdin FAILED                                                                                                             [100%]

======================================================================================= FAILURES =======================================================================================
_________________________________________________________________________________ test_providing_stdin _________________________________________________________________________________

FOO_SOURCE = 'pragma solidity ^0.4.17;\n\ncontract Foo {\n    function Foo() public {}\n\n    function return13() public pure returns (uint) {\n        return 13;\n    }\n}\n'

    def test_providing_stdin(FOO_SOURCE):
        output, err, _, _ = solc_wrapper(stdin=FOO_SOURCE, bin=True)
        assert output
        assert 'Foo' in output
>       assert is_benign(err)
E       assert False
E        +  where False = is_benign('<stdin>:4:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.\n    function Foo() public {}\n    ^----------------------^\n')

FOO_SOURCE = 'pragma solidity ^0.4.17;\n\ncontract Foo {\n    function Foo() public {}\n\n    function return13() public pure returns (uint) {\n        return 13;\n    }\n}\n'
_          = <subprocess.Popen object at 0x7f1aa8150390>
err        = '<stdin>:4:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.\n    function Foo() public {}\n    ^----------------------^\n'
output     = '\n======= <stdin>:Foo =======\nBinary: \n6080604052348015600f57600080fd5b5060a18061001e6000396000f3006080604052600436...80910390f35b6000600d9050905600a165627a7a72305820222a1dc8029613612a0659d720a86492832454b7f50a2f689ce684cd93fa671b0029\n'

tests/core/wrapper/test_solc_wrapper.py:38: AssertionError
======================================================================= 1 failed, 57 deselected in 0.07 seconds ========================================================================

Unsupported macOS version.

  • py-solc Version: 3.2.0
  • solc Version: x.x.x
  • Python Version: 3.7
  • OS: osx/

What was wrong?

Please include information like:
while do python3 -m solc.install v0.4.25
Unsupported macOS version.
We only support Mavericks, Yosemite, El Capitan, Sierra and High Sierra.

Cute Animal Picture

put a cute animal picture here.
image

Can't compile without AST

  • py-solc Version: 3.1.0

What was wrong?

Calling compile_source() or compile_files() without including ast in the output_values parameter causes a KeyError here:

sources = output['sources']

The reason is that _parse_compiler_output() unconditionally expects sources to be in the solc output json which isn't the case when ast isn't included.

Cute Animal Picture

Compiling a contract with `import_remappings` fails

  • py-solc Version: 2.1.0
  • solc Version: 0.4.17
  • Python Version: 3.5.2
  • OS: Ubuntu 16.04, 4.4.0-104-generic

What was wrong?

I tried to compile a contract, say like this one:

pragma solidity 0.4.17;

contract Blah {
    uint public a;

    function Blah(uint _a) public {
        a = _a;
    }

    function getA() public view returns(uint) {
        return a;
    }
}

The python compilation code is as follows:

class Chain:
    ...
    @classmethod
    def compileContract(cls, filename):
	with open(filename,'r') as f:
            contract_source_code = f.read()
        compiled_sol = compile_source(contract_source_code, import_remappings=['='])                                                    
        return compiled_sol ['<stdin>:Blah']
    ...

Executing this function returns an error:

Traceback (most recent call last):
  File "compile.py", line 71, in <module>
    compiled = Chain.compileContract(sys.argv[1])
  File "compile.py", line 24, in compileContract
    compiled_sol = compile_source(contract_source_code, import_remappings=["="])
  File "/usr/local/lib/python3.5/dist-packages/solc/main.py", line 106, in compile_source
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/solc/wrapper.py", line 165, 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 =`
> return code: `1`
> stderr:

> stdout:

Notes:

  • It fails whatever value I assign to import_remapings.
  • Executing with import_remappings removed works fine (it's not needed in this example, but I have another case where I'm importing other contracts and I need to use it).
  • Executing solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc = blah.sol directly from the command line works fine too (no errors, no warnings).
  • I tried also running with solc 0.4.19 in docker but problem persisted.
  • All files I have in one directory and all commands were executed inside this directory.

Cute Animal Picture

tumblr_mbyr4z1nm41rzey51o1_500

Clarify solc unavailable message

What was wrong?

The error message is not clear, when solc isn't available.

Examples:

Proposal: catch and reraise the exception with a note saying something like:

The command line tool solc wasn't found. Try python -m solc.install v0.4.17 or see http://solidity.readthedocs.io/en/latest/installing-solidity.html

Cute Animal Picture

cute animal

FileNotFoundError: [WinError 2] The system cannot find the file specified

I am trying to convert mp3 file to wav file using python!
CODE:
from os import path
from pydub import AudioSegment

files

src = "the_audio.mp3"
dst = "test.wav"

convert wav to mp3

sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")

Error:
FileNotFoundError Traceback (most recent call last)
in
1 # convert wav to mp3
----> 2 sound = AudioSegment.from_mp3(src)
3 sound.export(dst, format="wav")

~\anaconda3\lib\site-packages\pydub\audio_segment.py in from_mp3(cls, file, parameters)
736 @classmethod
737 def from_mp3(cls, file, parameters=None):
--> 738 return cls.from_file(file, 'mp3', parameters=parameters)
739
740 @classmethod

~\anaconda3\lib\site-packages\pydub\audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
683 info = None
684 else:
--> 685 info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
686 if info:
687 audio_streams = [x for x in info['streams']

~\anaconda3\lib\site-packages\pydub\utils.py in mediainfo_json(filepath, read_ahead_limit)
272
273 command = [prober, '-of', 'json'] + command_args
--> 274 res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
275 output, stderr = res.communicate(input=stdin_data)
276 output = output.decode("utf-8", 'ignore')

~\anaconda3\lib\subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
798 c2pread, c2pwrite,
799 errread, errwrite,
--> 800 restore_signals, start_new_session)
801 except:
802 # Cleanup if the child failed starting.

~\anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
1205 env,
1206 os.fspath(cwd) if cwd is not None else None,
-> 1207 startupinfo)
1208 finally:
1209 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

[Bug Description + Fix] Putting any comment before the pragma line will lead to error 3420 when calling compile_standard

  • py-solc Version: 3.2.0
  • solc Version: Version: 0.8.4+commit.c7e474f2.Linux.g++
  • Python Version: 3.6.9
  • OS: Ubuntu 18.04.5 LTS

What was wrong?

Full output of error:

{'errors': [{'component': 'general',
             'errorCode': '3420',
             'formattedMessage': 'Warning: Source file does not specify '
                                 'required compiler version! Consider adding '
                                 '"pragma solidity ^0.8.4;"\n'
                                 '--> Greeter.sol\n'
                                 '\n',
             'message': 'Source file does not specify required compiler '
                        'version! Consider adding "pragma solidity ^0.8.4;"',
             'severity': 'warning',
             'sourceLocation': {'end': -1, 'file': 'Greeter.sol', 'start': -1},
             'type': 'Warning'}],
 'sources': {'Greeter.sol': {'id': 0}}}

Let's say you want to compile a contract of the following form:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.0 <0.9.0;

contract A {
    // ...
}

I get error 3420 when calling the compile_standard() function.

For me this only happens when I put any comment before the pragma line.
If I put the pragma line first and then put a comment this error does not happen.

Cute Animal Picture

shiba

Can't compile abi (issue with path and JSON logic exception)

  • py-solc Version: 0.4.19
  • solc Version: don't have?
  • Python Version: 3.6.3
  • OS: linux

What was wrong?

Can't compile abi for this smart contract: https://gist.github.com/j10sanders/d85ded8810d20ff1368cae23f00a9732

Steps taken:
python -m solc.install v0.4.19 /home/jonathan/virtualenvs/call/bin/python: No module named solc
I set the environment variable: SOLC_BINARY=$HOME/.py-solc/solc-v0.4.19/bin/solc

get_solc_binary_path()
print(get_solc_binary_path) //solc

@pipermerriam was helping me in Gitter, and got me to a place where I can use solc, but it is using my absolute path. This probably won't fly when I have to deploy this to heroku.

compiled_sol = compile_standard({'language': 'Solidity', 'sources': contract_source_code}, solc_binary="/home/jonathan/.py-solc/solc-v0.4.19/bin/solc")
solc.exceptions.SolcError: JSON logic exception: in Json::Value::getMemberNames(), value must be objectValue
> command: `/home/jonathan/.py-solc/solc-v0.4.19/bin/solc --standard-json`
> return code: `0`
> stderr:
{"errors":[{"component":"general","formattedMessage":"JSON logic exception: in Json::Value::getMemberNames(), value must be objectValue","message":"JSON logic exception: in Json::Value::getMemberNames(), value must be objectValue","severity":"error","type":"InternalCompilerError"}]}

> stdout:

I've tried this too:

with open('escrow.sol', 'r') as f:
	contract_source_code = f.read()
	compiled_sol = compile_standard({'language': 'Solidity', 'sources': {'escrow.sol': contract_source_code}}, solc_binary="/home/jonathan/.py-solc/solc-v0.4.19/bin/solc")
// "errors":[{"component":"general","formattedMessage":"Source input is not a JSON object.","message":"Source input is not a JSON object.","severity":"error","type":"JSONError"}]}

Cute Animal Picture

My kitten Larry, this morning.
https://image.ibb.co/m1yWrx/larry.jpg

My kitten, Larry, this morningt

py-solc is incompatible with Solidity compiler 0.5.0

  • py-solc Version: 3.2.0
  • solc Version: 0.5.0
  • Python Version: 3.6.7
  • OS: Linux

What was wrong?

py-solc is incompatible with Solidity compiler 0.5.0

--combined-json clone-bin is deprecated in version 0.5.0 but is set in main.py and wrapper.py. Has to be removed.

Compile from source uses the solc compiler option to compile from stdin but does this incorrectly.
The fix would be to add command += "-" at the end of the command creation.
A quick and dirty fix for both issues can be seen on my repository master branch at:

https://github.com/Jonasmpi/py-solc

Cute Animal Picture

Cannot compile ast

  • py-solc Version: 2.1.0
  • solc Version: 0.4.24-develop.2018.5.4+commit.a244f1a3.Darwin.appleclang
  • Python Version: 3.6
  • OS: osx

What was wrong?

Please include information like:

  • full output of the error you received

ast not present although requested as output value. in the output only abi is present, e.g:

{'abi':
[{'constant': False, 'inputs': [{'name': '_from', 'type': 'address'}, {'name': '_value', 'type': 'uint256'}, {'name': '_token', 'type': 'address'}, {'name': '_extraData', 'type': 'bytes'}], 'name': 'receiveApproval', 'outputs': [], 'payable': False, 'stateMutability': 'nonpayable', 'type': 'function'}]
}

  • the code that caused the failure

solc.compile_files(solidity_paths, output_values=['abi', 'ast'])

Animal Picture

               /^\/^\
              _|__|  O|
     \/     /~     \_/ \
      \____|__________/  \
             \_______      \
                     `\     \                 \
                       |     |                  \
                      /      /                    \
                     /     /                       \
                   /      /                         \ \
                  /     /                            \  \
                /     /             _----_            \   \
               /     /           _-~      ~-_         |   |
              (      (        _-~    _--_    ~-_     _/   |
               \      ~-____-~    _-~    ~-_    ~-_-~    /
                 ~-_           _-~          ~-_       _-~   - jurcy -
                    ~--______-~                ~-___-~

compile_files return error when calling with --output-dir=<path> param

  • py-solc Version: 3.2.0
  • solc Version: 0.4.21
  • Python Version: 3.6.5
  • OS: linux

When calling compile_files method with --output-dir= param:

stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)

stdoutdata is None, then contracts = _parse_compiler_output(stdoutdata) will throw exception in code:
def _parse_compiler_output(stdoutdata):
output = json.loads(stdoutdata)

Web3 don't want deploy bytecode, because it is not hex

  • py-solc Version: 3.2.0
  • solc Version: 0.4.24, 0.4.24
  • Python Version: 3.6.6
  • OS: linux

Bytecode don't wont deploy, because it is not hex

Traceback (most recent call last):
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/utils/formatters.py", line 68, in apply_formatters_to_dict
    yield key, formatters[key](item)
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/utils/normalizers.py", line 178, in normalize_bytecode
    bytecode = HexBytes(bytecode)
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/hexbytes/main.py", line 17, in __new__
    bytesval = hexstr_if_str(to_bytes, val)
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/eth_utils/conversions.py", line 152, in hexstr_if_str
    hexstr_or_primitive,
ValueError: when sending a str, it must be a hex string. Got: '608060405234801561001057600080fd5b506040516020806120fe833981016040525160008054600160a060020a03909216600160a060020a03199092169190911790556120ac806100526000396000f3006080604052600436106100815763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662ce8e3e81146100865780631a702aa0146100eb57806345982a661461024c5780636f77926b1461026757806373338081146102a4578063f172f871146102bc578063f851a440146102e3575b600080fd5b34801561009257600080fd5b5061009b6102f8565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100d75781810151838201526020016100bf565b505050509050019250505060405180910390f35b3480156100f757600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261024a958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975061035a9650505050505050565b005b34801561025857600080fd5b5061009b6004356024356108e8565b34801561027357600080fd5b50610288600160a060020a03600435166109ac565b60408051600160a060020a039092168252519081900360200190f35b3480156102b057600080fd5b506102886004356109ca565b3480156102c857600080fd5b5061024a600160a060020a03600435811690602435166109f2565b3480156102ef57600080fd5b50610288610de9565b6060600280548060200260200160405190810160405280929190818152602001828054801561035057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610332575b5050505050905090565b600080546040805160e160020a632567646f028152600160a060020a039092163314600483015260248201819052606360448301527fd09ed0bfd0b5d180d0b0d186d0b8d18e20d0bcd0bed0b6d0b5d18220d0b2d18b60648301527fd0bfd0bed0bbd0bdd18fd182d18c20d182d0bed0bbd18cd0bad0be20d0b0d0b460848301527fd0bcd0b8d0bdd0b8d181d182d180d0b0d182d0bed1802055736572526567697360a48301527f747279000000000000000000000000000000000000000000000000000000000060c48301525173__./contracts/ErrorTest.sol:ErrorTest___91634acec8de9160e4808301926020929190829003018186803b15801561046357600080fd5b505af4158015610477573d6000803e3d6000fd5b505050506040513d602081101561048d57600080fd5b505115610499576108df565b600160a060020a0387811660009081526001602090815260409182902054825160e160020a632567646f028152931615600484015260248301829052606960448401527fd090d0bad0bad0b0d183d0bdd18220d0bcd0bed0b6d0b5d18220d0b1d18bd18260648401527fd18c20d0bfd180d0b8d0b2d18fd0b7d0b0d0bd20d182d0bed0bbd18cd0bad0be60848401527f20d0ba20d0bed0b4d0bdd0bed0bcd18320d0bfd0bed0bbd18cd0b7d0bed0b2d060a48401527fb0d182d0b5d0bbd18e000000000000000000000000000000000000000000000060c4840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260e4808301939192829003018186803b1580156105ae57600080fd5b505af41580156105c2573d6000803e3d6000fd5b505050506040513d60208110156105d857600080fd5b5051156105e4576108df565b8686868686866105f2610df8565b8087600160a060020a0316600160a060020a03168152602001806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b8381101561065457818101518382015260200161063c565b50505050905090810190601f1680156106815780820380516001836020036101000a031916815260200191505b5086810385528a5181528a516020918201918c019080838360005b838110156106b457818101518382015260200161069c565b50505050905090810190601f1680156106e15780820380516001836020036101000a031916815260200191505b5086810384528951815289516020918201918b019080838360005b838110156107145781810151838201526020016106fc565b50505050905090810190601f1680156107415780820380516001836020036101000a031916815260200191505b5086810383528851815288516020918201918a019080838360005b8381101561077457818101518382015260200161075c565b50505050905090810190601f1680156107a15780820380516001836020036101000a031916815260200191505b50868103825287518152875160209182019189019080838360005b838110156107d45781810151838201526020016107bc565b50505050905090810190601f1680156108015780820380516001836020036101000a031916815260200191505b509b505050505050505050505050604051809103906000f08015801561082b573d6000803e3d6000fd5b50600160a060020a038089166000818152600160208181526040808420805496881673ffffffffffffffffffffffffffffffffffffffff1997881681179091556002805494850181559094527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9092018054909516831790945580519283529282015281519293507fff3eabe1067b08ba8af3e8d3191eebeae9b35de7a7aeee40f2ad1ceb6a887607929081900390910190a15b50505050505050565b600254606090819060009085106108ff5760025494505b60025485850111156109145760025485900393505b8360405190808252806020026020018201604052801561093e578160200160208202803883390190505b5091508490505b8385018110156109a457600280548290811061095d57fe5b6000918252602090912001548251600160a060020a0390911690839087840390811061098557fe5b600160a060020a03909216602092830290910190910152600101610945565b509392505050565b600160a060020a039081166000908152600160205260409020541690565b60028054829081106109d857fe5b600091825260209091200154600160a060020a0316905081565b600080546040805160e160020a632567646f028152600160a060020a039092163314600483015260248201819052606360448301527fd09ed0bfd0b5d180d0b0d186d0b8d18e20d0bcd0bed0b6d0b5d18220d0b2d18b60648301527fd0bfd0bed0bbd0bdd18fd182d18c20d182d0bed0bbd18cd0bad0be20d0b0d0b460848301527fd0bcd0b8d0bdd0b8d181d182d180d0b0d182d0bed1802055736572526567697360a48301527f747279000000000000000000000000000000000000000000000000000000000060c48301525173__./contracts/ErrorTest.sol:ErrorTest___91634acec8de9160e4808301926020929190829003018186803b158015610afb57600080fd5b505af4158015610b0f573d6000803e3d6000fd5b505050506040513d6020811015610b2557600080fd5b505115610b3157610de4565b600160a060020a0383811660009081526001602090815260409182902054825160e160020a632567646f02815293161515600484015260248301829052602e60448401527fd09dd0b5d0bad0bed180d180d0b5d0bad182d0bdd18bd0b920d0b0d0b4d180d060648401527fb5d181206f6c644163636f756e740000000000000000000000000000000000006084840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260a4808301939192829003018186803b158015610bfb57600080fd5b505af4158015610c0f573d6000803e3d6000fd5b505050506040513d6020811015610c2557600080fd5b505180610d495750600160a060020a0382811660009081526001602090815260409182902054825160e160020a632567646f028152931615600484015260248301829052604f60448401527fd09a20d0b0d0bad0bad0b0d183d0bdd182d183206e65774163636f756e7420d160648401527f83d0b6d0b520d0bfd180d0b8d0b2d18fd0b7d0b0d0bd20d0bfd0bed0bbd18cd060848401527fb7d0bed0b2d0b0d182d0b5d0bbd18c000000000000000000000000000000000060a4840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260c4808301939192829003018186803b158015610d1c57600080fd5b505af4158015610d30573d6000803e3d6000fd5b505050506040513d6020811015610d4657600080fd5b50515b15610d5357610de4565b50600160a060020a038083166000818152600160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19808216909255878716808652948390208054909216961695861790558051858152918201939093528083019190915290517f2885fa4936e4b73dc3c07ab4db2cc5355e5357283a5f83d22b4ef1d35d6ec3cb9181900360600190a15b505050565b600054600160a060020a031681565b60405161127880610e0983390190560060806040523480156200001157600080fd5b5060405162001278380380620012788339810160409081528151602080840151928401516060850151608086015160a087015160008054600160a060020a031916600160a060020a0388161790559587018051959790969381019592810194918101930191620000889160019190880190620000ed565b5083516200009e906002906020870190620000ed565b508251620000b4906003906020860190620000ed565b508151620000ca906004906020850190620000ed565b508051620000e0906005906020840190620000ed565b5050505050505062000192565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200013057805160ff191683800117855562000160565b8280016001018555821562000160579182015b828111156200016057825182559160200191906001019062000143565b506200016e92915062000172565b5090565b6200018f91905b808211156200016e576000815560010162000179565b90565b6110d680620001a26000396000f3006080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063090f24fd1461016957806309218e911461018c5780630fa060d1146101a1578063107046bd146101c257806330923b78146101f65780635a9b0b89146102615780635dab2420146104865780637c56b7981461049b578063820e93f5146104bc5780639284f497146104d15780639ca65163146104e6578063a43b647f146104fb578063a84ce2b51461064c578063d28d7a2014610667575b600080fd5b3480156100eb57600080fd5b506100f461067f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018a600160a060020a036004351661070c565b005b34801561019857600080fd5b506100f461076b565b3480156101ad57600080fd5b5061018a600160a060020a03600435166107c6565b3480156101ce57600080fd5b506101da6004356108eb565b60408051600160a060020a039092168252519081900360200190f35b34801561020257600080fd5b50610211600435602435610913565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561024d578181015183820152602001610235565b505050509050019250505060405180910390f35b34801561026d57600080fd5b506102766109d7565b60405180806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b838110156102c35781810151838201526020016102ab565b50505050905090810190601f1680156102f05780820380516001836020036101000a031916815260200191505b5086810385528a5181528a516020918201918c019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b5086810384528951815289516020918201918b019080838360005b8381101561038357818101518382015260200161036b565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b5086810383528851815288516020918201918a019080838360005b838110156103e35781810151838201526020016103cb565b50505050905090810190601f1680156104105780820380516001836020036101000a031916815260200191505b50868103825287518152875160209182019189019080838360005b8381101561044357818101518382015260200161042b565b50505050905090810190601f1680156104705780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561049257600080fd5b506101da610cc1565b3480156104a757600080fd5b5061018a600160a060020a0360043516610cd0565b3480156104c857600080fd5b506100f4610d2f565b3480156104dd57600080fd5b506100f4610d87565b3480156104f257600080fd5b506100f4610de2565b34801561050757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261018a94369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610e3d9650505050505050565b34801561065857600080fd5b50610211600435602435610f21565b34801561067357600080fd5b506101da600435610fdd565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b820191906000526020600020905b8154815290600101906020018083116106e757829003601f168201915b505050505081565b600780546001810182556000919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6000805b6007548110156108935782600160a060020a03166007828154811015156107ed57fe5b600091825260209091200154600160a060020a0316141561080d57600191505b8180156108205750600754600019018114155b1561088b57600780546001830190811061083657fe5b60009182526020909120015460078054600160a060020a03909216918390811061085c57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6001016107ca565b81156108e6576007805460001981019081106108ab57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916905560078054906108e4906000198301610feb565b505b505050565b60068054829081106108f957fe5b600091825260209091200154600160a060020a0316905081565b6007546060908190600090851061092a5760075494505b600754858501111561093f5760075485900393505b83604051908082528060200260200182016040528015610969578160200160208202803883390190505b5091508490505b8385018110156109cf57600780548290811061098857fe5b6000918252602090912001548251600160a060020a039091169083908784039081106109b057fe5b600160a060020a03909216602092830290910190910152600101610970565b509392505050565b600180546040805160206002848616156101000260001901909416849004601f8101829004820283018201909352828252606094859485948594859460039260049260059290918791830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b820191906000526020600020905b815481529060010190602001808311610a5457829003601f168201915b5050875460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152959a5089945092508401905082828015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050865460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295995088945092508401905082828015610b8d5780601f10610b6257610100808354040283529160200191610b8d565b820191906000526020600020905b815481529060010190602001808311610b7057829003601f168201915b5050855460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295985087945092508401905082828015610c1b5780601f10610bf057610100808354040283529160200191610c1b565b820191906000526020600020905b815481529060010190602001808311610bfe57829003601f168201915b5050845460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295975086945092508401905082828015610ca95780601f10610c7e57610100808354040283529160200191610ca9565b820191906000526020600020905b815481529060010190602001808311610c8c57829003601f168201915b50505050509050945094509450945094509091929394565b600054600160a060020a031681565b600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b600054600160a060020a03163214610eb657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e656564206f726967696e616c20757365720000000000000000000000000000604482015290519081900360640190fd5b8451610ec990600190602088019061100f565b508351610edd90600290602087019061100f565b508251610ef190600390602086019061100f565b508151610f0590600490602085019061100f565b508051610f1990600590602084019061100f565b505050505050565b60065460609081906000908510610f385760065494505b6006548585011115610f4d5760065485900393505b83604051908082528060200260200182016040528015610f77578160200160208202803883390190505b5091508490505b8385018110156109cf576006805482908110610f9657fe5b6000918252602090912001548251600160a060020a03909116908390878403908110610fbe57fe5b600160a060020a03909216602092830290910190910152600101610f7e565b60078054829081106108f957fe5b8154818355818111156108e6576000838152602090206108e691810190830161108d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061105057805160ff191683800117855561107d565b8280016001018555821561107d579182015b8281111561107d578251825591602001919060010190611062565b5061108992915061108d565b5090565b6110a791905b808211156110895760008155600101611093565b905600a165627a7a723058208bcd65a45d6680addcc5a579e1646d8436932612a164e149d38ebcc2fa31478e0029a165627a7a72305820dedf4f5db3e47d25a947b61e8d1a8dbf0c776e37edc7bf20f0711c12cdf714460029'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ktulhy/PycharmProjects/server/deploy.py", line 220, in <module>
    deployer.deploy_all()
  File "/home/ktulhy/PycharmProjects/server/deploy.py", line 168, in deploy_all
    user_registry = self._deploy("UserRegistry", self.signatory.address)
  File "/home/ktulhy/PycharmProjects/server/deploy.py", line 135, in _deploy
    bytecode=interface['bin']
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/eth.py", line 367, in contract
    ContractFactory = ContractFactoryClass.factory(self.web3, **kwargs)
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/contract.py", line 268, in factory
    normalizers=normalizers)
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/utils/datatypes.py", line 33, in __new__
    namespace)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/eth_utils/functional.py", line 22, in inner
    return callback(fn(*args, **kwargs))
  File "/home/ktulhy/PycharmProjects/server/.venv/lib/python3.6/site-packages/web3/utils/formatters.py", line 70, in apply_formatters_to_dict
    raise type(exc)("Could not format value %r as field %r" % (item, key)) from exc
ValueError: Could not format value '608060405234801561001057600080fd5b506040516020806120fe833981016040525160008054600160a060020a03909216600160a060020a03199092169190911790556120ac806100526000396000f3006080604052600436106100815763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662ce8e3e81146100865780631a702aa0146100eb57806345982a661461024c5780636f77926b1461026757806373338081146102a4578063f172f871146102bc578063f851a440146102e3575b600080fd5b34801561009257600080fd5b5061009b6102f8565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156100d75781810151838201526020016100bf565b505050509050019250505060405180910390f35b3480156100f757600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261024a958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975061035a9650505050505050565b005b34801561025857600080fd5b5061009b6004356024356108e8565b34801561027357600080fd5b50610288600160a060020a03600435166109ac565b60408051600160a060020a039092168252519081900360200190f35b3480156102b057600080fd5b506102886004356109ca565b3480156102c857600080fd5b5061024a600160a060020a03600435811690602435166109f2565b3480156102ef57600080fd5b50610288610de9565b6060600280548060200260200160405190810160405280929190818152602001828054801561035057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610332575b5050505050905090565b600080546040805160e160020a632567646f028152600160a060020a039092163314600483015260248201819052606360448301527fd09ed0bfd0b5d180d0b0d186d0b8d18e20d0bcd0bed0b6d0b5d18220d0b2d18b60648301527fd0bfd0bed0bbd0bdd18fd182d18c20d182d0bed0bbd18cd0bad0be20d0b0d0b460848301527fd0bcd0b8d0bdd0b8d181d182d180d0b0d182d0bed1802055736572526567697360a48301527f747279000000000000000000000000000000000000000000000000000000000060c48301525173__./contracts/ErrorTest.sol:ErrorTest___91634acec8de9160e4808301926020929190829003018186803b15801561046357600080fd5b505af4158015610477573d6000803e3d6000fd5b505050506040513d602081101561048d57600080fd5b505115610499576108df565b600160a060020a0387811660009081526001602090815260409182902054825160e160020a632567646f028152931615600484015260248301829052606960448401527fd090d0bad0bad0b0d183d0bdd18220d0bcd0bed0b6d0b5d18220d0b1d18bd18260648401527fd18c20d0bfd180d0b8d0b2d18fd0b7d0b0d0bd20d182d0bed0bbd18cd0bad0be60848401527f20d0ba20d0bed0b4d0bdd0bed0bcd18320d0bfd0bed0bbd18cd0b7d0bed0b2d060a48401527fb0d182d0b5d0bbd18e000000000000000000000000000000000000000000000060c4840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260e4808301939192829003018186803b1580156105ae57600080fd5b505af41580156105c2573d6000803e3d6000fd5b505050506040513d60208110156105d857600080fd5b5051156105e4576108df565b8686868686866105f2610df8565b8087600160a060020a0316600160a060020a03168152602001806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b8381101561065457818101518382015260200161063c565b50505050905090810190601f1680156106815780820380516001836020036101000a031916815260200191505b5086810385528a5181528a516020918201918c019080838360005b838110156106b457818101518382015260200161069c565b50505050905090810190601f1680156106e15780820380516001836020036101000a031916815260200191505b5086810384528951815289516020918201918b019080838360005b838110156107145781810151838201526020016106fc565b50505050905090810190601f1680156107415780820380516001836020036101000a031916815260200191505b5086810383528851815288516020918201918a019080838360005b8381101561077457818101518382015260200161075c565b50505050905090810190601f1680156107a15780820380516001836020036101000a031916815260200191505b50868103825287518152875160209182019189019080838360005b838110156107d45781810151838201526020016107bc565b50505050905090810190601f1680156108015780820380516001836020036101000a031916815260200191505b509b505050505050505050505050604051809103906000f08015801561082b573d6000803e3d6000fd5b50600160a060020a038089166000818152600160208181526040808420805496881673ffffffffffffffffffffffffffffffffffffffff1997881681179091556002805494850181559094527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9092018054909516831790945580519283529282015281519293507fff3eabe1067b08ba8af3e8d3191eebeae9b35de7a7aeee40f2ad1ceb6a887607929081900390910190a15b50505050505050565b600254606090819060009085106108ff5760025494505b60025485850111156109145760025485900393505b8360405190808252806020026020018201604052801561093e578160200160208202803883390190505b5091508490505b8385018110156109a457600280548290811061095d57fe5b6000918252602090912001548251600160a060020a0390911690839087840390811061098557fe5b600160a060020a03909216602092830290910190910152600101610945565b509392505050565b600160a060020a039081166000908152600160205260409020541690565b60028054829081106109d857fe5b600091825260209091200154600160a060020a0316905081565b600080546040805160e160020a632567646f028152600160a060020a039092163314600483015260248201819052606360448301527fd09ed0bfd0b5d180d0b0d186d0b8d18e20d0bcd0bed0b6d0b5d18220d0b2d18b60648301527fd0bfd0bed0bbd0bdd18fd182d18c20d182d0bed0bbd18cd0bad0be20d0b0d0b460848301527fd0bcd0b8d0bdd0b8d181d182d180d0b0d182d0bed1802055736572526567697360a48301527f747279000000000000000000000000000000000000000000000000000000000060c48301525173__./contracts/ErrorTest.sol:ErrorTest___91634acec8de9160e4808301926020929190829003018186803b158015610afb57600080fd5b505af4158015610b0f573d6000803e3d6000fd5b505050506040513d6020811015610b2557600080fd5b505115610b3157610de4565b600160a060020a0383811660009081526001602090815260409182902054825160e160020a632567646f02815293161515600484015260248301829052602e60448401527fd09dd0b5d0bad0bed180d180d0b5d0bad182d0bdd18bd0b920d0b0d0b4d180d060648401527fb5d181206f6c644163636f756e740000000000000000000000000000000000006084840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260a4808301939192829003018186803b158015610bfb57600080fd5b505af4158015610c0f573d6000803e3d6000fd5b505050506040513d6020811015610c2557600080fd5b505180610d495750600160a060020a0382811660009081526001602090815260409182902054825160e160020a632567646f028152931615600484015260248301829052604f60448401527fd09a20d0b0d0bad0bad0b0d183d0bdd182d183206e65774163636f756e7420d160648401527f83d0b6d0b520d0bfd180d0b8d0b2d18fd0b7d0b0d0bd20d0bfd0bed0bbd18cd060848401527fb7d0bed0b2d0b0d182d0b5d0bbd18c000000000000000000000000000000000060a4840152905173__./contracts/ErrorTest.sol:ErrorTest___92634acec8de9260c4808301939192829003018186803b158015610d1c57600080fd5b505af4158015610d30573d6000803e3d6000fd5b505050506040513d6020811015610d4657600080fd5b50515b15610d5357610de4565b50600160a060020a038083166000818152600160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19808216909255878716808652948390208054909216961695861790558051858152918201939093528083019190915290517f2885fa4936e4b73dc3c07ab4db2cc5355e5357283a5f83d22b4ef1d35d6ec3cb9181900360600190a15b505050565b600054600160a060020a031681565b60405161127880610e0983390190560060806040523480156200001157600080fd5b5060405162001278380380620012788339810160409081528151602080840151928401516060850151608086015160a087015160008054600160a060020a031916600160a060020a0388161790559587018051959790969381019592810194918101930191620000889160019190880190620000ed565b5083516200009e906002906020870190620000ed565b508251620000b4906003906020860190620000ed565b508151620000ca906004906020850190620000ed565b508051620000e0906005906020840190620000ed565b5050505050505062000192565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200013057805160ff191683800117855562000160565b8280016001018555821562000160579182015b828111156200016057825182559160200191906001019062000143565b506200016e92915062000172565b5090565b6200018f91905b808211156200016e576000815560010162000179565b90565b6110d680620001a26000396000f3006080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063090f24fd1461016957806309218e911461018c5780630fa060d1146101a1578063107046bd146101c257806330923b78146101f65780635a9b0b89146102615780635dab2420146104865780637c56b7981461049b578063820e93f5146104bc5780639284f497146104d15780639ca65163146104e6578063a43b647f146104fb578063a84ce2b51461064c578063d28d7a2014610667575b600080fd5b3480156100eb57600080fd5b506100f461067f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018a600160a060020a036004351661070c565b005b34801561019857600080fd5b506100f461076b565b3480156101ad57600080fd5b5061018a600160a060020a03600435166107c6565b3480156101ce57600080fd5b506101da6004356108eb565b60408051600160a060020a039092168252519081900360200190f35b34801561020257600080fd5b50610211600435602435610913565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561024d578181015183820152602001610235565b505050509050019250505060405180910390f35b34801561026d57600080fd5b506102766109d7565b60405180806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b838110156102c35781810151838201526020016102ab565b50505050905090810190601f1680156102f05780820380516001836020036101000a031916815260200191505b5086810385528a5181528a516020918201918c019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b5086810384528951815289516020918201918b019080838360005b8381101561038357818101518382015260200161036b565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b5086810383528851815288516020918201918a019080838360005b838110156103e35781810151838201526020016103cb565b50505050905090810190601f1680156104105780820380516001836020036101000a031916815260200191505b50868103825287518152875160209182019189019080838360005b8381101561044357818101518382015260200161042b565b50505050905090810190601f1680156104705780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561049257600080fd5b506101da610cc1565b3480156104a757600080fd5b5061018a600160a060020a0360043516610cd0565b3480156104c857600080fd5b506100f4610d2f565b3480156104dd57600080fd5b506100f4610d87565b3480156104f257600080fd5b506100f4610de2565b34801561050757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261018a94369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610e3d9650505050505050565b34801561065857600080fd5b50610211600435602435610f21565b34801561067357600080fd5b506101da600435610fdd565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b820191906000526020600020905b8154815290600101906020018083116106e757829003601f168201915b505050505081565b600780546001810182556000919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6000805b6007548110156108935782600160a060020a03166007828154811015156107ed57fe5b600091825260209091200154600160a060020a0316141561080d57600191505b8180156108205750600754600019018114155b1561088b57600780546001830190811061083657fe5b60009182526020909120015460078054600160a060020a03909216918390811061085c57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6001016107ca565b81156108e6576007805460001981019081106108ab57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916905560078054906108e4906000198301610feb565b505b505050565b60068054829081106108f957fe5b600091825260209091200154600160a060020a0316905081565b6007546060908190600090851061092a5760075494505b600754858501111561093f5760075485900393505b83604051908082528060200260200182016040528015610969578160200160208202803883390190505b5091508490505b8385018110156109cf57600780548290811061098857fe5b6000918252602090912001548251600160a060020a039091169083908784039081106109b057fe5b600160a060020a03909216602092830290910190910152600101610970565b509392505050565b600180546040805160206002848616156101000260001901909416849004601f8101829004820283018201909352828252606094859485948594859460039260049260059290918791830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b820191906000526020600020905b815481529060010190602001808311610a5457829003601f168201915b5050875460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152959a5089945092508401905082828015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050865460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295995088945092508401905082828015610b8d5780601f10610b6257610100808354040283529160200191610b8d565b820191906000526020600020905b815481529060010190602001808311610b7057829003601f168201915b5050855460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295985087945092508401905082828015610c1b5780601f10610bf057610100808354040283529160200191610c1b565b820191906000526020600020905b815481529060010190602001808311610bfe57829003601f168201915b5050845460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295975086945092508401905082828015610ca95780601f10610c7e57610100808354040283529160200191610ca9565b820191906000526020600020905b815481529060010190602001808311610c8c57829003601f168201915b50505050509050945094509450945094509091929394565b600054600160a060020a031681565b600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107045780601f106106d957610100808354040283529160200191610704565b600054600160a060020a03163214610eb657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e656564206f726967696e616c20757365720000000000000000000000000000604482015290519081900360640190fd5b8451610ec990600190602088019061100f565b508351610edd90600290602087019061100f565b508251610ef190600390602086019061100f565b508151610f0590600490602085019061100f565b508051610f1990600590602084019061100f565b505050505050565b60065460609081906000908510610f385760065494505b6006548585011115610f4d5760065485900393505b83604051908082528060200260200182016040528015610f77578160200160208202803883390190505b5091508490505b8385018110156109cf576006805482908110610f9657fe5b6000918252602090912001548251600160a060020a03909116908390878403908110610fbe57fe5b600160a060020a03909216602092830290910190910152600101610f7e565b60078054829081106108f957fe5b8154818355818111156108e6576000838152602090206108e691810190830161108d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061105057805160ff191683800117855561107d565b8280016001018555821561107d579182015b8281111561107d578251825591602001919060010190611062565b5061108992915061108d565b5090565b6110a791905b808211156110895760008155600101611093565b905600a165627a7a723058208bcd65a45d6680addcc5a579e1646d8436932612a164e149d38ebcc2fa31478e0029a165627a7a72305820dedf4f5db3e47d25a947b61e8d1a8dbf0c776e37edc7bf20f0711c12cdf714460029' as field 'bytecode'

Command:

compiled_files = compile_files(
    ['./contracts/Project.sol'],
    optimize=True
)

# get interface from file Project.sol

w3.eth.contract(
    abi=interface['abi'],
    bytecode=interface['bin']
)

ErrorTest.sol:

pragma solidity ^0.4.24;


library ErrorTest {
    event Error(string m);

    function error(bool cond, string message) returns(bool) {
        if (!cond) {
            emit Error(message);
            return true;
        }
        return false;
    }
}

and in Project.sol that uses as:

if (ErrorTest.error(projectState == state, "Error Message")) {
    return;
}

Cute Animal

caterpillar2__880

python -m solc.install v0.4.11 gives "Empty installation"

  • py-solc Version: 1.4.0
  • solc Version: 0.4.11
  • Python Version: 3.5
  • OS: osx

What was wrong?

Running python -m solc.install v0.4.11

... does not complete:

==> Caveats
To have launchd start ethereum/ethereum/ethereum now and restart at login:
  brew services start ethereum/ethereum/ethereum
==> Summary
๐Ÿบ  /usr/local/Cellar/ethereum/1.7.2: 10 files, 51.2MB, built in 1 minute 32 seconds
==> Upgrading paritytech/paritytech/parity --stable
==> Downloading http://d1h4xl4cr1h0mo.cloudfront.net/v1.7.9/x86_64-apple-darwin/parity
Already downloaded: /Users/mikkoohtamaa/Library/Caches/Homebrew/parity-1.7.9
Error: Empty installation
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/mikkoohtamaa/code/tm/trading/venv/lib/python3.5/site-packages/solc/install.py", line 483, in <module>
    install_solc(identifier)
  File "/Users/mikkoohtamaa/code/tm/trading/venv/lib/python3.5/site-packages/solc/install.py", line 473, in install_solc
    install_fn()
  File "/Users/mikkoohtamaa/code/tm/trading/venv/lib/python3.5/site-packages/solc/install.py", line 406, in install_from_source
    install_solc_dependencies(identifier)
  File "/Users/mikkoohtamaa/code/tm/trading/venv/lib/python3.5/site-packages/solc/install.py", line 301, in install_solc_dependencies
    install_deps_script_path,
  File "/Users/mikkoohtamaa/code/tm/trading/venv/lib/python3.5/site-packages/solc/install.py", line 98, in check_subprocess_call
    **proc_kwargs
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sh', '/Users/mikkoohtamaa/.py-solc/solc-v0.4.11/source/scripts/install_deps.sh']' returned non-zero exit status 1
make: *** [install-solc-0-4-11] Error 1

Not sure what Empty installation means.

Cute Animal Picture

 
   ______________
   |  D.A.B.'S  |            (__)          (__)          (__)          (__)
   |    USED    |            (uu)          (uu)          (uu)          (uu)
   |    COWS    |     /-------\/    /-------\/    /-------\/    /-------\/
   |____________|   / |     ||    / |     ||    / |     ||    / |     ||
         ||        *  ||----||   *  ||----||   *  ||----||   *  ||----||
         ||           ~~    ~~      ~~    ~~      ~~    ~~      ~~    ~~
   ______||_______
   | EASY CREDIT |           (__)          (__)          (__)          (__)
   |_____________|           (uu)          (uu)          (uu)          (uu)
         ||           /-------\/    /-------\/    /-------\/    /-------\/
         ||          / |     ||    / |     ||    / |     ||    / |     ||
         ||         *  ||----||   *  ||----||   *  ||----||   *  ||----||
         ||            ~~    ~~      ~~    ~~      ~~    ~~      ~~    ~~

PermissionError: [Errno 13] Permission denied: 'solc'

  • py-solc Version: x.x.x
  • solc Version: x.x.x
  • Python Version: x.x.x
  • OS: linux

What was wrong?

i'm using the buildozer to build a apk,i needed solc in the android phone,

my buildozer requirements = python3,kivy,web3,eth-account==0.3.0,cytoolz,setuptools,toolz,ethereum,eth-keyfile,pycryptodome,eth-keys,eth-utils,eth-hash,eth-typing,hexbytes,eth-rlp,rlp,attrdict,eth-abi,parsimonious,idna,lru-dict,requests,websockets,py-solc,semantic_version

my error log is
05-26 13:04:01.696 16531 16554 I python : Initializing Python for Android
05-26 13:04:01.696 16531 16554 I python : Setting additional env vars from p4a_env_vars.txt
05-26 13:04:01.696 16531 16554 I python : Changing directory to the one provided by ANDROID_ARGUMENT
05-26 13:04:01.696 16531 16554 I python : /data/user/0/org.test.myapp/files/app
05-26 13:04:01.697 16531 16554 I python : Preparing to initialize python
05-26 13:04:01.697 16531 16554 I python : _python_bundle dir exists
05-26 13:04:01.697 16531 16554 I python : calculated paths to be...
05-26 13:04:01.697 16531 16554 I python : /data/user/0/org.test.myapp/files/app/_python_bundle/stdlib.zip:/data/user/0/org.test.myapp/files/app/_python_bundle/modules
05-26 13:04:01.698 16531 16554 I python : set wchar paths...
05-26 13:04:01.847 16531 16554 I python : Initialized python
05-26 13:04:01.847 16531 16554 I python : AND: Init threads
05-26 13:04:01.850 16531 16554 I python : testing python print redirection
05-26 13:04:01.853 16531 16554 I python : Android path ['.', '/data/user/0/org.test.myapp/files/app/_python_bundle/stdlib.zip', '/data/user/0/org.test.myapp/files/app/_python_bundle/modules', '/data/user/0/org.test.myapp/files/app/_python_bundle/site-packages']
05-26 13:04:01.854 16531 16554 I python : os.environ is environ({'PATH': '/sbin:/system/sbin:/system/bin:/system/xbin:/vendor/bin:/vendor/xbin', 'DOWNLOAD_CACHE': '/data/cache', 'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'ANDROID_ASSETS': '/system/app', 'ANDROID_DATA': '/data', 'ANDROID_STORAGE': '/storage', 'EXTERNAL_STORAGE': '/sdcard', 'ASEC_MOUNTPOINT': '/mnt/asec', 'BOOTCLASSPATH': '/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/bouncycastle.jar:/system/framework/apache-xml.jar:/system/framework/legacy-test.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/org.apache.http.legacy.boot.jar:/system/framework/android.hidl.base-V1.0-java.jar:/system/framework/android.hidl.manager-V1.0-java.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/mediatek-telephony-common.jar:/system/framework/mediatek-telephony-base.jar:/system/framework/mediatek-ims-common.jar:/system/framework/mediatek-telecom-common.jar', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar', 'ANDROID_SOCKET_zygote': '8', 'ANDROID_ENTRYPOINT': 'main.pyc', 'ANDROID_ARGUMENT': '/data/user/0/org.test.myapp/files/app', 'ANDROID_APP_PATH': '/data/user/0/org.test.myapp/files/app', 'ANDROID_PRIVATE': '/data/user/0/org.test.myapp/files', 'ANDROID_UNPACK': '/data/user/0/org.test.myapp/files/app', 'PYTHONHOME': '/data/user/0/org.test.myapp/files/app', 'PYTHONPATH': '/data/user/0/org.test.myapp/files/app:/data/user/0/org.test.myapp/files/app/lib', 'PYTHONOPTIMIZE': '2', 'P4A_BOOTSTRAP': 'SDL2', 'PYTHON_NAME': 'python', 'P4A_IS_WINDOWED': 'True', 'P4A_ORIENTATION': 'portrait', 'P4A_NUMERIC_VERSION': 'None', 'P4A_MINSDK': '21', 'LC_CTYPE': 'C.UTF-8'})
05-26 13:04:01.854 16531 16554 I python : Android kivy bootstrap done. name is main
05-26 13:04:01.854 16531 16554 I python : AND: Ran string
05-26 13:04:01.854 16531 16554 I python : Run user program, change dir and execute entrypoint
05-26 13:04:02.279 16531 16554 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.myapp/files/app/.kivy/logs/kivy_19-05-26_2.txt
05-26 13:04:02.280 16531 16554 I python : [INFO ] [Kivy ] v1.11.0.dev0, git-Unknown, 20190524
05-26 13:04:02.281 16531 16554 I python : [INFO ] [Python ] v3.7.1 (default, May 25 2019, 02:03:11)
05-26 13:04:02.281 16531 16554 I python : [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
05-26 13:04:04.571 16531 16554 I python : [INFO ] [Factory ] 184 symbols loaded
05-26 13:04:05.689 16531 16554 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
05-26 13:04:12.989 16531 16554 I python : Traceback (most recent call last):
05-26 13:04:12.990 16531 16554 I python : File "/home/wyc/.buildozer/android/app/main.py", line 55, in
05-26 13:04:12.992 16531 16554 I python : File "/home/wyc/.buildozer/android/platform/build/build/python-installs/myapp/solc/main.py", line 108, in compile_source
05-26 13:04:12.994 16531 16554 I python : File "/home/wyc/.buildozer/android/platform/build/build/python-installs/myapp/solc/utils/string.py", line 85, in inner
05-26 13:04:12.996 16531 16554 I python : File "/home/wyc/.buildozer/android/platform/build/build/python-installs/myapp/solc/wrapper.py", line 159, in solc_wrapper
05-26 13:04:12.998 16531 16554 I python : File "/home/wyc/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/subprocess.py", line 769, in init
05-26 13:04:13.000 16531 16554 I python : File "/home/wyc/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/subprocess.py", line 1516, in _execute_child
05-26 13:04:13.001 16531 16554 I python : PermissionError: [Errno 13] Permission denied: 'solc'
05-26 13:04:13.002 16531 16554 I python : Python for android ended.

why there is a permissionerror?

Cute Animal Picture

ๅ›พ็‰‡

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

  • py-solc Version: 3.0.0
  • solc Version: 0.5.0
  • Python Version: 3.5.3
  • OS: Linux debian 9

What was wrong?

solc does not take the system argument "--combined-json" and returns an error
"Invalid option to --combined-json: clone-bin"


tried like this: https://stackoverflow.com/questions/50238914/py-solc-and-solidity-imports

root@debian9:~dev/eth/# solc --version    
solc, the solidity compiler commandline interface                                    
Version: 0.5.0-develop.2018.10.17+commit.72b1bb00.mod.Linux.g++    

root@debian9:~dev/eth/# python3.5       
Python 3.5.3 (default, Sep 27 2018, 17:25:39)                                      
[GCC 6.3.0 20170516] on linux                                                      
Type "help", "copyright", "credits" or "license" for more information.             
>>> import os
>>> from solc import compile_files
>>> PROJECT_ROOT = os.getcwd()
>>> compiled_sol = compile_files([os.path.join(PROJECT_ROOT, "bar.sol"), os.path.join(PROJECT_
ROOT, "baz.sol")])                                                                            
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/solc/main.py", line 135, in compile_files
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/solc/wrapper.py", line 165, 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,opcode
s,userdoc /root/dev/eth/bar.sol /root/dev/eth/`
> return code: `1`
> stderr:

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

FileNotFoundError: [WinError 2] The system cannot find the file specified

  • py-solc Version: 2.1.0
  • solc Version: 0.4.17
  • Python Version: 3.6
  • OS: win

What was wrong?

I try to compile a contract like this:

import json
import web3
import sys

from solc import compile_standard,compile_source,compile_files, link_code
from web3.contract import ConciseContract

compile_standard({'language': 'Solidity','sources': 'MetaCoin.sol'})

Executing this function returns an error:

Traceback (most recent call last):
  File "C:/Users/com/PycharmProjects/test/testCompile.py", line 35, in <module>
    compiled_sol = compile_source(contract_source_code)
  File "C:\Users\com\PycharmProjects\test\venv\lib\site-packages\solc\main.py", line 106, in compile_source
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "C:\Users\com\PycharmProjects\test\venv\lib\site-packages\solc\utils\string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "C:\Users\com\PycharmProjects\test\venv\lib\site-packages\solc\wrapper.py", line 155, in solc_wrapper
    stderr=subprocess.PIPE)
  File "D:\Anaconda3\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "D:\Anaconda3\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

How can I fix it?

Cute Animal Picture

put a cute animal picture here.
default

Broken Link in CONTRIBUTING.md

The link to the Pull request guide does not work.

"GitHub's documentation for working on pull requests is [available here][pull-requests]."

Please archive this repo

It's really confusing to python engineers getting into this space looking to use this repo since it's deprecated.

Can you please point all users who reach here to get re-routed to py-solc-x that is maintained? As someone who cares deeply about the ETH community, it really frustrating for new people to show up, expect to be able to use something, and then nothing works correctly.

https://github.com/iamdefinitelyahuman/py-solc-x

Implement a Python-C binding to Soldity

Solidity has a JSON-based interface written in C to compiler contracts. The input is a JSON formatted list of contracts and the output is a JSON with bytecode, assembly, etc. (all the features of the commandline compiler).

This C interface (located in solc/jsonCompiler.cpp) could be used to write an FFI binding in Python. It is already compiled as a library (libsoljson).

Add support for solc 0.5.0

  • py-solc Version: 3.2.0
  • solc Version: 0.5.0
  • Python Version: 3.6.7
  • OS: linux

To keep up to date with the latest changes, it would be nice to have support for the latest solc version. On my machine that'd be 0.5.0+commit.1d4f565a.Linux.g++ - installed from the Ethereum PPA:
deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main

Background: Mythril is using py-solc as a wrapper to provide various solc versions as the contracts to scan require it. Having an up-to-date wrapper greatly helps us to keep our code clean from hacky workarounds. ๐Ÿ™‚

What was wrong?

Traceback (most recent call last):
  File "/home/spoons/diligence/mythril-classic/myth", line 9, in <module>
    mythril.interfaces.cli.main()
  File "/home/spoons/diligence/mythril-classic/mythril/interfaces/cli.py", line 282, in main
    enable_online_lookup=args.query_signature,
  File "/home/spoons/diligence/mythril-classic/mythril/mythril.py", line 120, in __init__
    self.solc_binary = self._init_solc_binary(solv)
  File "/home/spoons/diligence/mythril-classic/mythril/mythril.py", line 245, in _init_solc_binary
    solc.install_solc("v" + version)
  File "/home/spoons/diligence/mythril-classic/.tox/py36/lib/python3.6/site-packages/solc/install.py", line 508, in install_solc
    ', '.join(sorted(INSTALL_FUNCTIONS[platform].keys())),
ValueError: Installation of solidity==v0.5.0 is not supported.  Must be one of v0.4.1, v0.4.11, v0.4.12, v0.4.13, v0.4.14, v0.4.15, v0.4.16, v0.4.17, v0.4.18, v0.4.19, v0.4.2, v0.4.20, v0.4.21, v0.4.22, v0.4.23, v0.4.24, v0.4.25, v0.4.6, v0.4.7, v0.4.8, v0.4.9

Cute Animal Picture

image

install_solc support for solc release v0.4.25

  • py-solc Version: 3.1.0
  • solc Version: 0.4.25
  • Python Version: 3.6.5
  • OS: osx & linux

What was wrong?

Solc v0.4.25 was released. It would be nice to add install support.

Cute Animal Picture

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.