Skip to main content

Interfaces with the Cardano full-node software.

Project description

Cardano Tools

A python module for interacting with the Cardano blockchain.

The Cardano-Tools module provides functionality for interfacing with running full nodes on local or remote hosts. A running Cardano node is a prerequisite for using this package.

Provided tools include:

  • Interfacing with the node:
    • Starting a relay or pool node locally and remotely.
    • Getting the node tip.
  • Creating and administrating a wallet:
    • Create a new wallet address
    • Get UTXO list
    • Send a payment
    • Register a staking address
    • Get the blockchain tip
    • Check staking rewards balance
    • Claim staking rewards
    • Claim ITN rewards
  • Creating and administrating a stake pool:
    • Create block producing keys
    • Register a stake pool
    • Retire a stake pool

This project is developed and maintained by the team at Viper Staking.

Installation

You can install Cardano Tools from PyPI:

pip install cardano-tools

The Cardano Tools package supports Python 3.7 and above.

Examples

For more detailed examples, see the example scripts.

Shelley Tools

The ShelleyTools class provides an interface to the cardano-cli shelley commands. An example for creating a wallet is given below.

from cardano_tools import ShelleyTools

# Test Inputs (example paths)
path_to_cli = "/home/user/.cabal/bin/cardano-cli"
path_to_socket = "/home/user/relay-node/db/node.socket"
working_dir = "/home/user/.cardano-tools/"

# Create a ShelleyTools object
shelley = ShelleyTools(
    path_to_cli, 
    path_to_socket, 
    working_dir, 
    network="--testnet-magic 42"  # <-- For the testnet (default: --mainnet)
)

# Create a wallet address with both spending and staking keys.
print(shelley.make_address("my_wallet"))

Optionally, an SSH connection object may be specified if working with remote hosts.

from cardano_tools import ShelleyTools
from fabric import Connection

# Test Inputs (example paths)
path_to_cli = "/home/user/.cabal/bin/cardano-cli"
path_to_socket = "/home/user/relay-node/db/node.socket"
working_dir = "/home/user/.cardano-tools/"

# SSH connection to remote host
conn = Connection(
    host="hostname",
    user="admin",
    connect_kwargs={
        "key_filename": "/home/myuser/.ssh/private.key",
    },
)

shelley = ShelleyTools(
    path_to_cli, 
    path_to_socket, 
    working_dir,
    ssh=conn
)

Related Projects

The Cardano-Tools library is also used in the official Viper Staking Docker containers.

Support

Join our telegram channel to get support and discuss potential upgrades or changes.

If you find our tools useful, please consider buying us a beer!

# ADA
addr1q9nth9ekvuuu8s7zg58rdf3duks6h067m0hstl0ca2d2dd27cf8l803uw3gfk0spwzr2y5kqncj6xguu4vs086q7xz3sckperc

# BTC
39sUg4DKBNHAFq5TeUJ8aiFGe7QpptifHE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cardano-tools-0.3.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cardano_tools-0.3.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file cardano-tools-0.3.1.tar.gz.

File metadata

  • Download URL: cardano-tools-0.3.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for cardano-tools-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4c0596da55f9af5eadebacc5cacd7beca2b70434a9c45f3cbc28c2507ef1d19b
MD5 c1f40ddca6e6f2e73f51e389400a3fb7
BLAKE2b-256 d5e007e99f13c02ac8dc25b4f60db3c564b540afc4040f56190802a13b3b4ef8

See more details on using hashes here.

File details

Details for the file cardano_tools-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cardano_tools-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for cardano_tools-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95361d51ff31f1e39e2bdf854ca62844a15d419177c41e51d0a0b16d5386ec77
MD5 48bf91bec34ff7d6d07aaf6829b274c2
BLAKE2b-256 abfee7b9dd4380f2949fe535e3b2b138077b9758a0918bca6beb9dab76fa229c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page