Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testnet version 4 for bitcoin #14951

Closed
hynek-jina opened this issue Oct 18, 2024 · 15 comments · Fixed by #16426
Closed

Add testnet version 4 for bitcoin #14951

hynek-jina opened this issue Oct 18, 2024 · 15 comments · Fixed by #16426
Assignees
Labels
bitcoin Bitcoin related

Comments

@hynek-jina
Copy link
Contributor

Bitcoin testnet v3 is kind of broken.
BIP-0094 proposes improved version which was already released with Bitcoin Core 28.0

Backends are ready:

I recommend to keep current testnet in place and rename it to Testnet 3.

@hynek-jina hynek-jina added the bitcoin Bitcoin related label Oct 18, 2024
@github-project-automation github-project-automation bot moved this to 🎯 To do in Suite Desktop Oct 18, 2024
@peter-sanderson peter-sanderson self-assigned this Nov 11, 2024
@karliatto
Copy link
Member

If we want to support testnet4 we need to add it to the firmware at least in https://github.com/trezor/trezor-firmware/tree/main/common/defs/bitcoin
Right @matejcik ?

@matejcik
Copy link

what would be the difference from current testnet.json ?

@karliatto
Copy link
Member

what would be the difference from current testnet.json ?

At least the name that should be "Testnet 4" and coin shortcut something like "TEST4" and the "hash_genesis_block".
And not sure if it would make sense to rename current testnet to "Testnet 3" for clarity.
Something like below?

https://github.com/trezor/trezor-firmware/compare/main...karliatto:trezor-firmware:feat/add-bitcoin-testnet4?expand=1

@matejcik
Copy link

i would really like to see the diff against testnet.json.
if it's just the genesis block that is different, we don't care about that in firmware. (we may even remove it unless Connect depends on it?)
re the ticker symbol, will users care whether they're transacting TEST3 or TEST4?

@karliatto
Copy link
Member

re the ticker symbol, will users care whether they're transacting TEST3 or TEST4?

Well, that is a good question, maybe we can just change the name of the account and then the coin symbol would be TEST for both. Until eventually when we get rid of Testnet 3.

@karliatto
Copy link
Member

After investigating and experimenting with it, it would be kind of too complicated/hacky at the suite/connect level to add this testnet 4 and keep testnet 3 without adding new coin to device.

While changing from testnet 3 to testnet 4 is very simple. What about to getting rid of testnet 3?

@prusnak
Copy link
Member

prusnak commented Jan 10, 2025

After investigating and experimenting with it, it would be kind of too complicated/hacky at the suite/connect level to add this testnet 4 and keep testnet 3 without adding new coin to device.

@matejcik says that nothing changes for the device really and he's right (modulo the coin ticker if we decide to discriminate between TEST3 and TEST4).

What about to getting rid of testnet 3?

I think we could do this and offer people who want Testnet 3 support to use older version of the Suite. Like I said, firmware does not care whether it is signing Testnet 3 or Testnet 4 transactions AFAIK.

@karliatto
Copy link
Member

@matejcik says that nothing changes for the device really and he's right (modulo the coin ticker if we decide to discriminate between TEST3 and TEST4).

If we decide to discriminate TEST3 and TEST4 in device that will allow us to support both testnets in suite.

I think we could do this and offer people who want Testnet 3 support to use older version of the Suite. Like I said, firmware does not care whether it is signing Testnet 3 or Testnet 4 transactions AFAIK.

It is even easier if user will want to use Testnet 3 they will just have to change the blockbook URL in suite to use Custom Blockbook with URL: https://tbtc1.trezor.io and they get Testnet 3.

The plan would be to write an article about it and add a banner that will be displayed to users that have Testnet coin enable in Suite so they are not surprise that suddenly after updating they have 0 balance in testnet.

@prusnak
Copy link
Member

prusnak commented Jan 10, 2025

