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

Support Blockchain cache API in Nigel #712

Open
zpalmtree opened this Issue Jan 29, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@zpalmtree
Copy link
Collaborator

zpalmtree commented Jan 29, 2019

It would be nice to support the blockchain cache API (https://github.com/TurtlePay/blockchain-cache-api) transparently for wallets.

You can find the documentation here: https://docs.turtlepay.io/blockapi/

We would probably want to make an IDaemon interface, and then instantiate it with either a ConventionalDaemon or a BlockchainCacheAPI.

This is pretty easy to do, and I've done this exact same thing in TypeScript, so you can easily piggy back off the differences:

Typescript interface: https://github.com/turtlecoin/turtlecoin-wallet-backend-js/blob/master/lib/IDaemon.ts
Typescript conventional daemon: https://github.com/turtlecoin/turtlecoin-wallet-backend-js/blob/master/lib/ConventionalDaemon.ts
Typescript blockchain cache api: https://github.com/turtlecoin/turtlecoin-wallet-backend-js/blob/master/lib/BlockchainCacheApi.ts

You might have to slightly tweak the --remote-node support, but this should hopefully allow us to sync directly from a blockchain cache API instead of a conventional daemon.

Note that currently /get_transaction_status is unimplemented in the cache api, but it should be in there pretty soon. It's not essential to wallet operation anyway.

Bonus

For bonus points, extend KeyOutput in WalletBlockInfo to take an optional globalIndex. The blockchain API returns this from /getWalletSyncData, whilst a standard daemon does not. If we pass this through to processTranasctionOutputs, we can then skip getting the global indexes from the daemon, which will speed up syncing when we have a wallet with a lot of transactions belonging to us.

Relevant code: https://github.com/turtlecoin/turtlecoin/blob/development/src/WalletBackend/WalletSynchronizer.cpp#L261

@brandonlehmann

This comment has been minimized.

Copy link
Collaborator

brandonlehmann commented Jan 30, 2019

I'm told I need to add another api endpoing for this. Let me open an issue over there before I forget.

@brandonlehmann

This comment has been minimized.

Copy link
Collaborator

brandonlehmann commented Jan 30, 2019

Added support in the cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.