bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.6k stars 2.08k forks source link

Question: Bitcoinjs-lib will support Testnet4? #2100

Closed 22388o closed 1 month ago

22388o commented 1 month ago

Currently, Testnet3 suffered some issues and I would like to know, if this library will support this new testnet.

junderw commented 1 month ago

This library is mostly just serialization. AFAICT Testnet4 will use the same version bytes for various things.

If there's anything off with the current testnet values, let me know.

https://github.com/bitcoinjs/bitcoinjs-lib/blob/eb1250468a328f483f034015483fc66c7db70fbe/ts_src/networks.ts#L75-L88

22388o commented 1 month ago

Oh, ok. Thanks @junderw

22388o commented 1 month ago

If there's anything off with the current testnet values, let me know.

I'll check current value in the testnet4 :)

Anyway. thank you so much @junderw

22388o commented 1 month ago

@junderw is compatible with testnet3 support

https://github.com/bitcoin/bips/blob/92ca582b6bc88423ec9e024f08885a326f5b9a3c/bip-testnet4.mediawiki#compatibility

Simply by adding the network parameters for Testnet 4 (magic number, etc), a client can connect to and use Testnet 4 without further modifications. The block headers have valid proof of work, so clients can trivially check that blocks are "probably" valid.

However, without the implementation of the changes detailed in Specifications, a client could follow a chain that does not follow the rules. Any fully validating node should check these rules and reject blocks that fail to follow them. Clients should either validate these rules or connect to trusted peers that do full validation.