Skip to content

feat: add frigate electrum based RPC methods - #16

Open
sdmg15 wants to merge 5 commits into
bitcoindevkit:masterfrom
sdmg15:master
Open

feat: add frigate electrum based RPC methods#16
sdmg15 wants to merge 5 commits into
bitcoindevkit:masterfrom
sdmg15:master

Conversation

@sdmg15

@sdmg15 sdmg15 commented Apr 29, 2026

Copy link
Copy Markdown

This PR adds supports for additional RPC methods provided by Frigate electrum based RPC server.

The added methods are:

  • server.version: This is the first message sent to establish connection with server
  • blockchain.silentpayments.subscribe: This takes a spend public key and a scan private key and return outputs belonging to the them.
  • blockchain.silentpayments.unsubscribe: This takes a spend public key and a scan private key and unsubscribe from notifications.

Some context:
This is useful for the PR opened at bitcoindevkit/bdk-sp#48 which is doing integration of frigate ephemeral scanning.
Opening this PR in order to receive feedback.

Reference:
https://github.com/sparrowwallet/frigate/

Supported Frigate version 1.3.2

@sdmg15 sdmg15 changed the title feat: add server.version, blockchain.silentpayments.subscribe and blockchain.silentpayments.unsubscribe feat: add frigate electrum based RPC methods Apr 29, 2026
@sdmg15
sdmg15 force-pushed the master branch 2 times, most recently from 225fc0c to 885cd2f Compare April 30, 2026 17:00
@sdmg15
sdmg15 marked this pull request as ready for review May 1, 2026 14:32
@evanlinjin

Copy link
Copy Markdown
Member

Thanks for the PR! Note that it needs a rebase now with the recent merges.

Comment thread src/notification.rs Outdated
Comment thread src/request.rs Outdated
Comment thread src/notification.rs Outdated
Comment thread src/notification.rs Outdated
Comment thread src/notification.rs Outdated
Comment thread src/notification.rs Outdated
Comment thread src/request.rs Outdated

@oleonardolima oleonardolima left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://github.com/sparrowwallet/frigate#serverfeatures it mentions the new field in server.features, is it not needed by bdk-sp ?

Comment thread src/request.rs Outdated
Comment thread src/request.rs
@oleonardolima oleonardolima added the enhancement New feature or request label May 26, 2026
@sdmg15
sdmg15 requested a review from oleonardolima July 3, 2026 12:44
@oleonardolima

Copy link
Copy Markdown
Contributor

@sdmg15 I just thought this now during the call, but you could also try adding support for these in https://github.com/bitcoindevkit/rust-electrum-client, not sure if the architecture there supports it though.

Comment thread src/notification.rs
Comment thread src/notification.rs Outdated
Comment thread src/request.rs
@sdmg15
sdmg15 requested a review from noahjoeris August 3, 2026 08:26

@noahjoeris noahjoeris left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating @sdmg15 !
I left a few more comments

Comment thread src/request.rs Outdated
Comment thread src/notification.rs Outdated
Comment thread src/request.rs Outdated
Comment thread src/request.rs Outdated
Comment thread src/pending_request.rs Outdated
Comment thread src/request.rs Outdated
@sdmg15

sdmg15 commented Aug 4, 2026

Copy link
Copy Markdown
Author

@noahjoeris Thanks for the reviews. I've applied the changes.

@noahjoeris noahjoeris left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for updating man. Almost there 🚀

Could you also add doc comments to the pub fields you added?

Comment thread src/pending_request.rs
GetFeeHistogram,
Banner,
Ping,
Custom

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason you dropped Custom here?

@sdmg15 sdmg15 Aug 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this, I chose the wrong gen_pending_request_types! between the two former existing one.

Comment thread src/request.rs Outdated
Comment on lines +687 to +694
if let Some(start_height) = self.start_height {
params.push(start_height.into());
}

if let Some(labels) = &self.labels {
params.push(serde_json::Value::Null);
params.push(labels.clone().into());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct like this.

Suggested change
if let Some(start_height) = self.start_height {
params.push(start_height.into());
}
if let Some(labels) = &self.labels {
params.push(serde_json::Value::Null);
params.push(labels.clone().into());
}
match (self.start_height, &self.labels) {
(Some(start_height), Some(labels)) => {
params.extend([start_height.into(), labels.clone().into()]);
}
(Some(start_height), None) => params.push(start_height.into()),
(None, Some(labels)) => {
params.extend([serde_json::Value::Null, labels.clone().into()]);
}
(None, None) => {}
}

Comment thread src/request.rs Outdated
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SpUnsubscribe {
pub scan_priv_key: bitcoin::secp256k1::SecretKey,
pub scan_pub_key: bitcoin::secp256k1::PublicKey,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be spend_pub_key

Comment thread src/request.rs Outdated
/// A request to subscribe to payment outputs belonging to the provided keys
///
/// This corresponds to the `"blockchain.silentpayments.subscribe"` Frigate Electrum RPC method.
/// It returns The silent payment address that has been subscribed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// It returns The silent payment address that has been subscribed.
/// It returns the silent payment address that has been subscribed.

Comment thread src/request.rs Outdated
Comment on lines +703 to +704
/// It returns The silent payment address that has been subscribed.This should cancel any scans that
/// may be currently running for this address.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// It returns The silent payment address that has been subscribed.This should cancel any scans that
/// may be currently running for this address.
/// It returns the silent payment address that has been unsubscribed. This should cancel any scans
/// that may be currently running for this address.

Comment thread src/request.rs Outdated
///
/// Supported Frigate version <= 1.4.1
///
/// See: See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// See: See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe
/// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentsunsubscribe

Comment thread src/request.rs Outdated
}
}

/// A request to unsubscribe to payment outputs belonging to the provided keys

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A request to unsubscribe to payment outputs belonging to the provided keys
/// A request to unsubscribe from payment outputs belonging to the provided keys

Comment thread src/notification.rs Outdated
//!
//! - [`Notification::Header`] for `"blockchain.headers.subscribe"`
//! - [`Notification::ScriptHash`] for `"blockchain.scripthash.subscribe"`
//! - [`Notification::SpSubscribe`] for `"blockchain.silentpayments.subscribe"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not resolve without the frigate feature.
maybe use:

//! - `"blockchain.silentpayments.subscribe"` (requires the `frigate` feature)

Comment thread src/request.rs Outdated
///
/// Supported Frigate version: <= 1.4.1
///
/// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// See: https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe
/// See: <https://github.com/sparrowwallet/frigate/tree/1.4.1#blockchainsilentpaymentssubscribe>

Comment thread src/notification.rs Outdated
Comment on lines +116 to +118
/// A notification indicating new confirmed transactions
///
/// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A notification indicating new confirmed transactions
///
/// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method
/// A notification indicating new transactions.
///
/// Corresponds to `"blockchain.silentpayments.subscribe"` Frigate Electrum notification method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants