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

getaddressutxos JSON-RPC method #3158

Closed
4 tasks
Tracked by #3134
teor2345 opened this issue Dec 6, 2021 · 5 comments · Fixed by #4087
Closed
4 tasks
Tracked by #3134

getaddressutxos JSON-RPC method #3158

teor2345 opened this issue Dec 6, 2021 · 5 comments · Fixed by #4087
Assignees
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes lightwalletd any work associated with lightwalletd

Comments

@teor2345
Copy link
Contributor

teor2345 commented Dec 6, 2021

Motivation

lightwalletd uses the getaddressutxos JSON-RPC method in response to wallet queries, so this RPC needs to be fast.

Required Fields

The method is documented here: https://zcash.github.io/rpc/getaddressutxos.html

lightwalletd always uses the multi-address request, without chaininfo: https://github.com/zcash/lightwalletd/blob/master/frontend/service.go#L402

Request:

{
  "addresses":
    [
      "address"  (string) The base58check encoded address
      ,...
    ],
}

And only these fields are used by lightwalletd: https://github.com/zcash/lightwalletd/blob/master/common/common.go#L124

Response:

[
  {
    "address"  (string) The address base58check encoded
    "txid"  (string) The output txid
    "height"  (number) The block height
    "outputIndex"  (number) The output index
    "script"  (string) The script hex encoded
    "satoshis"  (number) The number of zatoshis of the output
  }, ...
]

Result Sorting

Returned UTXOs must be sorted by height:
https://github.com/zcash/lightwalletd/blob/68789356fb1a75f62735a529b38389ef08ea7582/walletrpc/service.proto#L120-L121

Tasks

Implementation:

Testing:

  • Add RPC unit tests
  • Test that the RPC method works with lightwalletd
@ftm1000 ftm1000 added the S-needs-triage Status: A bug report needs triage label Feb 10, 2022
@ftm1000
Copy link

ftm1000 commented Feb 10, 2022

@ftm1000 ftm1000 removed the S-needs-triage Status: A bug report needs triage label Feb 21, 2022
@ftm1000 ftm1000 added lightwalletd any work associated with lightwalletd and removed lightwalletd any work associated with lightwalletd labels Mar 16, 2022
@teor2345 teor2345 added A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes labels Mar 24, 2022
@teor2345 teor2345 self-assigned this Mar 30, 2022
@teor2345
Copy link
Contributor Author

teor2345 commented Apr 5, 2022

The state parts of this ticket aren't merged yet (#3999, #4022), but you could add a state request/response that returns an empty list of UTXOs.

@oxarbitrage
Copy link
Contributor

@teor2345 if you didn't started on this one yet i can take it as it similar to #3147

let me know.

@teor2345
Copy link
Contributor Author

@teor2345 if you didn't started on this one yet i can take it as it similar to #3147

let me know.

Sure, go for it!

@teor2345
Copy link
Contributor Author

Returned UTXOs must be sorted by height:
https://github.com/zcash/lightwalletd/blob/68789356fb1a75f62735a529b38389ef08ea7582/walletrpc/service.proto#L120-L121

Zebra's state response already sorts in chain order. (Which is stricter than height sorting.)

@mergify mergify bot closed this as completed in #4087 Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes lightwalletd any work associated with lightwalletd
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants