NeoJsonRPC
NeoJsonRPC is a Python JSON-RPC client for the NEO blockchain. It implements the JSON-RPC methods of the API interface provided by NEO nodes (minus the methods requiring an opened wallet). The client also provides a high-level interface to invoke contract methods on the NEO blockchain.
Documentation
Online browsable documentation is available at https://neojsonrpc.readthedocs.io.
Requirements
Installation
To install NeoJsonRPC, please use pip (or pipenv) as follows:
$ pip install neojsonrpc
Basic usage
The first step to interact with the NEO JSON-RPC interface is to initialize a neojsonrpc.Client instance. The following examples respectively show how to get clients for the TestNet, the MainNet and an hypothetical local PrivNet:
>>> from neojsonrpc import Client
>>> testnet_client = Client.for_testnet()
>>> mainnet_client = Client.for_mainnet()
>>> privnet_client = Client(host='localhost', port='30333')
Then you can easily call some of the JSON-RPC methods provided by NEO nodes. Here are some examples:
>>> from neojsonrpc import Client
>>> client = Client.for_testnet()
>>> client.get_block_count()
973369
>>> client.get_contract_state('2c0fdfa9592814b0a938219e218e3a6b08615acd')
{'author': 'foobar',
'code_version': '0.3',
# [...]
}
You can also invoke smart contract functions using the following methods:
>>> from neojsonrpc import Client
>>> client = Client.for_testnet()
>>> result = client.invoke_function('34af1b6634fcd7cfcff0158965b18601d3837e32', 'symbol', [])
{'gas_consumed': '0.217',
'stack': [{'type': 'ByteArray', 'value': bytearray(b'TKN')}],
'state': 'HALT, BREAK'}
>>> # Another convenient way to do the same operation is as follows:
>>> client.contract('34af1b6634fcd7cfcff0158965b18601d3837e32').symbol()
{'gas_consumed': '0.217',
'stack': [{'type': 'ByteArray', 'value': bytearray(b'TKN')}],
'state': 'HALT, BREAK'}
License
MIT. See LICENSE for more details.
Metadata
Release files for neojsonrpc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neojsonrpc-0.1.1.tar.gz | 21.1 kB | Without provenance | Details for neojsonrpc-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neojsonrpc-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for neojsonrpc-0.1.1-py2.py3-none-any.whl |
Total release size: 33.8 kB
Release files / neojsonrpc-0.1.1.tar.gz
| Download URL | neojsonrpc-0.1.1.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0176d4cc20cd2b21830e1c8d6cf8f0fdca938ded3aa8fdd267209acb7217ef8
|
|
BLAKE2b-256 checksum How to use checksums |
181c519c45ab8391449bf4619be1ea52c2e32a76412837dfd074524ebfa39cd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / neojsonrpc-0.1.1-py2.py3-none-any.whl
| Download URL | neojsonrpc-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4c9bb835eea6610b77484ef35a829b1f10705a37a5cfe663bb4dd5e0684ee42d
|
|
BLAKE2b-256 checksum How to use checksums |
1f12e7748b9ab3cd6ed310d68041df206ff6b8b47e28297eed0ce6d6d724ec92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for neojsonrpc 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.