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: history via api #1358

Open
theborakompanioni opened this issue Sep 26, 2022 · 7 comments
Open

Feature request: history via api #1358

theborakompanioni opened this issue Sep 26, 2022 · 7 comments
Labels

Comments

@theborakompanioni
Copy link
Contributor

theborakompanioni commented Sep 26, 2022

Would it be possible to serve the output of wallet-tool.py <wallet> history via the api?
Do you think this is a useful feature that should be implemented?

e.g. (simplified example)

GET /api/v1/wallet/{walletname}/history
{
  "history": [{
    "tx_no": 0,
    "timestamp": 123456789,
    "type": "deposit",
    "amount": "0.00000001",
    "balance_change": "+0.00000001",
    "coinjoin_n": null,
    "total_fees": null,
    "utxo_count": 1,
    "mixdepth_from": null,
    "mixdepth_to": 0
  }, {
    "tx_no": 1,
    "timestamp": 123456789,
    "type": "cj intsweep",
    "amount": "0.00000001",
    "balance_change": "-0.00000001",
    "coinjoin_n": 2,
    "total_fees": "0.00000001",
    "utxo_count": 1,
    "mixdepth_from": 0,
    "mixdepth_to": 1
  },
 [...]
 ]
}

Related issue in Jam: joinmarket-webui/jam#515

@kristapsk
Copy link
Member

Concept ACK on idea, but note that this currently might be slow, especially on old wallets, I mean minutes. Not sure how well Jam will handle that. Related - #1349.

@theborakompanioni
Copy link
Contributor Author

Pump, due to "popular demand".

A pair of offset/count or page/size params for pagination would also be quite helpful.
Would that make the operation finish more quickly? Assuming majority of the users are interested in the most recent transactions.

@kristapsk
Copy link
Member

Would that make the operation finish more quickly?

Not sure how much. Still need to request all transactions from Bitcoin Core. This was my motivation why I worked on bitcoin/bitcoin#19443.

@kristapsk
Copy link
Member

Somewhat related - #420. Qt GUI does not use full history functionality, it just saves list for itself. It works well if you only use single wallet and only use Qt GUI, but not in other cases.

@kristapsk
Copy link
Member

But way forward I think would be to just expose history functionality we already have via API and then look from there how usable it is, what improvements we can make on top of that. And that would mean no pagination options for now, you always get full history.

@theborakompanioni
Copy link
Contributor Author

But way forward I think would be to just expose history functionality we already have via API and then look from there how usable it is, what improvements we can make on top of that. And that would mean no pagination options for now, you always get full history.

If that is acceptable for you, then yes, that would be awesome. Should pagination be supported in the future, I think this can easily be added in a backward compatible way. 💪

@kristapsk
Copy link
Member

Would that make the operation finish more quickly?

Not sure how much. Still need to request all transactions from Bitcoin Core. This was my motivation why I worked on bitcoin/bitcoin#19443.

Actually paging might help, wallet_fetch_history() calls gettransaction RPC not only for JM transaction itself, but also for all input transactions, to figure out which inputs are ours.

Btw, #1625 was great optimization, make it run few times faster for old wallets with a lots of tx history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants