Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

TODO: Consider Space Efficient Output Format #10

Closed
Psifour opened this issue Sep 27, 2023 · 4 comments
Closed

TODO: Consider Space Efficient Output Format #10

Psifour opened this issue Sep 27, 2023 · 4 comments

Comments

@Psifour
Copy link

Psifour commented Sep 27, 2023

"Decide whether or not we should encode transfer outputs as ceil(log2(output_count))-length bit strings instead of varints, since we know the number of transaction outputs. Saves space but somewhat tricky."

@summraznboi
Copy link

This only practically saves space in the 128-255 outputs scenario, where the output could be encoded as 1 byte instead of 2. Given that the protocol doesn't really allow us to specify that many transfer instructions anyways due to 83 byte limitation in OP_RETURN output, I don't see this as being a practical saving only varint consistency.

@Psifour
Copy link
Author

Psifour commented Sep 27, 2023

I also support the consistency of varints, but only for the sake of consistency.

I view it as highly likely that this may reignite discussion over standardness rules and their place within Bitcoin. As it is only an isStandard rule (not a consensus rule), I prefer to leave it out of my mental model.

@summraznboi
Copy link

I completely agree, just providing additional arguments from a practical space-saving ratio POV for those that might be otherwise swayed by “most compressed is best”.

@casey
Copy link
Owner

casey commented Sep 28, 2023

This only practically saves space in the 128-255 outputs scenario, where the output could be encoded as 1 byte instead of 2. Given that the protocol doesn't really allow us to specify that many transfer instructions anyways due to 83 byte limitation in OP_RETURN output, I don't see this as being a practical saving only varint consistency.

The idea is that instead of encoding the output as a byte string, we encode it as a fixed-length bitstring. Also, keep in mind that the OP_RETURN length limit is subject to change. If the protocol is popular enough, then the length limit would likely be increased.

I think simplicity is a good idea, so that's a knock against doing this. Also, I realized that we can use "invalid" outputs, e.g., an output value which is greater than the last valid output index, for additional operations, like spreading all the coins in a transfer directive evenly among all OP_RETURN outputs. See #20.

@casey casey closed this as completed Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants