Skip to content
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
Closed

Use virtual size instead of raw size #43

jnewbery opened this issue Jan 9, 2018 · 4 comments

Comments

@jnewbery
Copy link

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 mentioned this issue Jan 9, 2018
@hkalodner
Copy link
Collaborator

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
Copy link
Author

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

@hkalodner
Copy link
Collaborator

This is now resolved in BlockSci v0.4

@jnewbery
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants