evrpy


Nameevrpy JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryPython wrapper for Evrmore RPC CLI
upload_time2025-09-04 23:27:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords evrmore blockchain rpc cli wrapper cryptocurrency crypto
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # evrpy

> A thin, pragmatic Python wrapper around `evrmore-cli` for Evrmore (EVR) nodes.



## Why?

When you're working against a running `evrmored` node, sometimes you just want a clean Python API that mirrors the CLI *exactly*, without managing JSON-RPC servers, auth headers, or transport details. `evrpy` shells out to `evrmore-cli` with the flags you provide and returns the output (or a readable error string) so you can focus on your app logic.



## Features

- Batteries-included clients grouped by RPC domain (Wallet, Raw Transactions, Assets, Restricted, Rewards, Blockchain, Mining, Mempool, Network, Util, Address Index, Node).

- Mirrors the `evrmore-cli` help text and semantics.

- Predictable error handling — returns strings like `Error: <message>` instead of raising, so you can bubble up user-friendly errors.

- Works with **testnet** or **mainnet**, plus custom `-datadir`, `-rpcuser`, `-rpcpassword`.





## Requirements

- Python 3.9+

- A running `evrmored` with matching `evrmore-cli` on your PATH (or provide a full path).

- RPC enabled in your node config (the wrapper passes `-rpcuser`/`-rpcpassword`).

- For some endpoints you may need node indexes enabled, e.g.:

  - `-txindex=1` for `getrawtransaction` on historical txns

  - `-assetindex=1` for asset queries

  - `-addressindex=1` for address index calls



## Quickstart

```python

from evrpy import WalletRPC



rpc = WalletRPC(

    cli_path="evrmore-cli",               # or absolute path

    datadir="/home/you/.evrmore-test",    # your datadir

    rpc_user="username",

    rpc_password="password",

    testnet=True,

)



info = rpc.getwalletinfo()

print(info)

```



### Example: `sendmany` with fee split

```python

txid = rpc.sendmany(

    fromaccount="",  # deprecated in node, keep empty string

    amounts={

        "n3pUp4uT58hTtATHGvmkBsGP9tzMn8ZAQs": 1,

        "mzKoqPMQcfFGStsMXfMEGMqNnGegm91vAF": 1,

    },

    minconf=0,

    comment="example",

    subtractfeefrom=[

        "n3pUp4uT58hTtATHGvmkBsGP9tzMn8ZAQs",

        "mzKoqPMQcfFGStsMXfMEGMqNnGegm91vAF",

    ],

    conf_target=None,           # omit for now (see Known quirks)

    estimate_mode=None,

)

print(txid)

```



## Known node quirks

- `sendtoaddress` and `sendmany`: on Evrmore v2.0.0 (testnet), passing `conf_target` (even as an integer) sometimes triggers `JSON value is not an integer as expected`. Workaround: **omit `conf_target` and `estimate_mode`** — the wrapper will exclude them if `None`.

- CLI JSON vs shell quoting: when calling the CLI directly, ensure JSON objects/arrays are **single-quoted** to avoid shell expansion.



## API surface

Below is a generated snapshot of available clients and methods. Each method maps 1:1 to an `evrmore-cli` command and returns the CLI stdout on success, or a string beginning with `Error:` on failure.

### AddressindexRPC

A client for interacting with the Evrmore node's address index RPC commands via the `evrmore-cli` command-line interface.

This class provides functions for querying indexed blockchain data by address, such as balance, UTXO sets, mempool data,
and transaction IDs associated with given addresses. It is designed to work with an Evrmore node that has address index
functionality enabled.

Attributes:
    cli_path (str): Path to the `evrmore-cli` binary.
    datadir (str): Directory containing the Evrmore blockchain data.
    rpc_user (str): RPC username for node authentication.
    rpc_pass (str): RPC password for node authentication.
    testnet (bool): If True, connects to Evrmore testnet instead of mainnet.

Typical usage example:
    rpc = AddressindexRPC(
        cli_path="/usr/bin/evrmore-cli",
        datadir="/home/user/.evrmore",
        rpc_user="rpcusername",
        rpc_pass="rpcpassword",
        testnet=True
    )
    balance = rpc.getaddressbalance("EVRaddress")

**Methods (5):** getaddressbalance, getaddressdeltas, getaddressmempool, getaddresstxids, getaddressutxos



### AssetRPC

AssetRPC provides an interface for interacting with the Evrmore blockchain assets via the `evrmore-cli` command-line tool.

This class wraps common asset-related RPC commands and parses their responses, allowing you to manage, query, and transfer assets on the Evrmore blockchain. It handles command construction, execution, and result parsing, with support for both mainnet and testnet modes.

Attributes:
    cli_path (str): Path to the `evrmore-cli` binary.
    datadir (str): Path to the Evrmore node data directory.
    rpc_user (str): RPC authentication username.
    rpc_pass (str): RPC authentication password.
    testnet (bool): Run commands on testnet if True; mainnet otherwise.

Example:
    rpc = AssetRPC(
        cli_path="/path/to/evrmore-cli",
        datadir="/path/to/data",
        rpc_user="user",
        rpc_pass="password",
        testnet=True
    )

    asset_info = rpc.getassetdata("ASSETNAME")

Methods provide access to:
    - Checking if an address has a specified asset balance.
    - Querying asset metadata.
    - Getting burn addresses.
    - Retrieving cache information.
    - Calculating tolls for asset transactions.
    - Issuing, reissuing, transferring, and updating asset metadata.
    - Listing assets and balances.
    - Other asset operations supported by Evrmore CLI.

**Methods (17):** addresshasasset, getassetdata, getburnaddresses, getcacheinfo, getcalculatedtoll, issue, issueunique, listaddressesbyasset, listassetbalancesbyaddress, listassets, listmyassets, reissue, remint, transfer, transferfromaddress, transferfromaddresses, updatemetadata



### BlockchainRPC

**Methods (26):** clearmempool, decodeblock, getbestblockhash, getblock, getblockchaininfo, getblockcount, getblockhash, getblockhashes, getblockheader, getchaintips, getchaintxstats, getdifficulty, getmempoolancestors, getmempooldescendants, getmempoolentry, getmempoolinfo, getrawmempool, getspentinfo, gettxout, gettxoutproof, gettxoutsetinfo, preciousblock, pruneblockchain, savemempool, verifychain, verifytxoutproof



### ControlRPC

**Methods (6):** getinfo, getmemoryinfo, getrpcinfo, help, stop, uptime



### GeneratingRPC

**Methods (4):** generate, generatetoaddress, getgenerate, setgenerate



### MessagesRPC

**Methods (6):** clearmessages, sendmessage, subscribetochannel, unsubscribefromchannel, viewallmessagechannels, viewallmessages



### MiningRPC

**Methods (7):** getblocktemplate, getevrprogpowhash, getmininginfo, getnetworkhashps, pprpcsb, prioritisetransaction, submitblock



### NetworkRPC

**Methods (12):** addnode, clearbanned, disconnectnode, getaddednodeinfo, getconnectioncount, getnettotals, getnetworkinfo, getpeerinfo, listbanned, ping, setban, setnetworkactive



### RawtransactionsRPC
NEEDS EXTENSIVE TESTING

**Methods (9):** combinerawtransaction, createrawtransaction, decoderawtransaction, decodescript, fundrawtransaction, getrawtransaction, sendrawtransaction, signrawtransaction, testmempoolaccept



### RestrictedassetsRPC
NEEDS FURTHER TESTING

**Methods (19):** addtagtoaddress, checkaddressrestriction, checkaddresstag, checkglobalrestriction, freezeaddress, freezerestrictedasset, getverifierstring, issuequalifierasset, issuerestrictedasset, isvalidverifierstring, listaddressesfortag, listaddressrestrictions, listglobalrestrictions, listtagsforaddress, reissuerestrictedasset, removetagfromaddress, transferqualifier, unfreezeaddress, unfreezerestrictedasset



