Currently, when gossip is enabled, are used all relays in user lists (there isn't a relays score at the moment). This will be improved in the next versions where will be kept a relays and gossip state into the database.
But anyway, it's weird that it require hours to complete. Can you share a code example?
To reduce speed compilation you can disable all default features (I'll probably disable all feature by default in future) and, to reduce the binary size, change some `profile.release` config.
Tests for the example I shared yesterday:
Default features and default release profile:
* compilation time: 43 secs
* cdylib size: 479kb
* staticlib size: 58Mb
Without default features but with default release profile:
* compilation time: 31 secs
* cdylib size: 479kb
* staticlib size: 49Mb
Without default features and with LTO enabled, codegen-units set to 1 and abort on panic (but still optimized for performance instead of size):
* compilation time: 35 secs
* cdylib size: 437kb
* staticlib size: 12Mb
Same as above but optimized for size (not aggressive):
* compilation time: 30 secs
* cdylib size: 427kb
* staticlib size: 9.5Mb
I not plan to write a sync version of the SDK, also if very very basic. But I can try to reduce the above values as much as possible.
Do you mean for Kotlin? I would say yes, but this will bring back the maintainability "issues" on my side.
If you need just a basic blocking client I could help to write and integrate it in your project, but you'll have to maintain it by yourself. It can be extended/adjusted depending on your project needs.
Just to know, are there problems with async version in kotlin? Do it increase code complexity?
## rust-nostr v0.36 is out! 🦀
### Summary
Many, many improvements to `Relay` and `RelayPool` performance (reduced atomic operations and switched to async concurrency), add `NostrSigner` trait, better methods and struct names (`fetch_events` instead of `get_events_of`, `sync` instead of `reconcile`, `NostrConnect` instead of `Nip46Signer` and so on), add `LocalRelay` and allow to easily serve it as hidden onion service with the embedded tor client, allow to keep track of negentropy sync progress, almost halved the weight of JavaScript SDK bindings (from ~6.3MB to ~3.6MB), new experimental Flutter package, some fixes and many more!
Note for Python, Kotlin, Swift and JavaScript devs: unfortunately I can't mark things as deprecated in bindings, so this release have many breaking changes, sorry :(
Note for devs who are using `nostr-protocol` (Python), `org.rust-nostr:nostr` (Kotlin), `nostr-swift` (Swift) or `@rust-nostr/nostr` (JavaScript) libraries: these packages are now deprecated. Only the `nostr-sdk` library will be released, which include everything that was in those libraries.
Full changelog: https://rust-nostr.org/changelog
### Contributors
Thanks to all contributors!
* @RydalWater
* @rodant
* @w3ird
### Links
https://rust-nostr.orghttps://rust-nostr.org/donate
#rustnostr #nostr #rustlang #programming #rust #python #javascript #kotlin #swift #flutter
Do you mean for Kotlin? I would say yes, but this will bring back the maintainability "issues" on my side.
If you need just a basic blocking client I could help to write and integrate it in your project, but you'll have to maintain it by yourself. It can be extended/adjusted depending on your project needs.
Just to know, are there problems with async version in kotlin? Do it increase code complexity?
No, according to NIP01 only single-letter tag are allowed in filter.
Is the "dinosaur" string included in `content` field? The `search` filter generally look only in `content` field.
The `NostrSigner::nip46` internally only construct the `NostrSigner` enumeration.
At a certain point the `Nip46Signer` have to wait for a response from the signer. Can you point me where you use it in the code?
Ok, maybe I found the issue. The connection with signer is already initialized on demand. But, the bootstrap is executed when `signer_public_key` method is called... I saw that in your code you are calling the `NostrSigner::public_key` method, that internally call the `signer_public_key` method. For this reason it block.
I'll rework it
According to new NIP-46 clarifications, the remote signer public key could be different from the user public key. So I have to adjust it again. This means that if you'll call `NostrSigner::public_key` method with a NIP46 signer, it will block until the signer reply or the timeout is reached. After the first call is executed correctly, the pk is cached.
In new version (for now in master branch) `NostrSigner::public_key` return the user public key.
In the last release depends by the signer, but during my tests I saw that the same key is used (so the signer key match the user one), at least in amber and nsec.app.
No, my bad. The subscription can fail only if relay not support read operations, if the filter is empty or for timeout. In the log what do you see when it fail and return `not subscribed`?
I still consider it in alpha state due to the API breaking changes and some thing under the hood that should be reworked, but it's pretty stable and probably mature (I work on it from 2 years).
The outbox model is available from `v0.35` but it's a first implementation and could have issues.
I'm aware of many project that use it, but not famous (mobile) clients.
I know that Lume, Coop, Mostro, ngit-cli, Mutiny, Voyage (only the nostr lib, not nostr-sdk), DVM python projects, joinstr and whitenoise use it.
You can find others here (only the ones published on github): https://github.com/rust-nostr/nostr/network/dependents
## rust-nostr v0.35 is out! 🦀
### Summary
Add gossip model support, deprecate `SQLite` database in favor of `LMDB` (fork of @Mike Dilger's pocket database), add support to negentropy v1 (old version is still supported!), add `MockRelay` (a local disposable relay for tests), allow usage of embedded tor client on mobile devices, many improvements, bugs fix and more!
Full changelog: https://rust-nostr.org/changelog
### Contributors
Thanks to all contributors!
* @Melonion
* @w3ird
* @RydalWater
* nanikamado
### Links
https://rust-nostr.orghttps://rust-nostr.org/donate
#rustnostr #nostr #rustlang #programming #rust #python #javascript #kotlin #swift
New version of `rust-ntfy` is out!
This version include support for authentication with access token.
https://github.com/shadowylab/ntfy
#rustlang #programming #rust #ntfy
Yes, sure, thank you!
Currently I'm using `reqwest` for NIP05 and NIP11, so I would say to use it also for blossom. If there is a better one (that works on WASM too), it can be replaced.
I found the cause: it's the signature verification method.
Removing it the size (unzipped) is 642kb.
The verify signature method internally call only `secp.verify_schnorr` method (`secp256k1` library).
You have to save the `bunker` URI in the localstorage for future connections. You can get it after first connection by calling `Nip46Signer::bunker_uri` method.
https://github.com/rust-nostr/nostr/issues/491
## rust-nostr v0.34 is out! 🦀
### Summary
Add embedded tor client support, allow to open databases with a limited capacity (automatically discard old events when max capacity is reached), add `Client::stream_events_of` as alternative method to `Client::get_events_of` (stream events instead of waiting for `EOSE` and collect into a list), add search capability (NIP-50) support to `Filter::match_event` and databases, add NIP-31 and NIP-70 support, add option to autoconnect relay on `Client::add_relay` method call (currently disabled by default), rework the `get_events_of` methods behaviour for better consistency (`RelayPool::get_events_of` and `Relay::get_events_of` get events only from remote relay/s while `Client::get_events_of` allow to choose the source of events: `database`, `relays` or `both`), bugs fix and more!
Full changelog: https://rust-nostr.org/changelog
### Contributors
Thanks to all contributors!
* @reya
* @RydalWater
### Links
https://rust-nostr.orghttps://rust-nostr.org/donate
#rustnostr #nostr #rustlang #programming #rust #python #javascript #kotlin #swift
No, it not support that. Only received events are persistent if you are using indexeddb.
NostrConnectURI not support de/serialization with serde but you can use the `.to_string()` method to serialize it as str and `NostrConnectURI::parse` to parse it.
Weird, I'm not able to reproduce the issue.
Can you provide a simple example to reproduce it?
I tried this but works:
```rust
use nostr_sdk::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let database = SQLiteDatabase::open("./db/sqlite.db").await?;
let client: Client = ClientBuilder::default().database(database).build();
client.add_relay("wss://relay.damus.io").await?;
client.connect().await;
// Negentropy reconcile
let filter = Filter::new().kind(Kind::GitRepoAnnouncement);
client
.reconcile(filter, NegentropyOptions::default())
.await?;
// Query events from database
let coordinate = [
// rust-nostr repo
Coordinate::parse("naddr1qq98yatnwskkummnw3eqz9thwden5te0wp6hyurvv4ex2mrp0yhxxmmdqgsx3kq3vkgczq9hmfplc28h687py42yvms3zkyxh8nmkvn0vhkyyusrqsqqqaue3uzvg2")?,
// example repo
Coordinate::parse("naddr1qqrkxcf3xyuxzcgpp4mhxue69uhkummn9ekx7mqzyzsq3hh327t0h2dq6matqn5064cgj2zanl2stkj6s0lg4t2h5dty6qcyqqq80xg2w8nml")?
];
let filter = Filter::new()
.kind(Kind::GitRepoAnnouncement)
.identifiers(
coordinate
.iter()
.map(|c| c.identifier.clone())
.collect::<Vec<String>>(),
)
.authors(
coordinate
.iter()
.map(|c| c.public_key)
.collect::<Vec<PublicKey>>(),
);
let events = client.database().query(vec![filter], Order::Desc).await?;
for event in events.into_iter() {
println!("{}", event.as_json());
}
Ok(())
}
```
The output that I receive is:
```json
{"id":"7f7a9fac2584002b6beb97d62989affdbd4b13659b277fa9d90a034f44dbdee2","pubkey":"a008def15796fba9a0d6fab04e8fd57089285d9fd505da5a83fe8aad57a3564d","created_at":1722589461,"kind":30617,"tags":[["d","ca118aa"],["r","ca118aac0e3fa285da167a315f3e68b2654ff792","euc"],["name","Example Repo"],["description","demonstrate ngit and gitworkshop features"],["clone","https://github.com/DanConwayDev/ExampleRepo.git"],["web","https://gitworkshop.dev/repo/ca118aa"],["relays","wss://relay.nostr.band/","wss://nos.lol/","wss://relay.damus.io/"],["maintainers","a008def15796fba9a0d6fab04e8fd57089285d9fd505da5a83fe8aad57a3564d"],["alt","git repository: Example Repo"]],"content":"","sig":"d5e9ef370add7e06f9b5706a40674a47597c4dfa0961fc77db4aa76108b2423bd331ddcffdedd0ff1513c6b75263e85b8c9a6d85435a68845d08300b889ce915"}
{"id":"6988cf03ed1e6f4c684ef04997b087820fb36bc6650912bc241e45d35db8fb53","pubkey":"68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272","created_at":1719967094,"kind":30617,"tags":[["d","rust-nostr"],["r","73f7c34fd424cae57a0da1be1f5fd31d9b8075c0"],["name","rust-nostr"],["description","Nostr protocol implementation, SDK and FFI"],["clone","https://github.com/rust-nostr/nostr.git"],["web","https://rust-nostr.org"],["relays","wss://relay.damus.io","wss://nos.lol","wss://nostr.mom","wss://nostr.oxtr.dev","wss://relay.nostr.bg"],["maintainers","68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272"]],"content":"","sig":"84af432928a39f892b117e86c2bd205fa3dc2e840e3373eb1229a0719707f5f5621e7379a48a6ef309a33089b29cdb8b0f2bb0d8f432e443586f29117a968f11"}
```
Ah sorry, according to bech32 could happen if the passed data is too long. So, in the case of `Coordinate`, if the identifier is huge the code will return an error. It's unlikely that happen for `Coordinate` but possible with other structs like `Nip19Profile` (ex. adding many relays).
https://github.com/rust-nostr/nostr/pull/394
## rust-nostr v0.33.0 is out! 🦀
### Summary
Better outputs for send/batch/reconcile methods (ex. you can now easily know where a message/event is successfully published and where/why failed), allow to change NIP-42 option after client initialization, increase max stack size for JS bindings to prevent "memory access out of bounds" error, expose more objects/methods for JS bindings, dry run option for negentropy reconciliation, get NIP-46 relay from NIP-05 profile, bug fixes (NIP-42 auth not works correctly, NIP-46 "ACK" message not handled, ...) and more!
Full changelog: https://rust-nostr.org/changelog
### Contributors
Thanks to all contributors!
* @DanConwayDev
* @xy
* @dcadenas
* @RydalWater
* @AB
### Links
https://rust-nostr.orghttps://rust-nostr.org/donate
#rustnostr #nostr
I tried to add the send failures at commit `bdd250dab7f107b78aae63214c115336248e8367`.
What do you think of that solution? I'm not still very convinced but for now could be good.
I'll try to add receive errors in the v0.34 release, in next few days I'll release v0.33
Thanks, it's a bug introduced during some changes to `get_events_of` method: by default the `MemoryDatabase` not store events so can't query. The zap method internally call `get_events_of` to get the pubkey metadata.
I'm going to fix it
Notes by Yuki Kishimoto | export