Skip to content

Instantly share code, notes, and snippets.

@jl2012
Last active August 17, 2018 11:34
Show Gist options
  • Save jl2012/2db9e434ce7beb8e13354604305f6d77 to your computer and use it in GitHub Desktop.
Save jl2012/2db9e434ce7beb8e13354604305f6d77 to your computer and use it in GitHub Desktop.
Next block and weak block
Objective: to minimize the network and validation lantency when a block is found.
"Next block" committment:
1. We introduce a non-consensus enforced, optional committment in coinbase tx: "next"
2. "next" is a set of txs proposed for the next block, given that this block has full PoW
3. There are 2 miners: Alice and Bob
4. Alice is mining {A,B,C}; Bob is mining {A,B,E}
5. Alice sees tx F, but her block is already full. She commits {F} to her block as "next"
6. Alice later finds a full PoW for {A,B,C}.
7. Bob sees F in "next". He makes sure he has F in his mempool
8. Alice starts mining the new block with {F}, with a new "next", say {G,H}
9. If Bob wants to minimize the orphan rate, he would also mine the new block with {F}, with his own "next", say {G,I,J}
"Weak block":
1. Alice is mining {A,B,C}; Bob is mining {A,B,E}
2. Alice finds a partial PoW for {A,B,C}. It is submitted as weakblock
3. Bob sees the {A,B,C} weakblock. He makes sure he has C in his mempool
4. If Bob wants to minimize the orphan rate, he would switch to {A,B,C} since he doesn't know if other people have {E}
"Weak block with diff committment":
5. Alice now sees a new tx D. She wants to switch to {A,B,D}. However, she isn't sure if everyone has D and she doesn't want to take the risk
6. We introduce a non-consensus enforced, optional committment in coinbase tx: "diff". Alice commits {-C,+D} as "diff", while still mining {A,B,C}
7. Alice finds a partial PoW for {A,B,C} again. This time comes with a "diff"
8. Bob sees the diff. He makes sure he has D in his mempool
9. When Alice is confident that everyone has {D}, she switches to mine {A,B,D}
10. Bob wasn't sure other miners have E or not
11. However, with Alice's weak block, he's pretty confident that other miners have A,B,C,D
12. To reduce orphan risks, Bob switches to {A,B,C}, with a diff of {-C,+E}
13. Bob finds a partial PoW
14. Seeing the diff, Alice makes sure she has E
15. Bob switches back to {A,B,E}
16. Alice may stick to {A,B,D} or switch to {A,B,E}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment