Skip to main content

A typed Python wrapper for evrmore-cli commands with ZMQ support

Project description

evrmore-rpc

A typed Python wrapper for evrmore-cli commands with ZMQ support.

Quick Start

# Install the package
pip install evrmore-rpc

# Basic usage
from evrmore_rpc import EvrmoreRPCClient

# Initialize client
client = EvrmoreRPCClient()

# Get blockchain info
info = client.getblockchaininfo()
print(f"Current block height: {info.blocks}")

# List assets
assets = client.listassets()
print(f"Found {len(assets)} assets")

Features

  • ✨ Full type hints for all evrmore-cli commands
  • 🎨 Rich terminal output formatting
  • 🖥️ Command-line interface
  • 🔍 Python API with autocomplete support
  • ⚡ ZMQ support for real-time notifications
  • 📚 Interactive examples and tools

Requirements

  • Python 3.8 or higher
  • evrmore-cli installed and accessible in your PATH
  • ZMQ support in your Evrmore node (optional)

Installation

# Basic installation
pip install evrmore-rpc

# With development tools
pip install evrmore-rpc[dev]

Usage Examples

Command Line Interface

# Get blockchain info
evrmore-rpc getblockchaininfo

# Get block by hash
evrmore-rpc getblock "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"

# Get JSON output
evrmore-rpc --json getblockcount

Python API

from evrmore_rpc import EvrmoreRPCClient

# Initialize the client
client = EvrmoreRPCClient()

# Get block by hash
block = client.getblock(
    "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
)
print(f"Block timestamp: {block.time}")

# Issue an asset
result = client.issue(
    "MYASSET",
    1000,
    "EVRxxxxxxxxxxxxxxxxxxxxx",
    "EVRxxxxxxxxxxxxxxxxxxxxx"
)
print(f"Asset created with txid: {result}")

ZMQ Support

Enable ZMQ in your evrmore.conf:

zmqpubhashtx=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubsequence=tcp://127.0.0.1:28332

Use the ZMQ client:

from evrmore_rpc.zmq.client import EvrmoreZMQClient

# Create ZMQ client
client = EvrmoreZMQClient()

# Handle new transactions
@client.on_transaction
async def handle_transaction(notification):
    print(f"New transaction: {notification.hex}")

# Start receiving notifications
await client.start()

Configuration

Configure through command line:

evrmore-rpc --datadir ~/.evrmore --rpcuser myuser --rpcpassword mypass getinfo

Or in Python:

client = EvrmoreRPCClient(
    datadir="~/.evrmore",
    rpcuser="myuser",
    rpcpassword="mypass",
    rpcport=8819
)

Example Applications

The package includes several example applications:

  • blockchain_explorer: Real-time block and transaction viewer
  • asset_monitor: Track asset creation and transfers
  • wallet_tracker: Monitor wallet balances and transactions
  • network_monitor: View peer connections and network stats
  • reward_distributor: Manage asset reward distributions

Run any example:

python examples/<example_name>/main.py

Development

# Clone the repository
git clone https://github.com/manticore-projects/evrmore-rpc.git

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

License

MIT License - see the LICENSE file for details.

Credits

Created by Manticore Technologies. Inspired by the original work of Hans Evrmore.

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

evrmore_rpc-1.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

evrmore_rpc-1.1.0-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file evrmore_rpc-1.1.0.tar.gz.

File metadata

  • Download URL: evrmore_rpc-1.1.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for evrmore_rpc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a190dc61ea561c054691f6f8545ff9e55dc9dc7daf8d3692a2fda5b3f4f1b4e7
MD5 62e6bace8f3a5b2cd98941f0f42af580
BLAKE2b-256 1104d809244f557e920fe93ce611e70b422ac7740e8c8069ec52f8d0d43ea24a

See more details on using hashes here.

File details

Details for the file evrmore_rpc-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: evrmore_rpc-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for evrmore_rpc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16ee4323b0efaa0ce6eb974cd5b88611e7b33249a8a4f287af8f69e0ebd84876
MD5 ae98ad6b0174cf21691cc05f31e490b4
BLAKE2b-256 dd101220bf502a1cb32ea182890a972baa29bb77b61e9e8b07fe5f97a48d572a

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