Closed dantol29 closed 3 weeks ago
This issue is stale because it has been open for 30 days with no activity.
It is indeed reasonable to cache the public key in a variable instead of repeatedly making calls to the management canister. We will try to address this soon, but feel free to open a PR yourself if you like.
It is indeed reasonable to cache the public key in a variable instead of repeatedly making calls to the management canister. We will try to address this soon, but feel free to open a PR yourself if you like.
Gonna open PR soon! Thank you for the answer!
Opened the PR
closing this as the PR has been merged here: https://github.com/dfinity/examples/pull/1024
BASIC_BITCOIN example
It takes approximately ~9 seconds to get public key, as well as a decent amount of gas is spent. Is there a reason why we have to call
schnorr_public_key
orecdsa_public_key
each time a user wants to get an address? If not then storing public keys in a static variable would maintain state across different calls to the canister and save lots of time and gas. I understand that this is just an example, but perhaps this optimization would show some devs how to reduce cycle burn rate.Something like: