Mersennet Python SDK
Python client for Mersennet - JSON-RPC, CLOB (order book), and WebSocket subscriptions.
Installation
pip install mersennet-sdk
Every GitHub release is uploaded to PyPI as mersennet-sdk
through trusted publishing (OIDC from GitHub Actions — no upload token exists).
A specific tag also installs straight from GitHub:
pip install "git+https://github.com/mersennet/sdk-python.git@v0.1.2".
Or from source:
cd sdk-python
pip install -e .
Quick Start
from mersennet import MersennetProvider, MersennetOrders
provider = MersennetProvider("http://localhost:8545")
# Chain info
print("Chain ID:", provider.chain_id())
print("Block:", provider.block_number())
print("Gas price:", provider.gas_price())
# Account
balance = provider.get_balance("0xYourAddress")
print("Balance:", balance)
# Order book
orders = MersennetOrders(provider)
book = orders.get_order_book(1)
print("Bids:", book.bids)
print("Asks:", book.asks)
API Reference
MersennetProvider
| Method | Description |
|---|---|
get_block(number, include_txs) |
Get block by number or "latest" |
get_block_by_hash(hash, include_txs) |
Get block by hash |
get_transaction(hash) |
Get transaction by hash |
get_balance(address) |
Get balance (hex string) |
get_nonce(address) |
Get nonce |
send_raw_transaction(raw_tx) |
Send signed transaction |
call(tx_object) |
Simulate call (eth_call) |
chain_id() |
Chain ID |
block_number() |
Latest block number |
view_notes(grant_id_hex, limit, cursor_hex) |
Grant-gated encrypted note export |
gas_price() |
Current gas price |
MersennetOrders
| Method | Description |
|---|---|
add_market(base, quote, lot, tick) |
Add market (admin) |
place_order(market, side, price, amount, tif, owner) |
Place order |
cancel_order(order_id) |
Cancel order |
get_order_book(market) |
Get order book |
get_trades(market) |
Get recent trades |
get_positions(address, market) |
Get positions |
MersennetSubscriber (WebSocket)
| Method | Description |
|---|---|
connect() |
Connect to WebSocket |
disconnect() |
Disconnect |
subscribe_blocks(callback) |
Subscribe to new blocks |
subscribe_trades(market, callback) |
Subscribe to trades |
subscribe_logs(callback, topics, address) |
Subscribe to logs |
unsubscribe(id) |
Unsubscribe |
Shielded Notes
Use view_notes to fetch encrypted note envelopes, then call
scan_granted_notes with a decrypt function that applies your granted
viewing material locally.
from mersennet import GrantedViewingMaterial, MersennetProvider, make_mock_note_decryptor, scan_granted_notes
provider = MersennetProvider("http://localhost:8545")
material = GrantedViewingMaterial(
grant_id_hex="0x...",
recipient_public_key="0x...",
decrypt_note_ciphertext=make_mock_note_decryptor("0x..."),
)
result = scan_granted_notes(provider, material, limit=64)
print("Decrypted notes:", len(result.notes))
See the runnable end-to-end example in examples/view_notes_end_to_end.py.
WebSocket Example
from mersennet import MersennetSubscriber
sub = MersennetSubscriber("ws://localhost:8545")
sub.connect()
def on_block(block):
print("New block:", block)
sub_id = sub.subscribe_blocks(on_block)
# ...
sub.unsubscribe(sub_id)
sub.disconnect()
Error Handling
from mersennet.provider import MersennetError
try:
balance = provider.get_balance("0x...")
except MersennetError as e:
print(f"Error {e.code}: {e}")
Part of the Mersennet ecosystem —
trade ·
explorer ·
docs ·
run a node ·
Telegram
© 2026 Mersennet Foundation · MIT License · security@mersennet.com
Metadata
Release files for mersennet-sdk 0.1.2
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 |
|---|---|---|---|---|
| mersennet_sdk-0.1.2.tar.gz | 27.0 kB | With provenance | Details for mersennet_sdk-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mersennet_sdk-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mersennet_sdk-0.1.2-py3-none-any.whl |
Total release size: 52.2 kB
Release files / mersennet_sdk-0.1.2.tar.gz
| Download URL | mersennet_sdk-0.1.2.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93c630092b1d07e1beef9c880851aa62876a234547651f5d455f58eaad6b7f07
|
|
BLAKE2b-256 checksum How to use checksums |
9f009883a2724404e6675a588aec849a3824958e55f32e9cb6beadacd1a041dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / mersennet_sdk-0.1.2-py3-none-any.whl
| Download URL | mersennet_sdk-0.1.2-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b73748b4cc16c0d37208fd728a2a631638c0f518e4e8b019628b958a8086c77e
|
|
BLAKE2b-256 checksum How to use checksums |
aec96015b8417b6e15929c70f5fb54044768272c8efc4d84dec16e6c71989726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for mersennet-sdk 0.1.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mersennet_sdk-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA 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.