### RestrictedRPC

**Methods (2):** viewmyrestrictedaddresses, viewmytaggedaddresses



### RewardsRPC

**Methods (6):** cancelsnapshotrequest, distributereward, getdistributestatus, getsnapshotrequest, listsnapshotrequests, requestsnapshot



### UtilRPC

**Methods (6):** createmultisig, estimatefee, estimatesmartfee, signmessagewithprivkey, validateaddress, verifymessage



### WalletRPC

**Methods (48):** abandontransaction, abortrescan, addmultisigaddress, addwitnessaddress, backupwallet, dumpprivkey, dumpwallet, encryptwallet, getaccount, getaccountaddress, getaddressesbyaccount, getbalance, getmasterkeyinfo, getmywords, getnewaddress, getrawchangeaddress, getreceivedbyaccount, getreceivedbyaddress, gettransaction, getunconfirmedbalance, getwalletinfo, importaddress, importmulti, importprivkey, importprunedfunds, importpubkey, importwallet, keypoolrefill, listaccounts, listaddressgroupings, listlockunspent, listreceivedbyaccount, listreceivedbyaddress, listsinceblock, listtransactions, listunspent, listwallets, lockunspent, move, removeprunedfunds, rescanblockchain, sendfrom, sendfromaddress, sendmany, sendtoaddress, setaccount, settxfee, signmessage



## Error handling

Most client methods wrap `subprocess.CalledProcessError` and format errors as readable strings so you can surface them directly to users:

```python

return f"Error: {getattr(e, 'stderr', str(e)) or str(e)}".strip()

```
The methods that do not currently have this output will be updated.  They currently just return the error e




Note: Many tests expect a synced node with funds and appropriate indexes enabled.



## Contributing

PRs welcome! If you spot mismatches with CLI help or encounter args that the node rejects (e.g. `conf_target`), please include:

- The exact CLI you ran and its output

- The wrapper call and its return value

- Node version and network (mainnet/testnet)



## License

