Skip to content

feat(dip-18): add distinct type byte prefixes#176

Merged
thephez merged 2 commits intodashpay:feat/dip17from
thephez:feat/dip17-type-byte
Jan 21, 2026
Merged

feat(dip-18): add distinct type byte prefixes#176
thephez merged 2 commits intodashpay:feat/dip17from
thephez:feat/dip17-type-byte

Conversation

@thephez
Copy link
Collaborator

@thephez thephez commented Jan 20, 2026

  • Change type bytes to 0xb0 (P2PKH) and 0x80 (P2SH) for visually distinct prefixes:
    • P2PKH addresses start with k (e.g., evo1k...)
    • P2SH addresses start with s (e.g., evo1s...)
  • Update test vectors and reference implementation

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Summary by CodeRabbit

  • Documentation

    • Address encoding specification updated with new type-byte scheme, expanded "Type byte meaning" table, visual-address-pattern examples, reserved type-byte ranges, and guidance for hardware displays.
  • Tests

    • Address test vectors and payload examples updated for mainnet and testnet to reflect revised type-byte values.
  • Other

    • Hardware wallet address validation and display guidance updated; added a type-byte calculation utility reference.

✏️ Tip: You can customize this high-level summary in your review settings.

Change type bytes to produce distinct address prefixes:
- P2PKH: 0xb0 -> addresses start with "k"
- P2SH: 0x80 -> addresses start with "s"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Updated Dash address type-byte encoding from 0x00/0x01 to 0xb0/0x80 across spec and implementation; adjusted bech32 mappings, test vectors, payload construction, validation rules, hardware-wallet guidance, and added a type-byte calculation utility script.

Changes

Cohort / File(s) Summary
Specification Documentation
dip-0018.md
Replaced type-byte references 0x00/0x01 with 0xb0/0x80 throughout; updated payload construction, bech32m handling, validation checks, first-character/type table, reserved ranges, examples, test vectors, and hardware wallet display guidance.
Bech32 Implementation
dip-0018/bech32.py
Updated TYPE_TO_BYTE mapping (p2pkh: 0x000xb0, p2sh: 0x010x80) and regenerated BYTE_TO_TYPE mapping and test expectations accordingly.
Type-byte Tooling
dip-0018/type_byte_calc.py
Added new helper script with CHARSET, convertbits, find_type_byte_for_char, and show_encoding_for_type_byte to search and display type-bytes that produce desired first bech32 characters; includes demonstration output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing distinct type byte prefixes (0xb0 for P2PKH and 0x80 for P2SH) to enable visually distinct address formats.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thephez
Copy link
Collaborator Author

thephez commented Jan 20, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…anges

- Explain why type byte values were chosen
- Add reserved type byte ranges to prevent future collisions
- Add type_byte_calc.py utility for finding type bytes that map to desired characters
@thephez
Copy link
Collaborator Author

thephez commented Jan 20, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thephez thephez marked this pull request as ready for review January 21, 2026 16:12
@thephez thephez merged commit e58bdf3 into dashpay:feat/dip17 Jan 21, 2026
2 checks passed
@thephez thephez deleted the feat/dip17-type-byte branch January 21, 2026 16:26
thephez added a commit that referenced this pull request Mar 11, 2026
…orm address encodings) (#171)

* Add DIP-17 derivation for Platform payments and DIP-18 encoding (P2PKH/P2SH) with Core vs Platform terminology

* Update dip-0017.md

* chore: dip-17/18 suggestions (#172)

* chore: lint fixes

* fix: correct order of feature and account

* chore: update copyright

* docs: add prior work sections and improve formatting in DIP-17/18

Add Prior Work sections referencing DIP-0009, BIP-0032, and BIP-0044 in DIP-17 and DIP-0017 in DIP-18. Convert path examples to table format, add key_class forward compatibility note, and fix minor formatting.

* docs: add new dips to readme and update create date

* docs: standardize dip number representation and add links

* docs: add more prior work references

* Update dip-0017.md

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* feat(dip-18): switch to bech32m encoding with reference implementation (#173)

* feat(dip-18): switch to bech32m encoding with reference implementation

Replace Base58Check encoding with bech32m (BIP-350) for Platform addresses.
Add Python reference implementation with full DIP-17 test vector validation.

* chore: update authors list for dip-18

* chore(dip18): update bech2 hrp to (t)dashevo

* docs(dip18): formatting and minor updates

* fix(dip18): add BIP-39 NFKD normalization to mnemonic_to_seed

Normalize mnemonic and passphrase with NFKD before UTF-8 encoding per BIP-39 spec.

* refactor(dip18): use verbatim BIP-350 reference implementation

Replace custom Bech32m implementation with exact code from sipa's reference at github.com/sipa/bech32. Adds MIT license header and proper attribution.

* docs(dip18): reference Python implementation in spec

* chore: formatting and minor updates

* docs(dip17): expand motivation per review comment

* feat(dip-18): shorten HRP from dashevo/tdashevo to evo/tevo

Update network prefixes to use shorter human-readable parts for more compact platform addresses.

* feat(dip-18): add distinct type byte prefixes (#176)

* feat(dip-18): use type bytes 0xb0/0x80 for P2PKH/P2SH

Change type bytes to produce distinct address prefixes:
- P2PKH: 0xb0 -> addresses start with "k"
- P2SH: 0x80 -> addresses start with "s"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(dip-18): document type byte visual identification and reserved ranges

- Explain why type byte values were chosen
- Add reserved type byte ranges to prevent future collisions
- Add type_byte_calc.py utility for finding type bytes that map to desired characters

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* docs(dip-18): address review comment

* docs(dip-18): update hrp and test vectors to use dash/tdash

* docs(dip-18): update p2sh byte type to 0xb8

Now use "h" instead of "s" which is being reserved for future platform features

* docs(dip-18): add type byte clarifying note about address encoding vs on-disk storage

* typo

* Apply suggestion from @lklimek

* docs(dip-18): revert p2sh byte type back to 0xb0

Per input from @QuantumExplorer

* chore: updates per review feedback

* chore: update per review feedback

* docs(dip-17): clarify pseudocode to show account is hardened

---------

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

1 participant