Noma¶
CLI utility and Python API to manage bitcoin lightning nodes.
Command-line Usage¶
node:
noma (info|start|stop|restart|logs|check|status)
noma (temp|swap|ram)
noma (freq|memory|voltage) [<device>]
noma usb-setup
noma tunnel <port> <host>
noma (backup|restore|source|diff|devtools)
noma reinstall [--full]
bitcoind:
noma bitcoind (start|stop|info|fastsync|status|check)
noma bitcoind get <key>
noma bitcoind set <key> <value>
noma bitcoind logs [--tail]
lnd:
noma lnd (start|stop|info)
noma lnd logs [--tail]
noma lnd connect <address>
noma lnd (create|unlock|status|check)
noma lnd lncli [<command>...]
noma lnd get <key> [<section>] [<path>]
noma lnd set <key> <value> [<section>] [<path>]
noma lnd autounlock
noma lnd autoconnect [<path>]
noma lnd lndconnectapp <hostport>
noma lnd lndconnectstring <hostport>
noma:
noma (-h|--help)
noma --version
Options:
-h --help Show this screen.
--version Show version.
API Modules¶
node¶
Node hardware and software management related functionality
-
noma.node.
freq
(device='')[source]¶ Get chip clock (default: arm)
Device str: arm, core, h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, dpi Return str: chip frequency
-
noma.node.
full_reinstall
()[source]¶ Full reinstall replaces entire FAT contents (boot partition), and the ext4 data contents as if we installed from freshly burned SD card
-
noma.node.
is_running
(node='')[source]¶ Check if container is running
Return bool: container is running
-
noma.node.
memory
(device='')[source]¶ Get memory allocation split between cpu and gpu
Parameters: device (str) – arm, gpu Return str: memory allocated
bitcoind¶
bitcoind related functionality
-
noma.bitcoind.
fastsync
()[source]¶ Download blocks and chainstate snapshot
Return bool: success status
-
noma.bitcoind.
generate_rpcauth
(username, password='')[source]¶ Generate bitcoind rpcauth string from username and optional password
-
noma.bitcoind.
get_kv
(key, config_path)[source]¶ Parse key-value config files and print out values
Parameters: - key – left part of key value pair
- config_path – path to file
Returns: value of key
-
noma.bitcoind.
set_kv
(key, value, config_path)[source]¶ Set key to value in path kv pairs are separated by “=”
Parameters: - key – key to set
- value – value to set
- config_path – config file path
Return str: string written
lnd¶
LND related functionality
-
noma.lnd.
check_wallet
()[source]¶ This will either import an existing seed (or our own generated one), or use LND to create one. It will also create a password either randomly or use an existing password provided)
Return str: Status
-
noma.lnd.
connectstring
(hostname='192.168.83.33:10009', macaroonfile=PosixPath('/media/noma/lnd/neutrino/data/chain/bitcoin/mainnet/admin.macaroon'), tlsfile=PosixPath('/media/noma/lnd/neutrino/tls.cert'))[source]¶ Show lndconnect string for remote wallets such as Zap
-
noma.lnd.
create_wallet
()[source]¶ - Check if there’s already a wallet. If there is, then exit.
- Check for password.txt
3. If doesn’t exist then check for whether we should save the password (SAVE_PASSWORD_CONTROL_FILE exists) or not 4. If password.txt exists import password in. 5. If password.txt doesn’t exist and we don’t save the password, create a password and save it in temporary path as defined in PASSWORD_FILE_PATH 6. Now start the wallet creation. Look for a seed defined in SEED_FILENAME, if not existing then generate a wallet based on the seed by LND.
-
noma.lnd.
encodemacaroons
(macaroonfile=PosixPath('/media/noma/lnd/neutrino/data/chain/bitcoin/mainnet/admin.macaroon'), tlsfile=PosixPath('/media/noma/lnd/neutrino/tls.cert'))[source]¶ base64url encode macaroon and TLS certificate
-
noma.lnd.
get_kv
(key, section='', config_path='')[source]¶ Parse key-value config files and print out values
Parameters: - key – left part of key value pair
- config_path – path to config file
- section – [section] of the kv pair
Returns: value of key
-
noma.lnd.
set_bitcoind
(password, user='', lnd_config='')[source]¶ Add bitcoind rpc username and password to lnd
-
noma.lnd.
set_kv
(key, value, section='', config_path='')[source]¶ Parse key-value config files and write them out with a key-value change
Note: comments are lost!
Parameters: - key – left part of key value pair
- value – right part of key value pair
- section – optional name of section to set in
- config_path – path to file
Returns:
install¶
Node installation related functionality
-
noma.install.
check_for_destruction
(device, path)[source]¶ Check devices for destruction flag. If so, format with ext4
-
noma.install.
check_installed
(installed='/media/mmcblk0p1/installed')[source]¶ Check if LNCM-Box is installed
-
noma.install.
fallback_mount
(partition, path)[source]¶ Attempt to mount partition at path using ext4 first and falling back to any
Return bool: success
usb¶
USB and SD device related functionality
-
noma.usb.
dev_size
(device)[source]¶ Return device size in bytes
Parameters: device (string, e.g. "sda") – device Returns: device size in bytes Return type: int
-
noma.usb.
fs_size
(fs_path)[source]¶ Return filesystem size in bytes
Parameters: fs_path – path to mounted filesystem Returns: filesystem size in bytes
-
noma.usb.
is_mounted
(device)[source]¶ Check if a device is already mounted
Parameters: device (string, e.g. "sda1") – device or device + partition number Returns: True/False if device is mounted or not Return type: bool
-
noma.usb.
sd_part_size
(partition)[source]¶ Return SD partition size in bytes
Parameters: partition (string, e.g. "sda") – device Returns: partition size in bytes Return type: int