It is even easier if user will want to use Testnet 3 they will just have to change the blockbook URL in suite to use Custom Blockbook with URL: https://tbtc1.trezor.io and they get Testnet 3.

Not if you merge trezor/trezor-firmware#4486 - the hash_genesis_block of testnet 3 would be unknown.

@karliatto
Copy link
Member

Not if you merge trezor/trezor-firmware#4486 - the hash_genesis_block of testnet 3 would be unknown.

Right now, I can receive and send Testnet 4 in Trezor Suite by just changing the blockbook URL to be https://tbtc4-1.trezor.io. So I assume the same will be possible once we change the default to be Testnet 4 blockbook server.

Is hash_genesis_block used when generating address or signing transactions?

@karliatto
Copy link
Member

Ok, let's clarify, since I have conversations related to this in different places.

  • Right now we have "testnet" coin that works for what we call "testnet3", but in suite/connect/firmware we call it just "testnet"

I see 2 ways of adding support of Testnet 4

  1. We do not modify anything in device and only change blockbook default URL, but the coin symbol will still be "testnet" since nothing else is necessary. So connect or device does not care about it. Only suite will display different balance. That user should be able to change by just changing the blockbook URL in suite configuration.
  2. We add new coin to device. We can keep "testnet" for Testnet 3 so it is backward compatible and we do not have issues with 2nd parties and add new coin testnet4 that will be for Testnet 4. This option will allow us to have both testnets in Suite, display both balance at the same time.

Other good thing about option 2 is that is more specific and clear in naming.

@prusnak
Copy link
Member

prusnak commented Jan 10, 2025

Right now, I can receive and send Testnet 4 in Trezor Suite by just changing the blockbook URL to be https://tbtc4-1.trezor.io.

Well, that is weird. How does Suite know which coin is provided by the backend? (Let's say it's a Bitcoin backend and not Dogecoin)? In the past we were doing detection by hash_genesis_block. If this is not used anymore and there is some other mechanism in place, then we can drop the field completely.

Edit: I think I understand now. In the past we had a feature which allowed you to add custom backend (let's say trololo.example.com) and the autodetection happened like I described (so the Suite knew that trololo.example.com was serving Dogecoin by looking at the hash of the genesis block). I guess the new Suite does not allow this at all and what you were describing was just changing the backend and not adding a custom one.

@hynek-jina
Copy link
Contributor Author

I'm afraid that overriding Testnet3 with Testnet4 would bring us issues... and therefore I would prefer to add another testnet on top of existing one and later remove the old one.

Btw. I think we should unify the testnet labeling across FW, Connect, and Suite. And also between networks. 🫣
For that I like @Hannsek 's suggestion to use the format testXXX everywhere. So for example, testBTC, testETH, or testADA, since tXXX could be confused with some tokens and so on..

In Suite, we could still distinguish between Testnet 3 and Testnet 4, but both would use the unified testBTC symbol.
For sats, it could probably be testSat.

@github-project-automation github-project-automation bot moved this from 🎯 To do to 🤝 Needs QA in Suite Desktop Jan 31, 2025
@bosomt
Copy link
Contributor

bosomt commented Feb 3, 2025

Sent follow up issue here #16758

@bosomt
Copy link
Contributor

bosomt commented Feb 3, 2025

QA OK

  • discovery
  • send receive
  • add account
  • tx detail
  • tx explorer
  • labeling

Info:

  • Suite version: web 25.2.0 (e948e70)
  • Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
  • OS: MacIntel
  • Screen: 1470x956
  • Device: Trezor T3T1 2.8.8 regular (revision bbcb920213b0ab847a2fedf825eac70652e33279)
  • Transport: WebUsbTransport

@bosomt bosomt moved this from 🤝 Needs QA to ✅ Approved in Suite Desktop Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bitcoin Bitcoin related
Projects
Status: ✅ Approved
Development

Successfully merging a pull request may close this issue.

6 participants