Skip to content

feat(funding-service): add server and status endpoint - #2600

Open
SantiagoPittella wants to merge 7 commits into
nextfrom
fs/1-base-and-status
Open

feat(funding-service): add server and status endpoint#2600
SantiagoPittella wants to merge 7 commits into
nextfrom
fs/1-base-and-status

Conversation

@SantiagoPittella

Copy link
Copy Markdown
Collaborator

Summary

Adds miden-funding-service, a binary that owns one wallet account holding the chain's native asset and will send that asset to any account that asks for it.

The funding account is a genesis [[wallet]]. To let the service load it from a fixed path, a wallet entry can now take a name, which writes its account file to .mac instead of wallet_.mac. Duplicate names are rejected before anything is written.

This PR only includes its status endpoint and plumbing.

Changelog

[[entry]]
scope       = "funding-service"
impact      = "added"
description = "New service which reports its funding account and balance over a `Status` endpoint."

[[entry]]
scope       = "node"
impact      = "added"
description = "A genesis `[[wallet]]` entry accepts an optional `name`, which sets its account file name."

@SantiagoPittella
SantiagoPittella added this pull request to stack #2602 September 9, 2026 19:23
Comment thread crates/store/src/genesis/config/mod.rs Outdated
Comment thread bin/funding-service/src/commands/mod.rs Outdated
Comment on lines +38 to +39
"the funding account {} is not public: the service reads its state from the node, \
which only stores the full state of a public account",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps a question whether we should be doing this or not 🤔 I guess the value owned would be small..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing about limiting the service to public accounts is that it simplifies operations. The service does not even need to keep track of the account itself, just the private key. So I would say if the service is limited to public accounts only, scrap any functionality that tries to keep and validate the local state of the account versus the state provided by the network, and just rely on the latter. Only if the service supports private accounts should you take care of keeping the local state valid.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It does simplify things, also means it easy to check if its out of funds via the explorer.

@igamigo igamigo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing I'm wondering about is whether gRPC is overkill and in general is the right interface for this service. I get that we use gRPC throughout the whole stack, but this feels like something that may be consumed directly by apps/frontends, and the API seems simple enough that plain HTTP/JSON could make integration quite a bit easier.

For example, if the wallet test harness (which is quite complete in terms of what it integration-tests so we probably want to take it into account here) wanted to use this, an HTTP endpoint could just be called directly from the extension with fetch, and the returned note bytes could be parsed and consumed in a very straightforward way. With gRPC we'd need all the corresponding gRPC-Web/client plumbing and generated bindings for this service. Maybe this is not so bad either but it definitely increases complexity.

Maybe I'm overthinking it, but it seems worth considering whether we want this service to have a simpler, more generic interface before committing to gRPC. cc @Mirko-von-Leipzig

Comment thread bin/funding-service/src/commands/mod.rs
Comment thread bin/funding-service/src/account.rs Outdated
Comment on lines +38 to +39
"the funding account {} is not public: the service reads its state from the node, \
which only stores the full state of a public account",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing about limiting the service to public accounts is that it simplifies operations. The service does not even need to keep track of the account itself, just the private key. So I would say if the service is limited to public accounts only, scrap any functionality that tries to keep and validate the local state of the account versus the state provided by the network, and just rely on the latter. Only if the service supports private accounts should you take care of keeping the local state valid.

Comment thread bin/funding-service/src/lib.rs Outdated
Comment thread bin/funding-service/src/commands/mod.rs Outdated
Comment thread bin/funding-service/src/node.rs Outdated
Comment thread bin/funding-service/src/status.rs Outdated
@SantiagoPittella

Copy link
Copy Markdown
Collaborator Author

One thing I'm wondering about is whether gRPC is overkill and in general is the right interface for this service. I get that we use gRPC throughout the whole stack, but this feels like something that may be consumed directly by apps/frontends, and the API seems simple enough that plain HTTP/JSON could make integration quite a bit easier.

I thought of grpc because of two things: In general, I'm not aware into the wallet integration tests impl itself, it was coherent to use gRPC because this is what our services in general uses. And in particular, I had in mind the client integration tests and the network-monitor as the primary users of this service, so it felt natural to use gRPC

Comment thread crates/store/src/genesis/config/mod.rs
@Mirko-von-Leipzig

Copy link
Copy Markdown
Collaborator

One thing I'm wondering about is whether gRPC is overkill and in general is the right interface for this service. I get that we use gRPC throughout the whole stack, but this feels like something that may be consumed directly by apps/frontends, and the API seems simple enough that plain HTTP/JSON could make integration quite a bit easier.

I thought of grpc because of two things: In general, I'm not aware into the wallet integration tests impl itself, it was coherent to use gRPC because this is what our services in general uses. And in particular, I had in mind the client integration tests and the network-monitor as the primary users of this service, so it felt natural to use gRPC

I don't have a strong opinion, I initially thought a simple POST with account ID and amount in the query string would be the way to go. But having a status endpoint does also make sense - though perhaps that can also just be http (?) - this would mainly be for the monitor to consume.

A benefit of the HTTP style is that its much simpler for scripts and a human to use e.g. if we need to send funds somewhere for some random account.

@SantiagoPittella

Copy link
Copy Markdown
Collaborator Author

I don't have a strong opinion, I initially thought a simple POST with account ID and amount in the query string would be the way to go. But having a status endpoint does also make sense - though perhaps that can also just be http (?) - this would mainly be for the monitor to consume.

A benefit of the HTTP style is that its much simpler for scripts and a human to use e.g. if we need to send funds somewhere for some random account.

Okok, sounds better. I'm moving to HTTP

@SantiagoPittella
SantiagoPittella removed this pull request from stack #2602 September 11, 2026 21:01
@SantiagoPittella
SantiagoPittella added this pull request to stack #2616 September 11, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants