1

I have known Bitcoin need 6 blocks for confirmation.

However, In ethereum, It is different depend on clients

By this post What number of confirmations is considered secure in Ethereum?

It takes about 3min for block confirmation.

Then if i deploy smart contract, then it will start to work after block confirmation? or after block generation?

Every node will validate my smart contract even though a block which including contract is not generated. Therefore we can know this contract is validate before generating block.

Therefore, by finality, we are sure this transaction must be finished someday. so it seems like smart contracts don't need block confirmation if it is validated by node.

By this post At which point the smart contracts get executed?

But the "official" execution point is the point at which the transaction occurs in the blockchain. If it's transaction #5 in block #3000000, then the transaction's "point of execution" could perhaps only be described as immediately following transaction #4, preceding transaction #6

It means after block is generated, then smart contract worked right...?

Because writer said, execution occurs in blockchain not a block.

I think smart contracts are set of transactions and transactions need block confirmation.

If that quote is right, then why block confirmation is needed in ethereum?

And if block confirmation is needed for deploying smart contracts, Are there no problems which are cased by every client has their own block confirmation number?

1 Answer 1

2

Let's make some things clear first: block confirmations are not required by the blockchain, there is no static amount of confirmations to make something secure and a transaction is valid after it has been mined in a block.

Now a bit more explanations.

Miner nodes include certain amount of transactions in a block which they try to mine. Whoever succeeds in the mining puzzle gets rewarded for it and that mined block becomes part of the blockchain. The problem is that another node may find another (or the same) solution around the same time without knowing about the other solution, so we have two competing blocks. Network consensus mechanism will eventually declare one of the blocks as an uncle block and return that block's transactions to the tx pool so they can be included again in new blocks.

So whenever you see a new block you can't know whether that block will become an uncle block or not. There is a lot of uncertainty in that. If you see another block mined on top of that block the chances of the earlier becoming an uncle are much less already. This is what the number of confirmations means: the number of mined blocks on top of the block which contains the transaction we're interested in.

If you wait for 0 confirmation (no blocks mined on top of the block we're interested in) then it's quite uncertain whether that block will become an uncle or not. If you wait for 100 confirmations it's really really certain that it won't become an uncle, but even with a million confirmation it's never 100% certain, at least in theory. So it's a tradeoff between speed and security: with less confirmations you (or your exchange) accept transactions faster but with less certainty that the transaction will stay forever. With more confirmations the chance of the transaction getting reverted goes down but you have to wait longer.

So from the blockchain's point of view a transaction is valid immediately after it has been included in a mined block. But from user point of view you should wait for some amount of confirmations.

2
  • What happens if you know after a million blocks that there was another fork with a million forked blocks that were mined and added at exactly the same time the chain you're on ? If the next block is added to the other chain, will the millions blocks in this chain become ommer/uncle blocks? Will all transactions in these be returned to the pools?
    – anotherDev
    Commented Aug 8, 2021 at 10:07
  • Uncles are counted only 6 blocks deep, so the rest of them are discarded. More details ethereum.stackexchange.com/a/67/31933 or please post a new question Commented Aug 8, 2021 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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