nanoblocks.network package
Submodules
nanoblocks.network.nano_network module
- class nanoblocks.network.nano_network.NanoNetwork(node_backend=[FAILOVER NODE] [ ] [Node http=https://mynano.ninja/api/node; ws=wss://ws.mynano.ninja/ (Nano V22.1)] [x] [Node http=https://node.somenano.com/proxy; ws=wss://node.somenano.com/websocket (Nano V22.1)] [ ] [Node http=https://rainstorm.city/api; ws=wss://rainstorm.city/websocket (Nano V22.1)] [ ] [Node http=https://proxy.nanos.cc/proxy; ws=wss://socket.nanos.cc/ (Nano V22.1)] [ ] [Node http=https://proxy.powernode.cc/proxy; ws=wss://ws.powernode.cc/ (Nano V22.1)] [ ] [Node http=Virtual; ws=Virtual (Nano 22.1)], work_server=Local Work server, cache_accounts=True)
Bases:
objectThis class represents the Nano network and provides methods to easily interact with it.
- property accounts
Handles the account API for the Nano protocol. By default all the accounts that can be accessed are read-only.
An existing account can be accessed as follows: wallet = nano_network.accounts[nano_address]
If a private key is available, it can be unlocked with the method unlock(priv_key).
- active_dificulty(include_trend=False)
Returns the difficulty values (16 hexadecimal digits string, 64 bit) for the minimum required on the network (network_minimum) as well as the current active difficulty seen on the network (network_current, 10 second trended average of adjusted difficulty seen on prioritized transactions, refreshed every 500ms) which can be used to perform rework for better prioritization of transaction processing.
A multiplier of the network_current from the base difficulty of network_minimum is also provided for comparison. Network_receive_minimum and network_receive_current are also provided as lower thresholds exclusively for receive blocks.
- Parameters
include_trend – Boolean, false by default. Returns the trend of difficulty seen on the network as a list of multipliers. Sampling occurs every 500ms. The list is ordered such that the first value is the most recent sample.
- property available_supply
Returns the amount of NANO that are available in the public supply.
- property blocks
Handles the blocks API for the Nano Protocol. Allows to peek blocks and broadcast new blocks to the network.
A new block can be broadcasted as follows: block = nano_network.blocks.broadcast(state_block)
- property node_backend
Returns the Node object that contains information of the node.
- property peers
Returns a list of pairs of online peer IPv6:port and its node protocol network version
- property representatives
Returns a list of representatives accounts of the network.
- property representatives_count
Retrieves the number of representatives in the network.
- property representatives_online
Returns a list of online representatives accounts of the network. The ones that recently voted.
- property representatives_online_count
Retrieves the number of online representatives in the network.
- property telemetry
Return metrics from other nodes on the network. By default, returns a summarized view of the whole network.
- track_confirmation_blocks(accounts_list, callback, *callback_args, **callback_kwargs)
Tracks all the confirmation blocks in the network and reports them through the callback. This is a blocking method.
- Parameters
accounts_list – List of accounts to track.
callback – Callback to report every block. Must return True to keep tracking for new blocks, or False to abort the process.
- property wallets
Handles the wallets API for the Nano protocol. Allows to create new accounts or manage existing ones.
A new account can be created as follows: wallet = nano_network.wallets.create()
An existing wallet can be accessed as follows: wallet = nano_network.wallets[seed]
- property work_server
Module contents
The nanoblocks.node package contains the classes related to the management of nodes.
- class nanoblocks.network.NanoNetwork(node_backend=[FAILOVER NODE] [ ] [Node http=https://mynano.ninja/api/node; ws=wss://ws.mynano.ninja/ (Nano V22.1)] [x] [Node http=https://node.somenano.com/proxy; ws=wss://node.somenano.com/websocket (Nano V22.1)] [ ] [Node http=https://rainstorm.city/api; ws=wss://rainstorm.city/websocket (Nano V22.1)] [ ] [Node http=https://proxy.nanos.cc/proxy; ws=wss://socket.nanos.cc/ (Nano V22.1)] [ ] [Node http=https://proxy.powernode.cc/proxy; ws=wss://ws.powernode.cc/ (Nano V22.1)] [ ] [Node http=Virtual; ws=Virtual (Nano 22.1)], work_server=Local Work server, cache_accounts=True)
Bases:
objectThis class represents the Nano network and provides methods to easily interact with it.
- property accounts
Handles the account API for the Nano protocol. By default all the accounts that can be accessed are read-only.
An existing account can be accessed as follows: wallet = nano_network.accounts[nano_address]
If a private key is available, it can be unlocked with the method unlock(priv_key).
- active_dificulty(include_trend=False)
Returns the difficulty values (16 hexadecimal digits string, 64 bit) for the minimum required on the network (network_minimum) as well as the current active difficulty seen on the network (network_current, 10 second trended average of adjusted difficulty seen on prioritized transactions, refreshed every 500ms) which can be used to perform rework for better prioritization of transaction processing.
A multiplier of the network_current from the base difficulty of network_minimum is also provided for comparison. Network_receive_minimum and network_receive_current are also provided as lower thresholds exclusively for receive blocks.
- Parameters
include_trend – Boolean, false by default. Returns the trend of difficulty seen on the network as a list of multipliers. Sampling occurs every 500ms. The list is ordered such that the first value is the most recent sample.
- property available_supply
Returns the amount of NANO that are available in the public supply.
- property blocks
Handles the blocks API for the Nano Protocol. Allows to peek blocks and broadcast new blocks to the network.
A new block can be broadcasted as follows: block = nano_network.blocks.broadcast(state_block)
- property node_backend
Returns the Node object that contains information of the node.
- property peers
Returns a list of pairs of online peer IPv6:port and its node protocol network version
- property representatives
Returns a list of representatives accounts of the network.
- property representatives_count
Retrieves the number of representatives in the network.
- property representatives_online
Returns a list of online representatives accounts of the network. The ones that recently voted.
- property representatives_online_count
Retrieves the number of online representatives in the network.
- property telemetry
Return metrics from other nodes on the network. By default, returns a summarized view of the whole network.
- track_confirmation_blocks(accounts_list, callback, *callback_args, **callback_kwargs)
Tracks all the confirmation blocks in the network and reports them through the callback. This is a blocking method.
- Parameters
accounts_list – List of accounts to track.
callback – Callback to report every block. Must return True to keep tracking for new blocks, or False to abort the process.
- property wallets
Handles the wallets API for the Nano protocol. Allows to create new accounts or manage existing ones.
A new account can be created as follows: wallet = nano_network.wallets.create()
An existing wallet can be accessed as follows: wallet = nano_network.wallets[seed]
- property work_server