nanopy.rpc

A wrapper to make RPC requests to a node. Requires requests. Additionally, websocket-client for websocket connections, and pysocks for connecting via TOR network.

class nanopy.rpc.RPC(url='http://localhost:7076', headers={}, tor=False)

RPC class

Parameters
  • url (str) – URL of the nano node

  • headers (dict) – Optional headers for the RPC requests

  • tor (bool) – Whether to connect via TOR network.

Refer docs for information on methods.

Return type is dict for all methods except disconnect.

account_balance(account)

https://docs.nano.org/commands/rpc-protocol/#account_balance

account_block_count(account)

https://docs.nano.org/commands/rpc-protocol/#account_block_count

account_create(wallet, index=0, work=True)

https://docs.nano.org/commands/rpc-protocol/#account_create

account_get(key)

https://docs.nano.org/commands/rpc-protocol/#account_get

account_history(account, count=1, raw=False, head=None, offset=0, reverse=False, account_filter=[])

https://docs.nano.org/commands/rpc-protocol/#account_history

account_info(account, representative=False, weight=False, pending=False)

https://docs.nano.org/commands/rpc-protocol/#account_info

account_key(account)

https://docs.nano.org/commands/rpc-protocol/#account_key

account_list(wallet)

https://docs.nano.org/commands/rpc-protocol/#account_list

account_move(wallet, source, accounts)

https://docs.nano.org/commands/rpc-protocol/#account_move

account_remove(wallet, account)

https://docs.nano.org/commands/rpc-protocol/#account_remove

account_representative(account)

https://docs.nano.org/commands/rpc-protocol/#account_representative

account_representative_set(wallet, account, representative, work=None)

https://docs.nano.org/commands/rpc-protocol/#account_representative_set

account_weight(account)

https://docs.nano.org/commands/rpc-protocol/#account_weight

accounts_balances(accounts)

https://docs.nano.org/commands/rpc-protocol/#accounts_balances

accounts_create(wallet, count=1, work=True)

https://docs.nano.org/commands/rpc-protocol/#accounts_create

accounts_frontiers(accounts)

https://docs.nano.org/commands/rpc-protocol/#accounts_frontiers

accounts_pending(accounts, count=1, threshold=None, source=False, include_active=False, sorting=False, include_only_confirmed=False)

https://docs.nano.org/commands/rpc-protocol/#accounts_pending

active_difficulty(include_trend=False)

https://docs.nano.org/commands/rpc-protocol/#active_difficulty

available_supply()

https://docs.nano.org/commands/rpc-protocol/#available_supply

block_account(_hash)

https://docs.nano.org/commands/rpc-protocol/#block_account

block_confirm(_hash)

https://docs.nano.org/commands/rpc-protocol/#block_confirm

block_count(include_cemented=True)

https://docs.nano.org/commands/rpc-protocol/#block_count

block_create(balance, representative, previous, wallet=None, account=None, key=None, source=None, destination=None, link=None, work=None, version='work_1', json_block=False, difficulty=None)

https://docs.nano.org/commands/rpc-protocol/#block_create

