class populus.project.BaseChain

The Project class is the primary entry point to all aspects of your populus project.

Basic Usage

  • Project(config_file_path=None)

When instantaited with no arguments, the project will look for a populus.json file found in the current working directory and load that if found.

from populus.project import Project
# loads local `populus.json` file (if present)
project = Project()

# loads the specified config file
other_project = Project('/path/to/other/populus.json')

The project object is the entry point for almost everything that populus can do.

>>> project.project_dir
>>> project.contracts_dir
>>> project.config
{....}  # Your project configuration.
>>> project.compiled_contract_data
  'Greeter': {
    'code': '0x...',
    'code_runtime': '0x...',
    'abi': [...],
>>> with p.get_chain('temp') as chain:
...     print(chain.web3.eth.coinbase)



Returns the current project configuration.


Loads the project configuration from disk, populating Project.config.


Writes the current project configuration from Project.config to disk.


Project.get_chain(chain_name, chain_config=None)``

Returns a populus.chain.Chain instance. You may provide chain_config in which case the chain will be configured using the provided configuration rather than the declared configuration for this chain from your configuration file.

The returned Chain instance can be used as a context manager.