7

I'm trying to fill a few gaps in my understanding of transaction verification and would appreciate any insight.

Without SegWit

  1. Miners broadcast new blocks which contain the signature(s) with every transaction.
  2. Miners can choose to decide whether or not to verify every transaction in the block. They're incentivized to verify every transaction because otherwise the block may be invalid and they would lose their reward.
  3. Full nodes store all the blockchain data and can optionally verify the transactions as well.

Q1: Do full nodes have any incentive to validate transactions they're not directly benefiting from? How often do full nodes actually validate transactions?

With SegWit

  1. Miners broadcast new blocks which may or may not contain the witness.
  2. As before, miners are incentivized to validate the transaction but are also incentivized to omit the witness when broadcasting new blocks to minimize bandwidth.
  3. Full nodes may or may not store the witness data as part of the full blockchain.

Q2: If a full node wanted to validate a transaction but the miner didn't broadcast the witness as part of the new block, who would the full node request the signature from? As far as I understand, there are plans to do witness "pruning" in the long-term to minimize the size of the full blockchain, but what enforces keeping the signatures around in the short-term?

4

Do full nodes have any incentive to validate transactions they're not directly benefiting from?

Yes. If they did not validate all blocks and transactions, they could end up on a blockchain fork which could be facilitated by an attacker. Validating all blocks and transactions allows them to be sure that the node is on the right blockchain.

How often do full nodes actually validate transactions?

For new blocks and transactions, all the time. Every single new block and transaction received by a node is fully validated according to the node's consensus rules. During the initial blockchain sync, transactions and blocks are only partially validated (signatures aren't validated) up to a certain hard-coded block hash, and only if that block hash is part of the best header's chain.

If a full node wanted to validate a transaction but the miner didn't broadcast the witness as part of the new block, who would the full node request the signature from? As far as I understand, there are plans to do witness "pruning" in the long-term to minimize the size of the full blockchain, but what enforces keeping the signatures around in the short-term?

Segwit nodes will always ask for the block with witnesses. If a block is sent to them without witnesses even though witnesses is asked for, the block will be considered invalid and the node that sent the block will be temporarily disconnected from the node and banned. The same goes for transactions, but without the disconnect and banning IIRC. To always ensure that a block comes with a witness, a segwit node will never request a block from a non-segwit node.

  • Andrew chow .... The same goes for transactions(are you referencing mempool or Tx from that banned miner?), also what is IIRC? – user380208 Dec 15 '17 at 19:40
  • @anacondabitch transactions without witnesses are considered invalid but the node that sent it is not necessarily disconnected and banned. IIRC is short for "If I Remember Correctly". – Andrew Chow Dec 16 '17 at 0:52

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.