0

I'm building an ethereum wallet, I've setup geth. I'm planning to subscribe to new transactions on geth websocket, I can't figure out how to deal with dropped blocks and hardfork. let's say a user deposits 1 ether and I receive a block from geth saying it's mined, but sometime later it's found it was a fraud block, so miners drop it and create a new chain, in that case will geth notify me of the new block? how should I potentially deal with such situation, exchanges typically require 15 confirmations before they process deposits, how do they implement that?

0

The wallet will pick up the best chain it knows about. This can include an apparent reversal of a previously-observed transaction if later, a longer chain has a different explanation of history.

user deposits 1 ether and I receive a block from geth saying it's mined, but sometime later it's found it was a fraud block, so miners drop it and create a new chain, in that case ...

In that case, the 1 ether was never deposited and the canonical chain has no record of it.

In this context, "confirmations" means more blocks mined and stacked on top of the block containing the transaction to confirm. This is because it becomes exponentially less likely that an observed block will not be preserved each time another block is added to the chain that contains it.

So, you observe the transaction and you wait for more blocks. After the additional blocks arrive, you check that the transaction you are interested in is still part of the chain in the same block where you saw it first.

Hope it helps.

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.