solitude.server module

class solitude.server.ETHTestServer(executable='ganache-cli', host='127.0.0.1', port: int = 8545, accounts: List[Tuple[str, int]] = None, blocktime: Optional[float] = None, gasprice=20000000000, gaslimit=6721975)[source]

Bases: object

Wrapper around the ganache-cli executable

__init__(executable='ganache-cli', host='127.0.0.1', port: int = 8545, accounts: List[Tuple[str, int]] = None, blocktime: Optional[float] = None, gasprice=20000000000, gaslimit=6721975)[source]

Create a ganache-cli server instance

Parameters:
  • executable – path to the ganache-cli executable file
  • host – address of the interface to which the server will bind to
  • port – port on which the server will listen
  • accounts – list of accounts to create on the server, as a list of (private_key, wei_balance) tuples, where private_key is a hex string of 32 bytes prefixed with “0x”.
  • blocktime – if not None, enable automatic mining with blocktime interval, in seconds.
  • gasprice – price of gas (wei)
  • gaslimit – gas limit
endpoint

Endpoint URL

is_alive() → bool[source]

Check if the ganache-cli process is running

Returns:True if ganache-cli is running
kill(timeout: float = 1.0) → None[source]

Forcibly kill (SIGKILL) the ganache-cli process and wait

Parameters:timeout – time to wait for ganache-cli to terminate
start(timeout: float = 15.0) → None[source]

Start ganache-cli in the background.

When this function terminates (without errors), it means the server is running in the background and ready to receive requests.

Parameters:timeout – timeout to wait for ganache-cli to respond, seconds
stop(timeout: float = 15.0) → None[source]
Terminate (SIGTERM) the ganache-cli process and wait. If this fails,
kill the process (SIGKILL).
Parameters:timeout – time to wait for ganache-cli to terminate
solitude.server.kill_all_servers()[source]