Cosmos-sdk: Allow querying for genesis transactions on height 0

Created on 13 Mar 2019  ·  16Comments  ·  Source: cosmos/cosmos-sdk

Summary

It would be nice to be able to query the genesis block as height 0.

Problem Definition

We can query blocks, validatorsets, transactions and others by block height. For the block 0 (genesis block) we can't.

Proposal

It would be nice to unify this experience by indexing the block, transactions and others as height 0 even if they miss some properties.


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
proposal-accepted

Most helpful comment

I don't think /txs/genesis is a cleaner API. If I want to show all transactions I need to stitch again results of multiple requests together.
Also on a side note /txs/genesis conflicts with /txs/{TX_HASH}.

All 16 comments

Why can't you get block 1?

It's not the genesis block isn't it? So I wouldn't see the genesis transactions.

we can query the genesis txs using the /genesis rpc endpoint and parse the gen_txs property

Great! Can we close this issue then?

we could do something like /txs/genesis or /txs?tx.height=0 to get the txs, bc technically it's not a block

I think the biggest case is genesis transactions. So I change the title.

@fedekunze why not make /txs?tx.height=0 parse genesis and pull out the gentx? (i.e. sugar)

That's what he is suggesting I think ;)

@colin-axner want to take on this one when you have time?

The scope would be:

  • pulling the gentxs from the genesis state and return them on a query if heigth=0

For the next iteration, we could add events for each of the genesis txs to make them queryable

@fedekunze yea I can take this on

What is the reasoning for not just adding a new endpoint as suggested above, /txs/genesis? I think this would be a cleaner implementation then using /txs?tx.height=0

👍 let’s go for that one instead

I don't think /txs/genesis is a cleaner API. If I want to show all transactions I need to stitch again results of multiple requests together.
Also on a side note /txs/genesis conflicts with /txs/{TX_HASH}.

@faboweb lets do the cleaner API then, I think I can make /txs?tx.height=0 work

Great!

Pausing work on this until #4751 is resolved and genutils is updated

Was this page helpful?
0 / 5 - 0 ratings