0

I trying to build out a service that holds user's monero private keys. But the issue I'm having is how does one update their balance of these private keys? And no I cannot use subaddresses for my use case as each user has their own unique private key. The solution I came up with was scanning each monero private spend key manually one at a time and updating the balance like that. But that's not going to really scale that well if I had 100k private keys to scan.

What can I do to solve updating monero balances of 100 user's private keys?

2 Answers 2

1

The only way I can see to speed this up is to write some code that does parallel crypto ops at a lowish level, roughly where the calls to is_out_to_acc_precomp are made. You can then save all the tx processing, and you then compute the crypto part for N keys rather than one. You can also early out when one key finds a match, since other keys won't find a match for the same output. Doing it this way allows you to have a very parallel run of many times the same small amount of crypto code, which you can offload to a GPU, as those are pretty good at that type of workload.

2
  • yea but how do i even do that? i'm not that hardcore of a protocol developer. if there were libraries I can just work with, it would be great. Dec 3, 2019 at 17:16
  • No code I know of does this yet, except maybe MyMonero since it scans lots of wallets. endogenic in #monero would know for sure.
    – user36303
    Dec 4, 2019 at 10:54
0

Computing the balance of a wallet requires scanning all the transactions with the secret view key to detect received coins, and using the secret spend key to detect which of them have been spent. Therefore if you have several distinct wallets, you have to scan every transaction with the secret keys of every wallet. There is no trick allowing to compute the balances of several distinct wallets faster.

If I understand you question correctly, you're trying to make a custodial wallet (where you have the secret spend keys, like the wallet of an exchange). In this case, having only one wallet and using one subaddress/account per client (or one payment id per client) is the most efficient way to compute the balances, as you only have to scan the transactions with one secret view key, even if you have thousands of clients.

3
  • cannot use subaddresses because the user will also have a copy of their private. its a shared private key system. users should not have each others keys. Mar 8, 2019 at 15:32
  • Why would users ever give the private spend keys of their personal wallets to a third party? That would be a very bad idea.
    – glv
    Mar 8, 2019 at 15:42
  • You get to do unique services related to crypto with a shared private key. Obviously your not putting your entire life savings on such a private key. Ex. Give me your private key to send a payment on your behalf OR send me your monero and lose total control over it. One method you still control the keys and can always withdraw your coins, the other method you give me the coins completely and lose total control over it. Obviously this is all based on trust of the 3rd party. A shared private key has its use cases. Mar 8, 2019 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.