Blockchain & network enumeration #149
dr-orlovsky
started this conversation in
Proposals
Replies: 2 comments 1 reply
-
@crisdut can you confirm that different regtests has different block ids |
Beta Was this translation helpful? Give feedback.
1 reply
-
The proposal looks good to me, ACK |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In many applications we face the need to specify a network and/or a chains (one of testnet, mainnet, sidechains etc) for which some piece of information applies. This is related to invoices, consignments, addresses, node connections, and so on.
Some time ago a dedicated library for addressing the issue was created:
lnpbp_chain
. However, it used a sub-optimal approach not taking many factors into a consideration, and its serialization format was too verbose to be used in invoices.This is a proposal for a new, short, easy-to-read and to use in different forms of text and binary representation identification for both chain and network information.
Considerations which should be kept in mind:
To address all this issue we at LNP/BP Standards Association may provide a registry of chains and corresponding networks, where items are identified by an either short string (for text encodings) or a u32 number (for binary encodings), which can be resolved via simple library (a new version of
lnpbp_chain
) to all necessary information."bitcoin"
,0x00000000
0xD9B4BEF9
bc
1
,3
"testnet3"
,0x80000002
0x0709110B
tb
m
,n
"signet"
,0x80000003
0x40CF030A
tb
m
,n
"regtest<ID>"
20xDAB5BFFA
bcrt
m
,n
"signet<ID>"
20x40CF030A
tb
m
,n
"liquidv1"
,0x70000000
"liquidt1"
,0xC0000000
If some composed data contain items each of which provide some form of chain/network information, including this standard, boolean (indicating testnet), or one of other identifiers (address HRP in Bech32(m), address first byte in Base58 address format etc) a parser must fail on each and every inconsistency between those identifiers according to the registry defined in this standard.
When a chain identifier is absent, a software must use identifier given as a part of the related data. If none of the data contains any chain identifier, a bitcoin mainnet must be assumed.
Footnotes
Magic number is sent over network in little-endian encoding, meaning that 32-bit magic
0xD9B4BEF9
is represented by a byte sequence of[0xF9, 0xBE, 0xB4, 0xD9]
. ↩Regtest and permissioned signet setup uses:
u32
integer, masks with0x7FFFFFFF
and xors with testnet flag0x80000000
."regtest"
(or"signet"
) string, for example getting"regtest8cafe79a"
.Beta Was this translation helpful? Give feedback.
All reactions