Skip to content

Getting Started with evrmore-rpc

This guide will help you get started with the evrmore-rpc Python client for the Evrmore blockchain.

📦 Installation

Install the package using pip:

pip install evrmore-rpc

🚀 Quick Start

Basic Usage

from evrmore_rpc import EvrmoreClient

# Create a client (auto-loads from evrmore.conf)
client = EvrmoreClient()

# Get blockchain info
info = client.getblockchaininfo()
print(f"Current block height: {info['blocks']}")
print(f"Chain: {info['chain']}")
print(f"Difficulty: {info['difficulty']}")

# Get a specific block
block_hash = client.getblockhash(1)
block = client.getblock(block_hash)
print(f"Block #1 hash: {block.hash}")
print(f"Block #1 time: {block.time}")
print(f"Block #1 transactions: {len(block.tx)}")

Asynchronous Usage

import asyncio
from evrmore_rpc import EvrmoreClient

async def main():
    # Create client
    client = EvrmoreClient()

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

    # Get a block
    block_hash = await client.getblockhash(1)
    block = await client.getblock(block_hash)
    print(f"Block #1 hash: {block.hash}")

    # Close the client
    await client.close()

# Run the async code
asyncio.run(main())

⚙️ Configuration

The client can be configured in several ways:

1. Using evrmore.conf

By default, the client will look for evrmore.conf in the default Evrmore data directory:

client = EvrmoreClient()  # Auto-loads from evrmore.conf

2. Environment Variables

Set these environment variables to configure the client:

EVR_RPC_URL=http://localhost:8819
EVR_RPC_USER=user
EVR_RPC_PASSWORD=pass
EVR_RPC_PORT=8819
EVR_TESTNET=true

Then create the client:

client = EvrmoreClient()  # Auto-loads from environment

3. Manual Configuration

client = EvrmoreClient(
    url="http://localhost:8819",
    rpcuser="user",
    rpcpassword="pass",
    rpcport=8819,
    testnet=True,
    timeout=30,
    async_mode=None  # Auto-detect or force sync/async
)

The client can automatically read from the .cookie file:

client = EvrmoreClient(datadir="~/.evrmore")

💰 Asset Support

# Get asset info
info = client.getassetdata("MYTOKEN")
print(f"Amount: {info['amount']}")
print(f"Reissuable: {info['reissuable']}")

# Transfer asset
txid = client.transfer("MYTOKEN", 100, "EVRAddress")
print(f"Transfer txid: {txid}")

📡 Real-Time Notifications

For real-time blockchain notifications, see the ZMQ Guide and WebSocket Guide.

🔍 Next Steps