block_hash(block, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#block_hash

block_info(_hash, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#block_info

blocks(hashes)

https://docs.nano.org/commands/rpc-protocol/#blocks

blocks_info(hashes, pending=False, source=False, balance=False, json_block=False, include_not_found=False)

https://docs.nano.org/commands/rpc-protocol/#blocks_info

bootstrap(address, port, bypass_frontier_confirmation=False, _id='')

https://docs.nano.org/commands/rpc-protocol/#bootstrap

bootstrap_any(force=False, _id='')

https://docs.nano.org/commands/rpc-protocol/#bootstrap_any

bootstrap_lazy(hash_, force=False, _id='')

https://docs.nano.org/commands/rpc-protocol/#bootstrap_lazy

bootstrap_status()

https://docs.nano.org/commands/rpc-protocol/#bootstrap_status

chain(block, count=1, offset=0, reverse=False)

https://docs.nano.org/commands/rpc-protocol/#chain

confirmation_active(announcements=0)

https://docs.nano.org/commands/rpc-protocol/#confirmation_active

confirmation_height_currently_processing()

https://docs.nano.org/commands/rpc-protocol/#confirmation_height_currently_processing

confirmation_history(_hash=None)

https://docs.nano.org/commands/rpc-protocol/#confirmation_history

confirmation_info(root, contents=True, representatives=False, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#confirmation_info

confirmation_quorum(peer_details=False)

https://docs.nano.org/commands/rpc-protocol/#confirmation_quorum

database_txn_tracker(min_read_time, min_write_time)

https://docs.nano.org/commands/rpc-protocol/#database_txn_tracker

delegators(account)

https://docs.nano.org/commands/rpc-protocol/#delegators

delegators_count(account)

https://docs.nano.org/commands/rpc-protocol/#delegators_count

deterministic_key(seed, index)

https://docs.nano.org/commands/rpc-protocol/#deterministic_key

disconnect()

Close RPC connection. Only necessary for websocket connections.

epoch_upgrade(epoch, key, count=0, threads=0)

https://docs.nano.org/commands/rpc-protocol/#epoch_upgrade

frontier_count()

https://docs.nano.org/commands/rpc-protocol/#frontier_count

frontiers(account, count=1)

https://docs.nano.org/commands/rpc-protocol/#frontiers

keepalive(address, port)

https://docs.nano.org/commands/rpc-protocol/#keepalive

key_create()

https://docs.nano.org/commands/rpc-protocol/#key_create

key_expand(key)

https://docs.nano.org/commands/rpc-protocol/#key_expand

krai_from_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#krai_from_raw

krai_to_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#krai_to_raw

ledger(account, count=1, representative=False, weight=False, pending=False, modified_since=0, sorting=False, threshold=0)

https://docs.nano.org/commands/rpc-protocol/#ledger

mrai_from_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#mrai_from_raw

mrai_to_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#mrai_to_raw

node_id()

https://docs.nano.org/commands/rpc-protocol/#node_id

node_id_delete()

https://docs.nano.org/commands/rpc-protocol/#node_id_delete

password_change(wallet, password)

https://docs.nano.org/commands/rpc-protocol/#password_change

password_enter(wallet, password)

https://docs.nano.org/commands/rpc-protocol/#password_enter

password_valid(wallet)

https://docs.nano.org/commands/rpc-protocol/#password_valid

peers(peer_details=False)

https://docs.nano.org/commands/rpc-protocol/#peers

pending(account, count=0, threshold=0, source=False, include_active=False, min_version=False, sorting=False, include_only_confirmed=False)

https://docs.nano.org/commands/rpc-protocol/#pending

pending_exists(_hash, include_active=False, include_only_confirmed=False)

https://docs.nano.org/commands/rpc-protocol/#pending_exists

process(block, force=False, subtype=None, json_block=False, watch_work=True)

https://docs.nano.org/commands/rpc-protocol/#process

rai_from_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#rai_from_raw

rai_to_raw(amount)

https://docs.nano.org/commands/rpc-protocol/#rai_to_raw

receive(wallet, account, block, work=None)

https://docs.nano.org/commands/rpc-protocol/#receive

receive_minimum()

https://docs.nano.org/commands/rpc-protocol/#receive_minimum

receive_minimum_set(amount)

https://docs.nano.org/commands/rpc-protocol/#receive_minimum_set

representatives(count=1, sorting=False)

https://docs.nano.org/commands/rpc-protocol/#representatives

representatives_online(weight=False)

https://docs.nano.org/commands/rpc-protocol/#representatives_online

republish(_hash, count=1, sources=0, destinations=0)

https://docs.nano.org/commands/rpc-protocol/#republish

search_pending(wallet)

https://docs.nano.org/commands/rpc-protocol/#search_pending

search_pending_all()

https://docs.nano.org/commands/rpc-protocol/#search_pending_all

send(wallet, source, destination, amount, _id=None, work=None)

https://docs.nano.org/commands/rpc-protocol/#send

sign(key='', wallet='', account='', block='', _hash='', json_block=False)

https://docs.nano.org/commands/rpc-protocol/#sign

stats(_type)

https://docs.nano.org/commands/rpc-protocol/#stats

stats_clear()

https://docs.nano.org/commands/rpc-protocol/#stats_clear

stop()

https://docs.nano.org/commands/rpc-protocol/#stop

successors(block, count=1, offset=0, reverse=False)

https://docs.nano.org/commands/rpc-protocol/#successors

telemetry(raw=False, address=0, port='7075')

https://docs.nano.org/commands/rpc-protocol/#telemetry

unchecked(json_block=False, count=1)

https://docs.nano.org/commands/rpc-protocol/#unchecked

unchecked_clear()

https://docs.nano.org/commands/rpc-protocol/#unchecked_clear

unchecked_get(_hash, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#unchecked_get

unchecked_keys(key, count=1, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#unchecked_keys

unopened(account=None, count=1, threshold=0)

https://docs.nano.org/commands/rpc-protocol/#unopened

uptime()

https://docs.nano.org/commands/rpc-protocol/#uptime

validate_account_number(account)

https://docs.nano.org/commands/rpc-protocol/#validate_account_number

version()

https://docs.nano.org/commands/rpc-protocol/#version

wallet_add(wallet, key, work=True)

https://docs.nano.org/commands/rpc-protocol/#wallet_add

wallet_add_watch(wallet, accounts)

https://docs.nano.org/commands/rpc-protocol/#wallet_add_watch

wallet_balances(wallet, threshold=0)

https://docs.nano.org/commands/rpc-protocol/#wallet_balances

wallet_change_seed(wallet, seed, count=0)

https://docs.nano.org/commands/rpc-protocol/#wallet_change_seed

wallet_contains(wallet, account)

https://docs.nano.org/commands/rpc-protocol/#wallet_contains

wallet_create(seed='')

https://docs.nano.org/commands/rpc-protocol/#wallet_create

wallet_destroy(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_destroy

wallet_export(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_export

wallet_frontiers(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_frontiers

wallet_history(wallet, modified_since=0)

https://docs.nano.org/commands/rpc-protocol/#wallet_history

wallet_info(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_info

wallet_ledger(wallet, representative=False, weight=False, pending=False, modified_since=None)

https://docs.nano.org/commands/rpc-protocol/#wallet_ledger

wallet_lock(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_lock

wallet_locked(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_locked

wallet_pending(wallet, count=1, threshold=0, source=False, include_active=False, min_version=False, include_only_confirmed=False)

https://docs.nano.org/commands/rpc-protocol/#wallet_pending

wallet_representative(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_representative

wallet_representative_set(wallet, representative, update_existing_accounts=False)

https://docs.nano.org/commands/rpc-protocol/#wallet_representative_set

wallet_republish(wallet, count=1)

https://docs.nano.org/commands/rpc-protocol/#wallet_republish

wallet_work_get(wallet)

https://docs.nano.org/commands/rpc-protocol/#wallet_work_get

work_cancel(_hash)

https://docs.nano.org/commands/rpc-protocol/#work_cancel

work_generate(_hash, use_peers=False, difficulty=None, multiplier=0, account=None, version='work_1', block=None, json_block=False)

https://docs.nano.org/commands/rpc-protocol/#work_generate

work_get(wallet, account)

https://docs.nano.org/commands/rpc-protocol/#work_get

work_peer_add(address, port)

https://docs.nano.org/commands/rpc-protocol/#work_peer_add

work_peers()

https://docs.nano.org/commands/rpc-protocol/#work_peers

work_peers_clear()

https://docs.nano.org/commands/rpc-protocol/#work_peers_clear

work_set(wallet, account, work)

https://docs.nano.org/commands/rpc-protocol/#work_set

work_validate(work, _hash, difficulty=None, multiplier=0, version='work_1')

https://docs.nano.org/commands/rpc-protocol/#work_validate