Shard Block Height-Beacon Height synchronization

Hey @Ducky,

Could you forward my questions to the devs?

Let’s assume that my account is in shard 5 whose height 100 and the beacon height is 112. I want to perform a transaction with 101. block in shard 5. Currently, I’m doing this by checking the beacon height in the result of getblockchaininfo like this

currentBeaconHeight = getBeaconHeight()
while True:
     if getBeaconHeight() > currentBeaconHeight:
            break
sendTx()

However, today I’ve noticed that some of my Txs are sent in 100. block, not 101. block. Why? Should I check the block height of shard 5 instead of the beacon height? If so, why? Aren’t they synchronized? Synchronized but because of the network latency, are there some minimal shifts among the shard block heights? If so, at most how many seconds? Or should I use another RPC instead of getblockchaininfo?

Thanks for the answer.

P.S.: Initially, I wrote such questions in Builders category. Then I don’t remember him/her, one of the admins moved them to this category. However, I do not feel confident in this category :slight_smile: Could you create a subcategory (like Q&A) in Builders category for such questions? @Ducky

Hello,

Shard chain and beacon chain are not synchronized in that way. The block creation is asynchronous between beacon and shard. It means they produce blocks independently regardless of other chain operations.

The synchronization between chain occur only in data. When shard produces block, it mark the beacon height in its header. Also, when beacon produces block, it marks the shard height in its body shard state.

To sum up, you cannot determine next shard height by using beacon height.
So the logic is when you see shard is in 100, just send tx within 40s, it will be included in block 101 of that shard.
But currently, node is delayed 1 block to be confirmed, so when you see shard is in 100, means it already has block 101 in the committee network. You need to tweak some code to achieve your intention.

Regards

3 Likes