Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Address groups #291

Open
junderw opened this issue Aug 21, 2020 · 9 comments
Open

Feature Request: Address groups #291

junderw opened this issue Aug 21, 2020 · 9 comments

Comments

@junderw
Copy link
Contributor

junderw commented Aug 21, 2020

This feature will be implemented in the API as two parts:

  1. A request parameter when tracking an individual address.
  2. A new derivationStrategy type for all HD based calls.

Tracking

When tracking an individual address, passing an optional group value (string) will set a grouping for the address. (ie. "xyz").

So if I call track 5 times with 5 different addresses but all 5 times I add ?group=xyz, then all 5 of those addresses will be contained within group xyz.

HD based queries

In addition to current derivationStrategy, a new type will be created:

group-[xyz] where xyz is the name of the group.

Any time a call is made using group-[xyz] as the dS, it will perform the query as-if the addresses that were added into the group all came from the same derivationStrategy.

@joemphilips
Copy link
Contributor

This is very useful for tracking non-multisig P2WSH, In my case I want to track OP_CSV locked utxo for LN.
I want to batch query to get total on-chain funds amount for those UTXOs.

@NicolasDorier
Copy link
Member

NicolasDorier commented Aug 21, 2020

Very interesting idea.
I wanted to do that kind of things, but I could not think about a good API. As you propose seems to be a great idea.

Given the design of NBX, I don't expect that to be difficult to add.

@quasar-U127
Copy link
Contributor

@NicolasDorier Is this still a required feature

@NicolasDorier
Copy link
Member

I think it is useful feature yes

@quasar-U127
Copy link
Contributor

Has there been work done on this? If not I would like to work on it.

@junderw
Copy link
Contributor Author

junderw commented Aug 7, 2021

I don't think anyone has worked on this.

@Kukks
Copy link
Contributor

Kukks commented Sep 18, 2023

I will begin work on something along these lines.

@Kukks
Copy link
Contributor

Kukks commented Oct 2, 2023

I will begin work on something along these lines.

Update on this:
So it turns out this is quite easy to do and supported on the postgres backend already.

"INSERT INTO wallets VALUES ('group') ON CONFLICT DO NOTHING
INSERT INTO wallets_wallets VALUES ('existingwallet', 'group') ON CONFLICT DO NOTHING

Everytime you query the wallet group, it will give you all the data of its child wallets.

You don't need to create a new wallet for each address either. You can just attach a script directly to a wallet:

"INSERT INTO scripts VALUES ('BTC', 'a1', 'a1');" +
"INSERT INTO wallets_scripts (code, wallet_id, script) VALUES ('BTC', 'group', 'a1');"

I guess the main blocker here is that the API doesn't expose any of this and you have to do it through direct database interaction.

@junderw
Copy link
Contributor Author

junderw commented Oct 2, 2023

This seems like it could just be added as some extra conditions on the track endpoint.

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

No branches or pull requests

5 participants