Python helper package for interacting with your Samourai Dojo instance
Project description
Dojo-py
A very incomplete interface to your Samourai Dojo REST API.
- All requests are proxied through SOCKS to your Dojo's Tor hidden service URL
- Authenticated calls to the Dojo make use of the
Authorization
HTTP header with theBearer
scheme.
Get Started
Install from pip
pip install dojo-py
Setup
## Import the package
from pydojo import pyDojo
## Set two variables for onion address and API key.
## Both can be obtained from your Dojo Maintenance Tool
## or your pairing QR code
onion = 'mytorv3onionaddress.onion'
apikey = 'mydojoapikey'
pd = pyDojo(onion, apikey)
Status
## Get Dojo Status
## NOTE: this call requires use of the Admin Key instead
## of the API Key
pd.get_status()
Fees
## Get current miner fee rates as per your Dojo
pd.get_fees()
Block header
## Get information about a certain block header
blockhash = '0000000000000000000a0c3d6bbc0168932613d550cb7875459b6d37ae088211'
pd.get_block_header(blockhash)
Add extended public key to your Dojo
## Add a new extended public key to your Dojo
## You must tell the Dojo how to derive addresses
## if it is a Segwit enabled public key. `bip49` or `bip84`
## You also need to supply a method of import. Valid values
## are `new` and `restore`.
xpub = 'ypub...'
method = 'restore'
segwit = 'bip49'
pd.add_xpub(xpub=xpub, type=method, segwit=segwit)
XPUB Info
## Get transactions for a given extended public key tracked
## by your Dojo
xpub = 'xpub...'
pd.get_xpub(payload)
Transactions
## Get transactions for a given extended public key or loose address
payload = ('bc1q...', '1Gef...', 'xpub...', 'ypub...', 'zpub...')
pd.get_transactions(payload)
Transaction
## Get transactions info for a txid
transaction = '6d2c2187169c7e85191edeea9d1db732abdefd14c7f1788d999e14b3096f8476'
pd.get_transaction(transaction)
PushTx
## Push a signed transaction to the network using your Dojo node
tx_hex = 'long_hex_string'
pd.push_transaction(tx_hex)
Wallet info
## Request details about a collection of HD accounts and/or
## loose addresses and/or pubkeys (derived in 3 formats P2PKH,
## P2WPKH/P2SH, P2WPKH Bech32) including a list of unspent
## transaction outputs.
payload = ('bc1q...', '1Gef...', 'xpub...', 'ypub...', 'zpub...')
pd.get_wallet(payload)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dojo-py-0.0.4.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file dojo-py-0.0.4.tar.gz
.
File metadata
- Download URL: dojo-py-0.0.4.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12bda8a549beaff5ff56ae4c6ad20ceb7b6a085331de6ae15d6cd4c758efa09f |
|
MD5 | ed29793d7751e446351eda2e4c0ec22b |
|
BLAKE2b-256 | 28c30918e3b0df69dc62587cb0891b991bd17f637f7908b1b5426c1d61c91d41 |
File details
Details for the file dojo_py-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: dojo_py-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31bc6d54b70c3d22bad86d4d4cb6c15747453426059513d3efa17b8235211fab |
|
MD5 | 4d140efa1f6972bf50a3988257021bc4 |
|
BLAKE2b-256 | 336063ec883d7caa9caff61c288f4c19535bfbe5e95ac08f132cda41f5379c5c |