lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.63k stars 2.07k forks source link

[feature]: testnet4 support #8966

Open Impa10r opened 1 month ago

Impa10r commented 1 month ago

Is your feature request related to a problem? Please describe. I'd like to switch my app development to testnet4. LND gives error when I create or unlock a wallet: error creating wallet config: unable to create partial chain control: unknown network with genesis hash 00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043

Describe the solution you'd like LND should start supporting testnet4.

Describe alternatives you've considered testnet3 is nearing EOL and is not compatible with liquidtestnet4

Additional context btcd guys are working on this: https://github.com/btcsuite/btcd/issues/2187

feelancer21 commented 1 month ago

I think we need parallel support for testnet3 and 4. There is currently only a network effect on testnet3. But I can understand if people prefer to start new nodes on testnet4.

Roasbeef commented 1 month ago

See the btcd issue linked there. FWIW, testnet4 hasn't really "officially" launched yet, as it isn't included yet in an final release of any Bitcoin full node daemon (I'm not sure if it'll be in bitcoind 28 as the PR doesn't appear to have any milestone assigned for the 28 release). It also includes new consensus rules that don't exist on mainnet, and will only exist on testnet4, so there may be some extra time tacked on to the end of development to make sure everything is compatible (eg: the BIP doesn't yet have test vectors for these items).

Impa10r commented 1 month ago

Sure, I understand and appreciate all these issues. Testnet is for developing and testing out new things with no risk of funds loss. It does not have to be perfect. One can already build Bitcoin Core from this PR to run with testnet4.

The reason we need LND to support it is because Liquid is nearing release of Elements Core v23.2.2 that will have discounted vSize for confidential transactions. PeerSwap users will greatly benefit from this, but the necessary development requires testnet4/liquidtestnet4.

Roasbeef commented 1 month ago

One can already build Bitcoin Core from https://github.com/bitcoin/bitcoin/pull/29775 to run with testnet4.

Yep, I linked the PR in my comment above. My main point is that: that isn't released yet, so we can't consider any of the params or even the new consensus changes final. It also doesn't appear that it'll be a part of Bitcoind 28, as the feature freeze is in a week or so. If it's a part of Bitcoind 29, then that puts the actual release date sometime in 2025 IIUC.

If you urgently need support, then depending on your available resources, you should be able to put together a temporary branch with the functionality.

Testnet is for developing and testing out new things with no risk of funds loss. It does not have to be perfect.

That btcd issues links to a partial version, but it doesn't have the new consensus rules, so it risks forking off of testnet4.

Assuming the btcd PR is finalized in short order, the soonest it would land in lnd is ~November, as it would be coupled with lnd v0.19.

Impa10r commented 1 month ago

Thanks. Forking and upgrading both lnd and btcd sounds too much work ).

melvincarvalho commented 1 month ago

I've been observing testnet4 for quite some time, and so far it is working very well. Testnet3 which is on block 2.8 million is an interesting experiment but at times unusable. There are also a lack of faucets. I've collected resources on testnet4. I hope it gets merged into 28, but bitcoin devs need something that just works for the next 5+ years or so. I believe testnet4 will be the de-facto way of testing ideas on bitcoin. Would be great if lnd joins the party sooner, rather than later.

https://github.com/testnet4/awesome-testnet4

melvincarvalho commented 1 month ago

There is also an active BIP discussion: https://github.com/bitcoin/bips/pull/1601#issuecomment-2263490441

melvincarvalho commented 1 month ago

BIP-94 (Testnet4) is now merged

https://github.com/bitcoin/bips/blob/master/bip-0094.mediawiki

Impa10r commented 1 month ago

To whom it may concern, I forked LND/btcd/btcwallet with "naive" support for Testnet4. It has no DNS seeds, but I opened a channel to another node and paid an invoice. This is all I need for my purposes. I used lnd master, which shows 0.18.0-beta. Set bitcoin.testnet4=true in lnd.conf.

https://github.com/Impa10r/lnd

melvincarvalho commented 1 month ago

testnet4 is now merged into bitcoin master. It is anticipated that testnet3 will be deprecated and removed in future versions.

https://github.com/bitcoin/bitcoin/pull/29775

Roasbeef commented 1 month ago

I think we'll wait a bit longer for the dust to settle re testnet4 (eg: potential param changes, reexamining difficult adjustment fixes). Until then, testnet3 still works and pretty much every production test environment for Bitcoin infrastructure still uses it.

Testnet4 also isn't very useful for testing LN until there're a few hundred channels active on the new test network.

Roasbeef commented 1 month ago

Not completed, will keep this open to track integration.

MegalithicBTC commented 2 days ago

Just wanted to nudge this. I can see two classes of developers who might have differing perspectives on this issue.

  1. Developers active for 4+ years, who have a big stash of testnet coins, and who might have a lot of existing scripts & code which is built around Testnet3.... and who CAN afford testing with testnet fees that look like this: image

  2. New developers, who currently CAN NOT work on development with LND, due to the impossibility of getting Testnet3 coins.

In our case, we're developing software which uses LND, and we'd like other users and developers to be able to work with it, and although someone graciously sent us some Testnet3 coins to work with, we can't really open our software to other developers and users until they could try it with Testnet4.