Skip to content

Add testnet/regtest network detection to coinbase decoder#1578

Merged
0xf0xx0 merged 3 commits intobitaxeorg:masterfrom
warioishere:feature/testnet-address-detection
Apr 17, 2026
Merged

Add testnet/regtest network detection to coinbase decoder#1578
0xf0xx0 merged 3 commits intobitaxeorg:masterfrom
warioishere:feature/testnet-address-detection

Conversation

@warioishere
Copy link
Copy Markdown
Contributor

@warioishere warioishere commented Feb 25, 2026

Summary

  • Detect network from user address prefix (bc1/tb1/bcrt1/m/n/2) and use correct bech32 HRP and base58 version bytes when decoding coinbase output addresses
  • Previously hardcoded to mainnet, causing testnet/regtest addresses to display with bc1 prefix instead of tb1/bcrt1
  • Add test cases for testnet (P2PKH, P2SH, P2WPKH, P2TR) and regtest (P2WPKH)
  • Remove duplicate function declarations in coinbase_decoder.h

Test plan

  • Verify mainnet addresses still decode correctly (existing tests pass)
  • Verify testnet bech32 addresses decode with tb1 prefix
  • Verify regtest bech32 addresses decode with bcrt1 prefix
  • Verify testnet P2PKH addresses start with m or n
  • Verify testnet P2SH addresses start with 2

warioishere added a commit to warioishere/ESP-Miner that referenced this pull request Feb 25, 2026
Detect network from user address prefix (bc1/tb1/bcrt1/m/n/2) and use
the correct bech32 HRP and base58 version bytes when decoding coinbase
output addresses. Previously hardcoded to mainnet ("bc", 0x00/0x05).

- P2PKH: 0x6F for testnet (m/n prefix) instead of 0x00
- P2SH: 0xC4 for testnet (2 prefix) instead of 0x05
- Bech32: "tb" for testnet, "bcrt" for regtest instead of "bc"
- Add test cases for testnet P2PKH, P2SH, P2WPKH, P2TR and regtest P2WPKH
- Remove duplicate function declarations in coinbase_decoder.h
@warioishere warioishere force-pushed the feature/testnet-address-detection branch from 10f6f87 to b4d256a Compare February 25, 2026 08:53
mutatrum added a commit to mutatrum/ESP-Miner that referenced this pull request Mar 3, 2026
…1578)

Author: wario_is_here <mario.hofmann@yourdevice.ch>
@mutatrum
Copy link
Copy Markdown
Collaborator

Can you resolve conflicts?

@warioishere
Copy link
Copy Markdown
Contributor Author

Can you resolve conflicts?

done

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 20, 2026

Test Results

 2 files  ±0   2 suites  ±0   0s ⏱️ ±0s
83 tests +5  83 ✅ +5  0 💤 ±0  0 ❌ ±0 
85 runs  +5  85 ✅ +5  0 💤 ±0  0 ❌ ±0 

Results for commit c9ceb80. ± Comparison against base commit 8568e94.

♻️ This comment has been updated with latest results.

@mutatrum
Copy link
Copy Markdown
Collaborator

Can you remove the whitespace only changes?

@warioishere warioishere force-pushed the feature/testnet-address-detection branch from a8eca56 to bc6d64f Compare April 17, 2026 12:39
Keep both testnet address tests and BIP-110 signaling tests.
@warioishere warioishere force-pushed the feature/testnet-address-detection branch from bc6d64f to c56998b Compare April 17, 2026 12:58
@mutatrum
Copy link
Copy Markdown
Collaborator

Build is failing due to another merge to master. If you update the branch once more, it should be green again. Thanks!

@warioishere
Copy link
Copy Markdown
Contributor Author

done

@0xf0xx0
Copy link
Copy Markdown
Collaborator

0xf0xx0 commented Apr 17, 2026

testing, will merge soon

@0xf0xx0
Copy link
Copy Markdown
Collaborator

0xf0xx0 commented Apr 17, 2026

acked

@0xf0xx0 0xf0xx0 merged commit 8b17785 into bitaxeorg:master Apr 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants