1

I am building a wallet, and I have a question about uncle blocks. Let’s say our user sends a transaction, but there are two competing blockchains. If they both include her transaction, no problem. We can update her balance. If only one of them includes her transaction, we cannot go ahead and update the balance until it’s fixed, right?

Should we wait until one of them is fixed? Or should we choose one of them somehow and then switch only in case we were wrong about the winning chain(this doesn’t sound good because it confuses our user)?

Or is there a better way than these?

0

I'm not sure how wallets typically do this but let me give you some options:

1) Wait until the transaction is mined in any chain and update status. This is rather straightforward but may confuse the user, as you said

2) Wait until there are X blocks mined after the given transaction. Exchanges call these "confirmations" and typically they require maybe 10 of them for Ethereum transactions. So when there are 10 blocks mined on top of the one with your transaction it's considered secure enough and it's "accepted" as the end result.

One of the problems you have is that you can never know how many chains there are and what they look like. Many of the chains probably die out before you even know about them and they're like 1 block long side-chains. Or maybe you hear of them but you can immediately tell that they're most likely dead already.

Another problem you have is that there is never 100% security. Even if you wait 100 blocks, or confirmations, the block with the transaction may in theory end up in a dead chain. In theory it's possible to start a new chain from the genesis block today and it eventually becomes the main chain, if you have enough mining power.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.