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

Querying DenomTrace of coin #756

Closed
randomshinichi opened this issue Apr 6, 2021 · 1 comment · Fixed by #771
Closed

Querying DenomTrace of coin #756

randomshinichi opened this issue Apr 6, 2021 · 1 comment · Fixed by #771
Assignees

Comments

@randomshinichi
Copy link

randomshinichi commented Apr 6, 2021

If you receive a coin from another chain, it will show up as 1000000ibc/27A6394C3F9FF9C9DCF5DFFADF9BB5FE9A37C7E92B006199894CF1824DF9AC7C,100000000000samoleans,99999977256stake because Cosmos SDK hashes the IBC path, so that if coins take multiple hops to get to this chain, the path won't become unbearably long.

In exchange, one needs to query the chain for the actual IBC denomination path. This example is simply lists all the IBC paths that the chain knows about, but there is another endpoint that can query for a specific hash.

grpcurl -plaintext -import-path ./third_party/proto -import-path ./proto -proto ./proto/ibc/applications/transfer/v1/query.proto localhost:9091 ibc.applications.transfer.v1.Query/DenomTraces
{
  "denomTraces": [
    {
      "path": "transfer/channel-0",
      "baseDenom": "samoleans"
    }
  ],
  "pagination": {
    "total": "1"
  }
}

You can also use gaiad

gaiad q ibc-transfer denom-trace 27A6394C3F9FF9C9DCF5DFFADF9BB5FE9A37C7E92B006199894CF1824DF9AC7C --node tcp://localhost:26557
denom_trace:
  base_denom: samoleans
  path: transfer/channel-0

It would be great if this was exposed in CosmJS.

@randomshinichi randomshinichi changed the title Querying DenomTrace of Querying DenomTrace of coin Apr 6, 2021
@ethanfrey
Copy link
Contributor

Yes, this would be useful.

The proto definitions can be found here: https://github.com/cosmos/cosmos-sdk/blob/v0.42.3/proto/ibc/applications/transfer/v1/query.proto

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

Successfully merging a pull request may close this issue.

3 participants