Skip to main content

Python wrapper around the solc binary

Project description

# py-solc

[![Build Status](https://travis-ci.org/pipermerriam/py-solc.png)](https://travis-ci.org/pipermerriam/py-solc)
[![PyPi version](https://pypip.in/v/py-solc/badge.png)](https://pypi-hypernode.com/pypi/py-solc)
[![PyPi downloads](https://pypip.in/d/py-solc/badge.png)](https://pypi-hypernode.com/pypi/py-solc)


Python wrapper around the `solc` Solidity compiler.


# Dependency

This library requires the `solc` executable to be present.

solc 0.3.5 or newer is required. [solc installation instructions](http://solidity.readthedocs.io/en/latest/installing-solidity.html)


# Quickstart

Installation

```sh
pip install py-solc
```

```python
>>> 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"
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-solc-0.3.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distributions

py_solc-0.3.0-py2-none-any.whl (8.3 kB view details)

Uploaded Python 2

py-solc-0.3.0.macosx-10.11-x86_64.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file py-solc-0.3.0.tar.gz.

File metadata

  • Download URL: py-solc-0.3.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py-solc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 497dc194271262113e272ac7d31f7902bdfb826b34c5b9e4ac6cdddb72a4114f
MD5 7bfec40a42468f9e63ce3fe68c208e43
BLAKE2b-256 c6559366f996fb5de5e36fd0cde2727d8e393486d3c02638af40449fdc6a2338

See more details on using hashes here.

File details

Details for the file py_solc-0.3.0-py2-none-any.whl.

File metadata

File hashes

Hashes for py_solc-0.3.0-py2-none-any.whl
Algorithm Hash digest
SHA256 a02fde2b22e5f4f939fc3a8361519726e4ac613f2439e65079817dc133d36752
MD5 33eeea4f8498ee74df3b3c10609cf5b7
BLAKE2b-256 a1b374b545667672ad72aef0d6a47dcfbccbbcb00a0af025c1fc826e93da987f

See more details on using hashes here.

File details

Details for the file py-solc-0.3.0.macosx-10.11-x86_64.tar.gz.

File metadata

File hashes

Hashes for py-solc-0.3.0.macosx-10.11-x86_64.tar.gz
Algorithm Hash digest
SHA256 e57509a60c3113a1a51e8f1291ea8fce852c5788f140695d71a4189f3077942b
MD5 ec607f317e8f7d25af9bcb415d06e2df
BLAKE2b-256 37f6c71e06b1318dfb2cf20c2eb70ecb27e1b51033e8bb82e64dbbfef4852ef3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page