__init__

BitcoinEmulator.__init__(host='', port: int = 8332, background=True)[source]

Without any constructor arguments, will fork into background at http://127.0.0.1:8332

By default, background is set to True, meaning it will launch as a sub-process, instead of blocking your application.

>>> from privex.rpcemulator.bitcoin import BitcoinEmulator
>>>
>>> with BitcoinEmulator():
...     # make some queries to the RPC at https://127.0.0.1:8332
...
>>> # Once the `with` statement is over, the JsonRPC server automatically shuts down
Parameters
  • host (str) – The IP address to listen on. If left as "" - will listen at 127.0.0.1

  • port (int) – The port number to listen on (Defaults to 8332, same as Bitcoin)

  • background (bool) – If True, spawns the webserver in a sub-process, instead of blocking the app.