MIT © 2025 neubtrino

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "evrpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "evrmore, blockchain, rpc, cli, wrapper, cryptocurrency, crypto",
    "author": null,
    "author_email": "neubtrino <neubtrino_evrmore@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/c7/07/0ff669acb51e3e1f82c9bfc3f8f04e38a3f5cba403adab7c477aa7095aa8/evrpy-0.0.2.tar.gz",
    "platform": null,
    "description": "# evrpy\n\n> A thin, pragmatic Python wrapper around `evrmore-cli` for Evrmore (EVR) nodes.\n\n\n\n## Why?\n\nWhen you're working against a running `evrmored` node, sometimes you just want a clean Python API that mirrors the CLI *exactly*, without managing JSON-RPC servers, auth headers, or transport details. `evrpy` shells out to `evrmore-cli` with the flags you provide and returns the output (or a readable error string) so you can focus on your app logic.\n\n\n\n## Features\n\n- Batteries-included clients grouped by RPC domain (Wallet, Raw Transactions, Assets, Restricted, Rewards, Blockchain, Mining, Mempool, Network, Util, Address Index, Node).\n\n- Mirrors the `evrmore-cli` help text and semantics.\n\n- Predictable error handling \u2014 returns strings like `Error: <message>` instead of raising, so you can bubble up user-friendly errors.\n\n- Works with **testnet** or **mainnet**, plus custom `-datadir`, `-rpcuser`, `-rpcpassword`.\n\n\n\n\n\n## Requirements\n\n- Python 3.9+\n\n- A running `evrmored` with matching `evrmore-cli` on your PATH (or provide a full path).\n\n- RPC enabled in your node config (the wrapper passes `-rpcuser`/`-rpcpassword`).\n\n- For some endpoints you may need node indexes enabled, e.g.:\n\n  - `-txindex=1` for `getrawtransaction` on historical txns\n\n  - `-assetindex=1` for asset queries\n\n  - `-addressindex=1` for address index calls\n\n\n\n## Quickstart\n\n```python\n\nfrom evrpy import WalletRPC\n\n\n\nrpc = WalletRPC(\n\n    cli_path=\"evrmore-cli\",               # or absolute path\n\n    datadir=\"/home/you/.evrmore-test\",    # your datadir\n\n    rpc_user=\"username\",\n\n    rpc_password=\"password\",\n\n    testnet=True,\n\n)\n\n\n\ninfo = rpc.getwalletinfo()\n\nprint(info)\n\n```\n\n\n\n### Example: `sendmany` with fee split\n\n```python\n\ntxid = rpc.sendmany(\n\n    fromaccount=\"\",  # deprecated in node, keep empty string\n\n    amounts={\n\n        \"n3pUp4uT58hTtATHGvmkBsGP9tzMn8ZAQs\": 1,\n\n        \"mzKoqPMQcfFGStsMXfMEGMqNnGegm91vAF\": 1,\n\n    },\n\n    minconf=0,\n\n    comment=\"example\",\n\n    subtractfeefrom=[\n\n        \"n3pUp4uT58hTtATHGvmkBsGP9tzMn8ZAQs\",\n\n        \"mzKoqPMQcfFGStsMXfMEGMqNnGegm91vAF\",\n\n    ],\n\n    conf_target=None,           # omit for now (see Known quirks)\n\n    estimate_mode=None,\n\n)\n\nprint(txid)\n\n```\n\n\n\n## Known node quirks\n\n- `sendtoaddress` and `sendmany`: on Evrmore v2.0.0 (testnet), passing `conf_target` (even as an integer) sometimes triggers `JSON value is not an integer as expected`. Workaround: **omit `conf_target` and `estimate_mode`** \u2014 the wrapper will exclude them if `None`.\n\n- CLI JSON vs shell quoting: when calling the CLI directly, ensure JSON objects/arrays are **single-quoted** to avoid shell expansion.\n\n\n\n## API surface\n\nBelow is a generated snapshot of available clients and methods. Each method maps 1:1 to an `evrmore-cli` command and returns the CLI stdout on success, or a string beginning with `Error:` on failure.\n\n### AddressindexRPC\n\nA client for interacting with the Evrmore node's address index RPC commands via the `evrmore-cli` command-line interface.\n\nThis class provides functions for querying indexed blockchain data by address, such as balance, UTXO sets, mempool data,\nand transaction IDs associated with given addresses. It is designed to work with an Evrmore node that has address index\nfunctionality enabled.\n\nAttributes:\n    cli_path (str): Path to the `evrmore-cli` binary.\n    datadir (str): Directory containing the Evrmore blockchain data.\n    rpc_user (str): RPC username for node authentication.\n    rpc_pass (str): RPC password for node authentication.\n    testnet (bool): If True, connects to Evrmore testnet instead of mainnet.\n\nTypical usage example:\n    rpc = AddressindexRPC(\n        cli_path=\"/usr/bin/evrmore-cli\",\n        datadir=\"/home/user/.evrmore\",\n        rpc_user=\"rpcusername\",\n        rpc_pass=\"rpcpassword\",\n        testnet=True\n    )\n    balance = rpc.getaddressbalance(\"EVRaddress\")\n\n**Methods (5):** getaddressbalance, getaddressdeltas, getaddressmempool, getaddresstxids, getaddressutxos\n\n\n\n### AssetRPC\n\nAssetRPC provides an interface for interacting with the Evrmore blockchain assets via the `evrmore-cli` command-line tool.\n\nThis class wraps common asset-related RPC commands and parses their responses, allowing you to manage, query, and transfer assets on the Evrmore blockchain. It handles command construction, execution, and result parsing, with support for both mainnet and testnet modes.\n\nAttributes:\n    cli_path (str): Path to the `evrmore-cli` binary.\n    datadir (str): Path to the Evrmore node data directory.\n    rpc_user (str): RPC authentication username.\n    rpc_pass (str): RPC authentication password.\n    testnet (bool): Run commands on testnet if True; mainnet otherwise.\n\nExample:\n    rpc = AssetRPC(\n        cli_path=\"/path/to/evrmore-cli\",\n        datadir=\"/path/to/data\",\n        rpc_user=\"user\",\n        rpc_pass=\"password\",\n        testnet=True\n    )\n\n    asset_info = rpc.getassetdata(\"ASSETNAME\")\n\nMethods provide access to:\n    - Checking if an address has a specified asset balance.\n    - Querying asset metadata.\n    - Getting burn addresses.\n    - Retrieving cache information.\n    - Calculating tolls for asset transactions.\n    - Issuing, reissuing, transferring, and updating asset metadata.\n    - Listing assets and balances.\n    - Other asset operations supported by Evrmore CLI.\n\n**Methods (17):** addresshasasset, getassetdata, getburnaddresses, getcacheinfo, getcalculatedtoll, issue, issueunique, listaddressesbyasset, listassetbalancesbyaddress, listassets, listmyassets, reissue, remint, transfer, transferfromaddress, transferfromaddresses, updatemetadata\n\n\n\n### BlockchainRPC\n\n**Methods (26):** clearmempool, decodeblock, getbestblockhash, getblock, getblockchaininfo, getblockcount, getblockhash, getblockhashes, getblockheader, getchaintips, getchaintxstats, getdifficulty, getmempoolancestors, getmempooldescendants, getmempoolentry, getmempoolinfo, getrawmempool, getspentinfo, gettxout, gettxoutproof, gettxoutsetinfo, preciousblock, pruneblockchain, savemempool, verifychain, verifytxoutproof\n\n\n\n### ControlRPC\n\n**Methods (6):** getinfo, getmemoryinfo, getrpcinfo, help, stop, uptime\n\n\n\n### GeneratingRPC\n\n**Methods (4):** generate, generatetoaddress, getgenerate, setgenerate\n\n\n\n### MessagesRPC\n\n**Methods (6):** clearmessages, sendmessage, subscribetochannel, unsubscribefromchannel, viewallmessagechannels, viewallmessages\n\n\n\n### MiningRPC\n\n**Methods (7):** getblocktemplate, getevrprogpowhash, getmininginfo, getnetworkhashps, pprpcsb, prioritisetransaction, submitblock\n\n\n\n### NetworkRPC\n\n**Methods (12):** addnode, clearbanned, disconnectnode, getaddednodeinfo, getconnectioncount, getnettotals, getnetworkinfo, getpeerinfo, listbanned, ping, setban, setnetworkactive\n\n\n\n### RawtransactionsRPC\nNEEDS EXTENSIVE TESTING\n\n**Methods (9):** combinerawtransaction, createrawtransaction, decoderawtransaction, decodescript, fundrawtransaction, getrawtransaction, sendrawtransaction, signrawtransaction, testmempoolaccept\n\n\n\n### RestrictedassetsRPC\nNEEDS FURTHER TESTING\n\n**Methods (19):** addtagtoaddress, checkaddressrestriction, checkaddresstag, checkglobalrestriction, freezeaddress, freezerestrictedasset, getverifierstring, issuequalifierasset, issuerestrictedasset, isvalidverifierstring, listaddressesfortag, listaddressrestrictions, listglobalrestrictions, listtagsforaddress, reissuerestrictedasset, removetagfromaddress, transferqualifier, unfreezeaddress, unfreezerestrictedasset\n\n\n\n### RestrictedRPC\n\n**Methods (2):** viewmyrestrictedaddresses, viewmytaggedaddresses\n\n\n\n### RewardsRPC\n\n**Methods (6):** cancelsnapshotrequest, distributereward, getdistributestatus, getsnapshotrequest, listsnapshotrequests, requestsnapshot\n\n\n\n### UtilRPC\n\n**Methods (6):** createmultisig, estimatefee, estimatesmartfee, signmessagewithprivkey, validateaddress, verifymessage\n\n\n\n### WalletRPC\n\n**Methods (48):** abandontransaction, abortrescan, addmultisigaddress, addwitnessaddress, backupwallet, dumpprivkey, dumpwallet, encryptwallet, getaccount, getaccountaddress, getaddressesbyaccount, getbalance, getmasterkeyinfo, getmywords, getnewaddress, getrawchangeaddress, getreceivedbyaccount, getreceivedbyaddress, gettransaction, getunconfirmedbalance, getwalletinfo, importaddress, importmulti, importprivkey, importprunedfunds, importpubkey, importwallet, keypoolrefill, listaccounts, listaddressgroupings, listlockunspent, listreceivedbyaccount, listreceivedbyaddress, listsinceblock, listtransactions, listunspent, listwallets, lockunspent, move, removeprunedfunds, rescanblockchain, sendfrom, sendfromaddress, sendmany, sendtoaddress, setaccount, settxfee, signmessage\n\n\n\n## Error handling\n\nMost client methods wrap `subprocess.CalledProcessError` and format errors as readable strings so you can surface them directly to users:\n\n```python\n\nreturn f\"Error: {getattr(e, 'stderr', str(e)) or str(e)}\".strip()\n\n```\nThe methods that do not currently have this output will be updated.  They currently just return the error e\n\n\n\n\nNote: Many tests expect a synced node with funds and appropriate indexes enabled.\n\n\n\n## Contributing\n\nPRs welcome! If you spot mismatches with CLI help or encounter args that the node rejects (e.g. `conf_target`), please include:\n\n- The exact CLI you ran and its output\n\n- The wrapper call and its return value\n\n- Node version and network (mainnet/testnet)\n\n\n\n## License\n\nMIT \u00a9 2025 neubtrino\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for Evrmore RPC CLI",
    "version": "0.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/neubtrino/evrpy/issues",
        "Homepage": "https://github.com/neubtrino/evrpy"
    },
    "split_keywords": [
        "evrmore",
        " blockchain",
        " rpc",
        " cli",
        " wrapper",
        " cryptocurrency",
        " crypto"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e953d1ac4049f90a7780f3dd03a1a7ede1498b99811376633bb84ffe8b3996ad",
                "md5": "63991fb36c7597bc4e278c1dbac8e967",
                "sha256": "66a644e7592efa620c3d837b81274433d69d40715d9139e423c4286898039314"
            },
            "downloads": -1,
            "filename": "evrpy-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "63991fb36c7597bc4e278c1dbac8e967",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 70015,
            "upload_time": "2025-09-04T23:27:17",
            "upload_time_iso_8601": "2025-09-04T23:27:17.415942Z",
            "url": "https://files.pythonhosted.org/packages/e9/53/d1ac4049f90a7780f3dd03a1a7ede1498b99811376633bb84ffe8b3996ad/evrpy-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c7070ff669acb51e3e1f82c9bfc3f8f04e38a3f5cba403adab7c477aa7095aa8",
                "md5": "e1df969ed36fee9706aea2a73f168df9",
                "sha256": "f57ace0855e93cf02b2fca5055f7081dbd21b71318b3aa9b1a7ebf4877fbd106"
            },
            "downloads": -1,
            "filename": "evrpy-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e1df969ed36fee9706aea2a73f168df9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 78635,
            "upload_time": "2025-09-04T23:27:18",
            "upload_time_iso_8601": "2025-09-04T23:27:18.578807Z",
            "url": "https://files.pythonhosted.org/packages/c7/07/0ff669acb51e3e1f82c9bfc3f8f04e38a3f5cba403adab7c477aa7095aa8/evrpy-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-04 23:27:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "neubtrino",
    "github_project": "evrpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "evrpy"
}
        
Elapsed time: 1.48393s