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

tutorial for verifying ibc asset #1

Open
okwme opened this issue Jan 22, 2021 · 4 comments
Open

tutorial for verifying ibc asset #1

okwme opened this issue Jan 22, 2021 · 4 comments
Assignees

Comments

@okwme
Copy link

okwme commented Jan 22, 2021

create a tutorial for a wallet/dapp developer to use CosmJS and accepts an account address for some network (probably Cosmos Hub). What are the necessary steps to query that user account and see that they have an IBC asset, and prove the origin of that asset. It will involve querying the IBC module for chain id and app hash info, then querying the github.com/cosmos/registry and/or atlas.cosmos.network to check the networks with that chain-id, verify the app state to prove that is the actual network and then tell the user that asset for sure came from that network.

@okwme okwme changed the title tutorial tutorial for verifying ibc asset Jan 22, 2021
@randomshinichi
Copy link

Is there a sample "IBC asset" I can already refer to in this tutorial?

@randomshinichi
Copy link

randomshinichi commented Mar 25, 2021

get the balances of a user account on chainA
chainB's asset will show up as ibc/hash.
: 1000000ibc/27A6394C3F9FF9C9DCF5DFFADF9BB5FE9A37C7E92B006199894CF1824DF9AC7C,100000000000samoleans,99999977256stake

** Need to get complete DenomPath, but how from cosmjs?
cosmos-sdk/docs/basics/query-lifecycle.md
cosmos-sdk/docs/core/grpc_rest.md
GRPC interface at tcp:9090. Use [[https://github.com/fullstorydev/grpcurl][grpcurl]] to quickly test endpoints.
REST interface at tcp:1317, which is actually generated from the GRPC interface. However, relayer doesn't seem to enable this interface for the gaia it starts.

cosmos-sdk/x/ibc/applications/transfer/spec/01_concepts.md
Get the full path of the denomination.
: GET /ibc_transfer/v1beta1/denom_traces/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2->{"path": "transfer/channelToA", "base_denom": "uatom"}
Ask for information about the channel. It should give the clientID and chainID, which we will ask the chain registry about later.
: GET /ibc/channel/v1beta1/channels/channelToA/ports/transfer/client_state"->{"client_id": "clientA", "chain-id": "chainA", ...}
Ask for information about the IBC client. If the chain is not connected to the channel, this will say "not found"
: GET /ibc/channel/v1beta1/channels/channelToA/ports/transfer"->{"channel_id": "channelToA", port_id": "transfer", counterparty: {"channel_id": "channelToB", port_id": "transfer"}, ...}
Presumably I'd have to verify that the IBC client is within the trusting period (336h = 14d)

verify that ibc light client for chainB has not expired yet

problem: atlas.cosmos.network seems to have no relevant info. github.com/cosmos/registry: which information here is relevant? registry/cosmoshub-3/light-roots/latest.json was last updated 4 months ago, how can this be relevant?
Compare clientID, channelID, portID, chainID and say yes.

@okwme
Copy link
Author

okwme commented Mar 25, 2021

Don't forget there's a live swagger API here that is by default pointed to the hub but can be directed to a local node (as long as https/http mixed content doesn't prevent the queries): https://cosmos.network/rpc/v0.41.4

problem: atlas.cosmos.network seems to have no relevant info.

atlas.cosmos.network is a list of all publicly available tendermint nodes. These are all IPs that could be used as endpoints for the CLI or CosmJS to make queries against. There is no guarantee that they are all fully available tho, some may have restrictions of who can access or whther they support historical queries etc.

@randomshinichi
Copy link

randomshinichi commented Apr 12, 2021

Blockers
Latest version of CosmJS on npm, 0.24.1, lacks two things:

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

No branches or pull requests

4 participants