LNP-BP / LNP-BP/LNPBPs

LNPBP-5: Unset value of tx position and input/output index fields

Open
#22 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement informational
Dominant language
No language data
Stars
202
Forks
39
PR merge metrics
No merged PRs in 30d

Description

hello!
the two fields 32-47 and 49-63 use 0 to encode no value. This has a couple of drawbacks:

  • the coinbase transaction cannot be represented (as @dr-orlovsky specified);
  • the input/output index values need an aritmetic operation (-1) before be used as index.

I think that the encoding would be simpler if N is encoded as N, and INT_MAX(bits) is used to encode UNSET.

I would define the constants

  • UNSET_TX_INDEX = INT_MAX(16) = 0xffff
  • UNSET_IO_INDEX = INT_MAX(15) = 0x7fff

I would redefine the entity Block; On-chain

First bit set to 0, bits 32-47 set to UNSET_TX_INDEX, bit 48 set to 0, bits 49-63 set to UNSET_IO_INDEX

and the entity Transaction; On-chain to

First bit set to 0, bit 48 set to 0, bits 49-63 set to UNSET_IO_INDEX

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Block; On-chain and Transaction; On-chain entity definitions and their uses in the repository. Verify how bits 32–47 and 49–63 currently encode unset values, assess the coinbase and index implications, and update the specification and affected consumers so the proposed sentinel values are consistent everywhere.

Written by the indexing model from the issue text.

Assessment

Domain
blockchain, cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.