Nostr protocol implementation, Relay, RelayPool, high-level client library, NWC client and more.
Project description
Nostr SDK
Description
Nostr protocol implementation, Relay, RelayPool, high-level client library, NWC client and more.
Getting started
pip install nostr-sdk
import asyncio
from datetime import timedelta
from nostr_sdk import *
async def main():
# Init logger
init_logger(LogLevel.INFO)
# Initialize client without signer
# client = Client()
# Initialize with Keys signer
keys = Keys.generate()
client = Client(keys)
# Initialize with NIP46 signer
# app_keys = Keys.parse("..")
# uri = NostrConnectUri.parse("bunker://.. or nostrconnect://..")
# connect = NostrConnect(uri, app_keys, timedelta(seconds=60), None)
# client = Client(connect)
# Add relays and connect
await client.add_relay("wss://relay.damus.io")
await client.add_relay("wss://nos.lol")
await client.connect()
# Send an event using the Nostr Signer
builder = EventBuilder.text_note("Test from Rust Nostr Python!", [])
await client.send_event_builder(builder)
await client.set_metadata(Metadata().set_name("Testing Rust Nostr"))
# Mine a POW event and sign it with custom keys
custom_keys = Keys.generate()
print("Mining a POW text note...")
event = EventBuilder.text_note("Hello from Rust Nostr Python bindings!", []).pow(20).sign_with_keys(custom_keys)
event_id = await client.send_event(event)
print("Event sent:")
print(f" hex: {event_id.to_hex()}")
print(f" bech32: {event_id.to_bech32()}")
await asyncio.sleep(2.0)
# Get events from relays
print("Getting events from relays...")
f = Filter().authors([keys.public_key(), custom_keys.public_key()])
events = await client.fetch_events([f], timedelta(seconds=10))
for event in events.to_vec():
print(event.as_json())
asyncio.run(main())
More examples can be found here.
Supported NIPs
Look at https://github.com/rust-nostr/nostr/tree/master/crates/nostr#supported-nips
Book
Learn more about rust-nostr
at https://rust-nostr.org.
State
This library is in an ALPHA state, things that are implemented generally work but the API will change in breaking ways.
Donations
rust-nostr
is free and open-source. This means we do not earn any revenue by selling it. Instead, we rely on your financial support. If you actively use any of the rust-nostr
libs/software/services, then please donate.
License
This project is distributed under the MIT software license - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file nostr_sdk-0.36.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5989c2ab4c7c2ad3b5d979a1184dc782487fc44fa210308016b86c15ee33553 |
|
MD5 | 82aa78a4bc3ead998bbce399110dd565 |
|
BLAKE2b-256 | 2a5daf81acdbc619e44155f0a5ff767260b3aa346c51f54024ac8bb133121dd2 |
File details
Details for the file nostr_sdk-0.36.0-cp312-cp312-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp312-cp312-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 9.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da99f00a5c9dcfe0998bd44ffe8d9122261b40600dde62eecd873a1cecc7f696 |
|
MD5 | 50a0faa75efb608b74a4612836c4be10 |
|
BLAKE2b-256 | 778db8590f2bbd447abf1529dfffcf427eb1ce77e110a5c88647ae64bb51b840 |
File details
Details for the file nostr_sdk-0.36.0-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 835eb3d1f5024612c65e0a2645ed2231c236f259f36a6c5f6ace95da555a41cf |
|
MD5 | 17d6c3bc1f30b5fcef06183528ba3b22 |
|
BLAKE2b-256 | 6afce92d9acac4fd110690d593cf7d1891726d06acf7ab961da00e3474f981cb |
File details
Details for the file nostr_sdk-0.36.0-cp312-cp312-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp312-cp312-macosx_11_0_x86_64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.12, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f07125eb6f173f2be6341c623cfe1edf068cd1201b1e65ce7275d8421967e16 |
|
MD5 | d3592b6530df16a39a8a29a22624fded |
|
BLAKE2b-256 | 222d745392c574b95bfa9c79f67d93c118da128ac958d2619447c406777ede10 |
File details
Details for the file nostr_sdk-0.36.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d5248acb4d5d4abd802450c37dba59f6f52a200732361dd3d619c42401ca8cb |
|
MD5 | 9498b9c68b13dcaa4dd26d8e9259a6c2 |
|
BLAKE2b-256 | 4c6ee2799c57544b22fdfb1548de280e03905ab0d7c07d92fa25fed260c58110 |
File details
Details for the file nostr_sdk-0.36.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e07c56c147e0ed4cc93bac07f0b28c9e183b5d5779904f167765f2ec64af3f46 |
|
MD5 | 77670e10d24008b0850b2dc1dfa9a960 |
|
BLAKE2b-256 | 741867189fd625e23fcc26df73ef2167ba7e23e9d171f10c845c58a1b734c3bd |
File details
Details for the file nostr_sdk-0.36.0-cp311-cp311-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp311-cp311-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 9.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9eee2b2e74224616ff02cb735a9e0ca9de5e3b83475b28bb76ffee4a2940290 |
|
MD5 | a8be0da7a722e58f512352b7725014fc |
|
BLAKE2b-256 | 1cf55816fb590a2a6310cd6f08e3050dc2462ff35a4aa61236ea51af8b486c3c |
File details
Details for the file nostr_sdk-0.36.0-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4619437e904d2d37c98dd777f364ee9090f49b426b08e79e64edd45884d7ac55 |
|
MD5 | 22f5444c554ae3b056a7b4421204f97a |
|
BLAKE2b-256 | 7112a92ec9fff1ddd541149269a3e7ef73d7f8cb102e234bc753a171752e2c0c |
File details
Details for the file nostr_sdk-0.36.0-cp311-cp311-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a1dc942b778a053dca80d3556dd71d69fe14e732a93bbbe9d85fd2bc812718 |
|
MD5 | ff69a7a1ae0fc19baf0bcd51b4d58797 |
|
BLAKE2b-256 | ce8e6c87e6fdbcdbc51df516f8cc7a5f20b2108a9b921cac390265bc768be747 |
File details
Details for the file nostr_sdk-0.36.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cebf1cdabaec87db2fdaea025564e32d6dfa476726a94ef3bb0606b3e95ec694 |
|
MD5 | 948a7d0a256e588868ba66de258de0c6 |
|
BLAKE2b-256 | e9cb1a6fabd9ff23723fa6206c8dc399595e0cd6ef16247c95ed9379a1fe8cb6 |
File details
Details for the file nostr_sdk-0.36.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b180e8ca4682ef42da2ea63bab798e2ab3116a3773418a6167863f5d42747f61 |
|
MD5 | d7510cd087091f2b3692b7ec2ee60b37 |
|
BLAKE2b-256 | 3b53ab33245bccc21775d1fea3250897067d73386b7989d46f223355deaa484f |
File details
Details for the file nostr_sdk-0.36.0-cp310-cp310-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp310-cp310-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 9.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2b3eb882f2ebe34d65f0e45cdffe20cd80faaff0f2683ee20002dca7d031e76 |
|
MD5 | 51a2adacdf200e2442a68632fd5554e0 |
|
BLAKE2b-256 | 4b77ec811b9260ee4de739e3e486d9a447d69cd81793cd2aab716a63ee3e8af8 |
File details
Details for the file nostr_sdk-0.36.0-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01140ec463951cd00847fd0536688813149549054ff4760210383b3821dbdb3d |
|
MD5 | 0780fb620f202926a4d21d4ffcb0298d |
|
BLAKE2b-256 | 7d7ff57284f3cda097a5c2989ab4f6db185ab73c03ad6d2ad3913bdb0b0b2db4 |
File details
Details for the file nostr_sdk-0.36.0-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ea321737662532619d94c6e687a5dd9f76d8c894880b96e11f5f45ffdcead3 |
|
MD5 | 284c9fcfefc487326506bd89838ae5f5 |
|
BLAKE2b-256 | 5aa1013041601f62bdd03a47a343c16570085914bff4a214778631c8ca4efbb3 |
File details
Details for the file nostr_sdk-0.36.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 152ffac3a649103baa27a3fb3362f65da774424d582e96eee1cb1bbb38b26bbe |
|
MD5 | 39907610271f7efa89415cb4d0ea3bc2 |
|
BLAKE2b-256 | 510caa09750ebf298e816af5fef26eed786d05a3e8a633ef6a032259c897629e |
File details
Details for the file nostr_sdk-0.36.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80579a08ac9396f18401859428ab6fc442ef61753dbde30776a9734b2b62095e |
|
MD5 | 69851b54b8264a86d474a7382d79c2a4 |
|
BLAKE2b-256 | c6a3d641f1a72a51674be61bdaba5ce4948fcb4b999c6ff41d580a2a3b2c767f |
File details
Details for the file nostr_sdk-0.36.0-cp39-cp39-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp39-cp39-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 9.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db55ae698c3abb9441ffad4045dcfb98705601476220fc914efc8e2508b3e23e |
|
MD5 | 5befa116375503eda10115d76abcca69 |
|
BLAKE2b-256 | 1f909f374f7e484fbddfecfbc5de6c0b161c0704feab4639fa135e34fad6df28 |
File details
Details for the file nostr_sdk-0.36.0-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47833c8f4422d5329b74204757017fc6dbae271b3e3e297bf5000abdc12daefa |
|
MD5 | 5bc8fe6a861a14fd32fca96c9c5bf310 |
|
BLAKE2b-256 | d1a6c846be133fd72eaf403f4be8593b230ba392df943a01a65e405e4ee2ce3a |
File details
Details for the file nostr_sdk-0.36.0-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 967d3b949c93cf58d978d5109ce665e4c72a5cee7d316920109c69f631f1f122 |
|
MD5 | a2cf63ca0c21c27c8a79234409452211 |
|
BLAKE2b-256 | 84015aefbec6c96b25fcc12fde7556b1a9aa1229ac1536155acdf22b3b6d38c3 |
File details
Details for the file nostr_sdk-0.36.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: nostr_sdk-0.36.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eebe99ac16e4b25e6a0de0a17a6a27e2d68f2f5d874432f9e1b3494de5f941f7 |
|
MD5 | ddaa4db81cf4e65c4983c5000d7c8e83 |
|
BLAKE2b-256 | e139ae584ae403348756bd1d309a2bea549ab74bccac0cc96316559c99bc2cdb |