All Projects → ethereum → Py Solc

ethereum / Py Solc

Licence: mit
Python wrapper around the solc Solidity compiler.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
solidity
1140 projects

Projects that are alternatives of or similar to Py Solc

Open Bounty
Enable communities to distribute funds to push their cause forward.
Stars: ✭ 121 (-3.97%)
Mutual labels:  blockchain, ethereum
Cryptocurrencyawesome
Cryptocurrency study materials resources
Stars: ✭ 118 (-6.35%)
Mutual labels:  blockchain, ethereum
Eth Cli
CLI swiss army knife for Ethereum developers
Stars: ✭ 109 (-13.49%)
Mutual labels:  blockchain, ethereum
Blockapi
A general framework for blockchain analytics
Stars: ✭ 111 (-11.9%)
Mutual labels:  blockchain, ethereum
Go Web3
Ethereum Go Client [obsolete]
Stars: ✭ 120 (-4.76%)
Mutual labels:  blockchain, ethereum
Hydro Scaffold Dex
A Decentralized Exchange Scaffold - launch a DEX in minutes
Stars: ✭ 112 (-11.11%)
Mutual labels:  blockchain, ethereum
Cyb Archeology
🌎 Personal immortal robot for the The Great Web
Stars: ✭ 117 (-7.14%)
Mutual labels:  blockchain, ethereum
Truffle
A tool for developing smart contracts. Crafted with the finest cacaos.
Stars: ✭ 11,909 (+9351.59%)
Mutual labels:  blockchain, ethereum
Stocklook
crypto currency library for trading & market making bots, account management, and data analysis
Stars: ✭ 119 (-5.56%)
Mutual labels:  blockchain, ethereum
Ethereumjs Blockchain
Project is in active development and has been moved to the EthereumJS VM monorepo.
Stars: ✭ 119 (-5.56%)
Mutual labels:  blockchain, ethereum
Vscode Azure Blockchain Ethereum
Blockchain extension for VS Code
Stars: ✭ 111 (-11.9%)
Mutual labels:  blockchain, ethereum
Ethvtx
🌀🛰 ethereum-ready & framework-agnostic redux store configuration
Stars: ✭ 125 (-0.79%)
Mutual labels:  blockchain, ethereum
Backend Ico Dashboard
Free & open-source dashboard for your next ICO, crowdsale or tokensale
Stars: ✭ 110 (-12.7%)
Mutual labels:  blockchain, ethereum
Remix Ide
Documentation for Remix IDE
Stars: ✭ 1,768 (+1303.17%)
Mutual labels:  blockchain, ethereum
Ergo
The Language for Smart Legal Contracts
Stars: ✭ 108 (-14.29%)
Mutual labels:  blockchain, ethereum
Desktop
The official Musicoin Desktop Wallet Application
Stars: ✭ 112 (-11.11%)
Mutual labels:  blockchain, ethereum
Smart Contract Sanctuary
🐦🌴🌴🌴🦕 A home for ethereum smart contracts. 🏠
Stars: ✭ 99 (-21.43%)
Mutual labels:  blockchain, ethereum
Learn Solidity With Examples
A repo full of smart contracts written in Solidity
Stars: ✭ 106 (-15.87%)
Mutual labels:  blockchain, ethereum
Mosaic Contracts
Mosaic-0: Gateways and anchors on top of Ethereum to scale DApps
Stars: ✭ 119 (-5.56%)
Mutual labels:  blockchain, ethereum
Mythril
Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
Stars: ✭ 1,968 (+1461.9%)
Mutual labels:  blockchain, ethereum

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].