teos.tools¶
-
bitcoin_cli(btc_connect_params)[source]¶ An
httpconnection withbitcoindusing thejson-rpcinterface.- 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
bitcoindthat can be used to sendjson-rpccommands.- 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,testnetorregtest.- 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
bitcoindand the tower are configured to run in the same network (mainnet,testnetorregtest)- 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