While reading about BIP141, I have encountered the following options:

Block creation options:
-blockmaxweight=<n> Set maximum BIP141 block weight (default: 3000000)
-blockmaxsize=<n>   Set maximum block size in bytes (default: 750000)

What is a block weight? Is it a integer representation of the size?

up vote 4 down vote accepted

Block weight is defined in BIP 141 itself:

Block weight is defined as Base size * 3 + Total size. (rationale[3])

Base size is the block size in bytes with the original transaction serialization without any witness-related data, as seen by a non-upgraded node.

Total size is the block size in bytes with transactions serialized as described in BIP144, including base data and witness data.

The given rationale is:

Rationale of using a single composite constraint, instead of two separate limits such as 1MB base data and 3MB witness data: Using two separate limits would make mining and fee estimation nearly impossible. Miners would need to solve a complex non-linear optimization problem to find the set of transactions that maximize fees given both constraints, and wallets would not be able to know what to pay as it depends on which of the two conditions is most constrained by the time miners try to produce blocks with their transactions in. Another problem with such an approach is freeloading. Once a set of transactions hit the base data 1MB constraint, up to 3MB extra data could be added to the witness by just minimally increasing the fee. The marginal cost for extra witness space effectively becomes zero in that case.

  • so this is a notion defined by the BIP141 not related to the bitcoin core – Sig Touri Jun 20 '17 at 19:46
  • Yes, that's what it looks like. – Nate Eldredge Jun 20 '17 at 20:26

It's a trick that increases the block size without breaking backwards compatibility with non-Segwit nodes. I found this article by Jimmy Song to be more helpful than trying to understand the BIP.

The Segwit blocks are restricted by something called Block Weight. Block Weight is a new concept introduced in Segwit, and it’s calculated on a per-transaction basis. Each transaction has a “weight” which is defined this way:

(tx size with witness data stripped) * 3 + (tx size)

Non-Segwit transactions have zero witness data, so the weight for a non-Segwit transaction is exactly 4 times the size. Segwit transactions have some witness data so the weight is going to be less than 4 times the size. Note Segwit transactions are transmitted to Legacy nodes without witness data, so this formula will always result in blocks communicated to Legacy Nodes that are less than or equal to 1,000,000 bytes.

If you fill a block with non-Segwit transactions (0 bytes of witness data), the number of weight units (WU) will be calculated as

(1,000,000 B - 0 B) * 3 + 1,000,000 B = 4,000,000 WU

But the size of the block is still 1,000,000 bytes. This also means that you can fill a block with Segwit transactions, as long as their size, excluding the witness data, totals to 1,000,000 bytes or less. The reason this works is that non-Segwit nodes don't see the witness data for Segwit transactions, therefore they don't count it towards the block size.

As of 2018-01-21, there have been several blocks, such as this one, mined that are greater than 1MB.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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