-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add "bulk" version of balances endpoints in api-server #777
Comments
How does the front get those different addresses ? From Keplr ? isn't it possible to find them in the backend side, from a master address ? |
Apparently the chain addresses are derivated from the public key So that means we could have a single endpoint that takes the public key and returns all the balances for all the derivated accounts. That would be nice I think. |
That's a nice article, thanks, helped me shed some light on the derivation :D The most interesting thing is the "hardened" derivation (in Not sure if I'm reading this wrong but it seems that even if we do have the master public key (or any derived public key) we cannot derive children that are hardened:
Even if it was possible, another important sentence:
I have a feeling that users might perceive this as lowering their privacy. If users only give us addresses there's not much we can do. If users give us entire public keys, they are sharing more informations than they did before. |
I think you are right about hardened vs non-hardened, but here we don't want to create children public keys, we just want to derive a chain address from the public key, and I think it's not the same thing. About user's security concern, afaik it's transparent for them: Keplr already gives access to the user's public key, here is the proof where I run this snippet in You can see the public key in the output, and it's the same whatever the chain passed to So instead of passing the chain address, the front could give us the public key, and we do all the derivations according to the chains we support. |
@Pitasi I did some tests today, and I can assert that it's possible to generate bech32 addresses from ( This test passes: pb := []byte{
// a key.address
177, 243, 71, 181, 77, 57, 172, 212, 184, 184, 174, 87, 29, 214, 159, 253, 244, 92, 248, 194,
}
adr, err := bech32.ConvertAndEncode("cosmos", pb)
require.NoError(t, err)
// the related cosmos adr in keplr
assert.Equal(t, "cosmos1k8e50d2d8xkdfw9c4et3m45llh69e7xzw6uzga", adr)
adr, err = bech32.ConvertAndEncode("osmo", pb)
require.NoError(t, err)
// the related omosis adr in keplr
assert.Equal(t, "osmo1k8e50d2d8xkdfw9c4et3m45llh69e7xzxp0j70", adr) pub key derivation to generate the raw address : |
Frontend is currently polling these endpoints:
https://api.emeris.com/v1/account/addr1/unbondingdelegations
https://api.emeris.com/v1/account/addr1/stakingbalances
https://api.emeris.com/v1/account/addr1/balance
but it does for many different addrs, since different chains have different derivation paths.
Let's expose some new endpoints that takes a list of addresses as a param so frontend can make a single requests and gather all data it needs!
DoD
/account/balance?address=ADDR1&address=ADDR2
endpoint that takes multiple addresses and returns an object like this:/account/stakingbalances?address=ADDR1&address=ADDR2
endpoint, similar to the previous one/account/unbondingdelegations?address=ADDR1&address=ADDR2
endpoint, similar to the previous oneThe text was updated successfully, but these errors were encountered: