teos.tools¶
-
bitcoin_cli
(btc_connect_params)[source]¶ An
http
connection withbitcoind
using thejson-rpc
interface.- Parameters
btc_connect_params (
dict
) – a dictionary with the parameters to connect to bitcoind (rpc user, rpc password, host and port
)- Returns
An authenticated service proxy to
bitcoind
that can be used to sendjson-rpc
commands.- Return type
AuthServiceProxy
-
can_connect_to_bitcoind
(btc_connect_params)[source]¶ Checks if the tower has connection to
bitcoind
.- Parameters
btc_connect_params (
dict
) – a dictionary with the parameters to connect to bitcoind (rpc user, rpc password, host and port
).- Returns
True if the connection can be established. False otherwise.
- Return type
bool
-
get_default_rpc_port
(network)[source]¶ Returns the default RPC port given a network name.
- Parameters
network (
str
) – the network name. Eithermainnet
,testnet
orregtest
.- Returns
The default RPC port depending on the given network name.
- Return type
int
- Raises
ValueError – If the network is not mainnet, testnet or regtest.
-
in_correct_network
(btc_connect_params, network)[source]¶ Checks if
bitcoind
and the tower are configured to run in the same network (mainnet
,testnet
orregtest
)- Parameters
btc_connect_params (
dict
) – a dictionary with the parameters to connect to bitcoind (rpc user, rpc password, host and port)network (
str
) – the network the tower is connected to.
- Returns
True if the network configuration matches. False otherwise.
- Return type
bool