networks.yml

networks.yml is the YAML file you use to configure connections to Ethereum JSON-RPC providers and nodes. Some templates may provide some pre-configured connections.

Default File

This is the default networks.yml provided by the bare template:

# networks.yml
---
dev:
  type: auto

test:
  type: eth_tester
  autodeploy_allowed: true
  use_default_account: true

infura-mainnet:
  type: websocket
  url: wss://mainnet.infura.io/ws

geth:
  type: ipc
  file: ~/.ethereum/geth.ipc

Each root-level node is the network name you will use to reference the configuration. For instance using the above file, if you want to connect to your local go-ethereum IPC endpoint: sb console geth

Connection Parameters

type

The available connection types are:

  • auto - Setting the connection to auto will allow web3.py to automagically try common configurations for a connection.
  • websocket - Connect to a Web socket JSON-RPC provider
  • http - Connect to a plain HTTP(or HTTPS) JSON-RPC provider
  • ipc - Use the local IPC socket to connect to a local node
  • eth_tester - A virtual ephemeral chain to test against. Very useful for running unit tests. NOTE: eth_tester is in alpha and has been known to show bugs.

url

The URL endpoint to connect to. Only available for http and websocket.

file

The IPC socket to connect to. Only available for type ipc.

autodeploy_allowed

This is a per-network setting that allows Solidbyte to automatically deploy your contracts if it needs to use this network. This is great for test backends, but use at your own risk on public networks. This defaults to false.

use_default_account

This allows the network to use the account set as default for deployment and testing. This defaults to false for safety.

Infura

To use Solidbyte with Infura, make sure you register for an API key and set the WEB3_INFURA_API_KEY environmental variable. For more information, see the Web3.py Infura Documentation