Bitcoin Forum
December 13, 2024, 01:50:03 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Running testnet  (Read 259 times)
Maus0728 (OP)
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 24, 2020, 12:21:17 PM
Merited by OmegaStarScream (2), ABCbits (1), Husna QA (1), joniboini (1), o_e_l_e_o (1)
 #1

I just finished integrating my Electrum and Ledger Nano S with a native segwit (p2wpkh) script type and a derivation path of m/84'/0'/0' created using Electrum. I also managed to mirror the same script type in Ledger Live considering the fact that the Ledger Live also follows the same derivation path.

Problem is, I am worried that If I am going to use Electrum Testnet with the Ledger Nano connected and the bitcoin app open, the testnet requires me to select another script type which gives me another derivation of m/84'/1'/0'. Will it affect the other bitcoin account that was created before since the derivation path has change?

P.S. I chose native segwit (p2wpkh) for testnet and I cancel the creation of the testnet account.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 24, 2020, 01:43:06 PM
Merited by ABCbits (1)
 #2

No, it won't affect your other account, and that derivation path suggested is exactly as expected.

In the derivation path, the second number (the one which has changed from a 0 to a 1 in the paths you've given) refers to "coin_type". 0 is for bitcoin mainnet, and 1 is for bitcoin testnet. You can read about this here: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. m/84'/1'/0' is the standard derivation path for P2WPKH testnet addresses.

Going forward, you can create as many different wallets in Electrum using as many different derivation paths as you like, all from the same seed on the same hardware wallet, and each account remains completely separate from the others. The only thing to be aware of is to remember which derivation paths you have used if you have used anything other than the default ones, as there have been instances of people losing their coins because they can't remember which derivation path they are stored under.
Maus0728 (OP)
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 25, 2020, 03:09:50 AM
Last edit: May 25, 2020, 03:20:53 AM by Maus0728
 #3

In the derivation path, the second number (the one which has changed from a 0 to a 1 in the paths you've given) refers to "coin_type". 0 is for bitcoin mainnet, and 1 is for bitcoin testnet. You can read about this here: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. m/84'/1'/0' is the standard derivation path for P2WPKH testnet addresses.
Wow! So even If I created the testnet account, I can also easily mirror the testnet account in the Ledger Live similar to what I've done in mainnet by installing and creating an account in BTC testnet in Ledger Live which is optional if I want to see the balance of tBTC  Shocked.

Going forward, you can create as many different wallets in Electrum using as many different derivation paths as you like, all from the same seed on the same hardware wallet, and each account remains completely separate from the others. The only thing to be aware of is to remember which derivation paths you have used if you have used anything other than the default ones, as there have been instances of people losing their coins because they can't remember which derivation path they are stored under.
@o_e_l_e_o I have one problem.

I am using a custodial wallet named as coins.ph which is mainly used in our country. The problem is, coins.ph does support Bech32 script type that is why I am unable to send my funds in Electrum.

Is it possible to create another type of address in Electrum p2sh script type to be specific which I think is another derivation path. If not, I am planning to send my funds from coins.ph to my existing Mycelium account before and then transfer it Electrum. What do you think is more practical and appropriate?

This is harder than I thought and I think I have a lot to learn. Anyways, thank you for always helping to my queries. I am now connecting the dots  Cheesy
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 25, 2020, 05:30:43 AM
 #4

Wow! So even If I created the testnet account, I can also easily mirror the testnet account in the Ledger Live similar to what I've done in mainnet by installing and creating an account in BTC testnet in Ledger Live which is optional if I want to see the balance of tBTC  Shocked.
Correct. In Ledger Live go to Settings -> Experimental features, and turn on Developer Tools to be able to use bitcoin testnet within LL.

Is it possible to create another type of address in Electrum p2sh script type to be specific which I think is another derivation path.
Absolutely. You can use your hardware wallet to create any type of address you like in Electrum, again all from the same seed. Plug in your hardware wallet and open Electrum, but instead of opening your bech32 wallet which you've already created, choose to create a new standard wallet using your hardware wallet. You will reach a screen which asks you which script type/derivation path you want. Choose "p2sh-segwit" which will automatically change the derivation path to m/49'/0'/0'. You can send all your coins to the resulting "3" addresses, and either immediately send them from there to your "bc1" addresses, or just continue to use the "3" addresses if you are going to have issues with bech32 compatibility in the future.
Maus0728 (OP)
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 25, 2020, 05:39:36 AM
Merited by o_e_l_e_o (1)
 #5

Great! I am now confident to what I am doing. Thank you for guiding me by the way! Wink

Reading again the Mastering Bitcoin book and I am now at the part of the derivation path and the Elliptic Curve Multiplication.
Maus0728 (OP)
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 26, 2020, 09:17:25 AM
 #6

I think I've done it correctly. After HCP gave his tBTC to the 3 separate  tBTC addresses I gave, I immediately run the Electrum testnet and I think I've done coin control and pay to many correctly. I configured the settings to "Show Coins" and "Show Addresses" to be able to choose which UTXO in the coins I can spend from. I also indicated the change address in the "Pay to" field to get the remaining balance from my input. However, after signing the transaction, the ledger nano notifies me about the derivation path if m/84'/1'/0'/1' is correct but still I verified the derivation path and the transaction was successfully broadcasted in the bitcoin testnet.





o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 26, 2020, 11:59:15 AM
 #7

All looks good. A couple of comments:

Addresses highlighted in green are your own "main" addresses, and those highlighted in yellow are your change addresses.

You don't actually need to specify a change addresses unless you want the change to go to a specific address - Electrum will automatically send the change to your next unused change address.

The fourth number in the derivation path refers to "change". It will be 0 for main addresses and 1 for change addresses. This usually isn't hardened though, so the derivation path should be m/84'/1'/0'/1 rather than m/84'/1'/0'/1'.

When using pay to many, if instead of entering a value next to one of the addresses you enter an exclamation point, it will send all remaining funds to that address.
Maus0728 (OP)
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 27, 2020, 03:39:23 AM
 #8

You don't actually need to specify a change addresses unless you want the change to go to a specific address - Electrum will automatically send the change to your next unused change address.
I thought that it should be manually indicated by the user that is why I tried to experiment to one of my unused addresses  Cheesy. If I am not mistaken, should I tick the box in the settings? Tool => Preferences => Transaction => Use Change Address

The fourth number in the derivation path refers to "change". It will be 0 for main addresses and 1 for change addresses. This usually isn't hardened though, so the derivation path should be m/84'/1'/0'/1 rather than m/84'/1'/0'/1'.
Yes! That's the correct one, it is too little to recognize the hardened symbol at first glance. I just noticed that the " ' " is only present at the first three level of the derivation path. Why is that? Is it some sort of security feature why it is named "hardened" because they cannot be customize by the user?

When using pay to many, if instead of entering a value next to one of the addresses you enter an exclamation point, it will send all remaining funds to that address.
Yes! I used this "!" symbol to send all the remaining funds to my change address. I used this as a reference.
[1] https://bitcoinelectrum.com/how-to-spend-specific-utxos-in-electrum/
ranochigo
Legendary
*
Offline Offline

Activity: 3052
Merit: 4443


Crypto Swap Exchange


View Profile
May 27, 2020, 04:25:18 AM
 #9

I thought that it should be manually indicated by the user that is why I tried to experiment to one of my unused addresses  Cheesy. If I am not mistaken, should I tick the box in the settings? Tool => Preferences => Transaction => Use Change Address
That option will result in Electrum sending the funds to a change address generated by the wallet. If the option is not selected, whatever is left after the fees are deducted is sent to the origin address. Ie. If the box is not checked, an A -> B transaction will result in the change being sent back to address A.

Yes! That's the correct one, it is too little to recognize the hardened symbol at first glance. I just noticed that the " ' " is only present at the first three level of the derivation path. Why is that? Is it some sort of security feature why it is named "hardened" because they cannot be customize by the user?
BIP32 has an intrinsic flaw which allows the full master private key to be compromised once the master public key and any of the child private key is revealed. It doesn't have to be hardened down to the last path so you can still generate non-hardened addresses using an extended public key. If you were to harden the path the whole way, the only way to generate a hardened address is to use the private key.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
May 27, 2020, 04:37:00 AM
Merited by ABCbits (1), o_e_l_e_o (1)
 #10

BIP32 has an intrinsic flaw which allows the full master private key to be compromised once the master public key and any of the child private key is revealed. It doesn't have to be hardened down to the last path so you can still generate non-hardened addresses using an extended public key. If you were to harden the path the whole way, the only way to generate a hardened address is to use the private key.

it is not a flaw, it is a feature. maybe it could have been referred to as a flaw in its very first draft release when it didn't have the hardened key feature in it but not when it exited the draft mode and was final with the hardened keys.
this feature can actually be useful in many cases. like a watch only wallet that needs to only use the master public key but create more than one set of derived child keys (like having 2 "accounts") in which case it needs the extended public key to be non-hardened so that it can derive two child extended public keys and derive each child public key from those nodes.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 27, 2020, 02:34:56 PM
 #11

this feature can actually be useful in many cases.
Exactly. This feature is pretty integral to how most bitcoin sites and services work. If you want to be able to generate a list of receiving addresses, without putting your private key online, then you cannot use hardened address indices. Every exchange which generates a different deposit address for different users, every merchant which generates a different payment address for different customers, every mixing service, every casino, every sportsbook, etc., all rely on being able to upload an extended public key to their server, generate as many non-hardened addresses as they need, and keep their private keys securely stored offline.

If we didn't use hardened addresses at the last two levels, then the only way these services could generate additional addresses would be by uploading and using their extended private key (rather than extended public key), which is obviously a huge security risk.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!