New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use virtual size instead of raw size #43

Closed
jnewbery opened this Issue Jan 9, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@jnewbery

jnewbery commented Jan 9, 2018

Since segwit was activated at block 494,784, the limiting resource on block space is 'weight', which is defined in BIP 141 as:

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.

For fee market analysis, the relevant metric is transaction weight (Base transaction size * 3 + Total transaction size), which can be normalized to virtual size (Transaction weight / 4). This is because miners will order transactions by fee/virtual byte to maximize the fee yield from a block.

For transactions without any segwit inputs, virtual size is the same as size.

BlockSci should therefore store the tx virtual size instead of tx size. Virtual size is exposed in the getrawtransaction and getblock (with verbosity=2) RPC methods as vsize.

@jnewbery jnewbery referenced this issue Jan 9, 2018

Closed

Segwit Support #1

@hkalodner

This comment has been minimized.

Collaborator

hkalodner commented Jan 10, 2018

Good catch, this is definitely a segwit support issue. I think the answer is to record both the real size and the virtual size since they are both useful quantities. Both should be able to fit in the current data format without any major changes. I'll slot this for the next major release.

@jnewbery

This comment has been minimized.

jnewbery commented Jan 10, 2018

Great. I'm happy to review/test once you have something.

@hkalodner

This comment has been minimized.

Collaborator

hkalodner commented Mar 9, 2018

This is now resolved in BlockSci v0.4

@hkalodner hkalodner closed this Mar 9, 2018

@jnewbery

This comment has been minimized.

jnewbery commented Mar 9, 2018

Thanks @hkalodner

(for reference, I believe this is the change: 7b78aba#diff-8eea305b6ac0a8dacd8fea0778fd383fR63)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment