0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 04:35:20 PM Last edit: July 12, 2022, 09:40:40 PM by 0xwork Merited by vapourminer (6), LoyceV (6), Welsh (4), o_e_l_e_o (4), NeuroticFish (3), bitmover (2), dkbit98 (2), Pmalek (1), DdmrDdmr (1), DireWolfM14 (1), RickDeckard (1) |
|
i have big problem i start accepting btc in my website . what i do : i get my XPub from my trezor wallet . and from that XPub i start generate btc aaddresses for clients. i do that using this method : https://developpaper.com/generating-bitcoin-wallet-address-from-extended-public-key-using-php/and the code i use in my script to generate btc addresses is this : require_once('./HD.php');
$xpub = 'xpub......'; $path = $client_id.'/0'; $hd = new HD(); $hd->set_xpub($xpub); $address = $hd->address_from_master_pub($path);
where $client_id is number like : and after using this method for hundreds of payments, i open my trezor wallet and i dont find anything , even i see the money on btc explorer . i find my problem is in my code , here: $path = $client_id.'/0'; i use different derivation path for each client. what i try to solve this : i try electrum wallet , i open trezor in electrum like this : Create a new wallet Select Standard wallet select hardware device Choose derivation path m/44'/0'/0' . when its open and see the addresses, its gets first address right ,but the second and third and ... its different than addresses generated from my php script . i try console tab in electrum , to load more addresses : wallet.change_gap_limit ( 2000 ) but that not helping me because the path is different . when i try login to electrum with different path it will give me another XPub i try those paths : m/44'/0'/0' m/44'/0'/1' m/44'/1'/0' m/44'/0'/0'/0' ...
the only one give me right XPub is m/44'/0'/0' now how i can make electrum generate addresses with the same path i use in my php script the REWARD $50 will be in BNB
|
|
|
|
NeuroticFish
Legendary
Offline
Activity: 3878
Merit: 6623
Looking for campaign manager? Contact icopress!
|
|
July 06, 2022, 04:49:40 PM |
|
i open trezor in electrum like this : Create a new wallet Select Standard wallet select hardware device Choose derivation path m/44'/0'/0' .
What happens if you choose derivation paths like m/44'/528'/0' or m/44'/0'/528' ? I think that the funds from customer 528 should be there.
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 05:00:17 PM |
|
i open trezor in electrum like this : Create a new wallet Select Standard wallet select hardware device Choose derivation path m/44'/0'/0' .
What happens if you choose derivation paths like m/44'/528'/0' or m/44'/0'/528' ? I think that the funds from customer 528 should be there. i just try it , and not working electrum gave me different XPub
|
|
|
|
Rickorick
Jr. Member
Offline
Activity: 109
Merit: 8
|
|
July 06, 2022, 05:33:41 PM |
|
use m/44'/0'/client id', try that first and see if you'd get the address.
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 06:04:58 PM |
|
use m/44'/0'/client id', try that first and see if you'd get the address.
same thing electrum gave me different XPub any change to this path electrum will gave me different XPub
|
|
|
|
bitmover
Legendary
Offline
Activity: 2520
Merit: 6372
Wheel of Whales 🐳
|
|
July 06, 2022, 07:07:51 PM |
|
but that not helping me because the path is different . when i try login to electrum with different path it will give me another XPub i try those paths : m/44'/0'/0' m/44'/0'/1' m/44'/1'/0' m/44'/0'/0'/0' ...
You made quite a mess here. The third level of the derivation path is the coin type. (Details here: https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch04.html) For example, m/44/1 is a test network branch Your script should be creating a new account for each user, then it ahould be m/44/0/username the only one give me right XPub is m/44'/0'/0' now how i can make electrum generate addresses with the same path i use in my php script Each time you change the derivation path after the third level you will get a new xpub. This is why electrum is showing a different xpub. You can see it in action here: https://iancoleman.io/bip39/You can change de derivation path and see how the xpub changes. An xpub will derive all public keys in that branch. I think that as you generated an xpub in the top level, it contains all those child ones. You are just getting an xpub of child branches. You have those keys in your xpub. You just need to figure out in which derivation path they are. Can you give us more information about this script you made?
In your next payments, you should definitely use a professional solution like btcpayserver.org They have hardware wallet integration and it is free to use https://docs.btcpayserver.org/HardwareWalletIntegration/
|
|
|
|
jackg
Copper Member
Legendary
Offline
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
|
|
July 06, 2022, 07:14:53 PM |
|
Since m/44'/0'/0' worked and the code you gave above, I think it goes: m/44'/client_id'/0' (either that or m/44'/0'/clientid'/0' -but that may be less likely) How do you know the addresses generated have actually been funded though? I think you need a script thst goes through and checks from an api (such as a block explorer) as to whether an address you control has been funded or not.
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
but that not helping me because the path is different . when i try login to electrum with different path it will give me another XPub i try those paths : m/44'/0'/0' m/44'/0'/1' m/44'/1'/0' m/44'/0'/0'/0' ...
You made quite a mess here. The third level of the derivation path is the coin type. (Details here: https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch04.html) For example, m/44/1 is a test network branch Your script should be creating a new account for each user, then it ahould be m/44/0/username the only one give me right XPub is m/44'/0'/0' now how i can make electrum generate addresses with the same path i use in my php script Each time you change the derivation path after the third level you will get a new xpub. This is why electrum is showing a different xpub. You can see it in action here: https://iancoleman.io/bip39/You can change de derivation path and see how the xpub changes. An xpub will derive all public keys in that branch. I think that as you generated an xpub in the top level, it contains all those child ones. You are just getting an xpub of child branches. You have those keys in your xpub. You just need to figure out in which derivation path they are. Can you give us more information about this script you made?
In your next payments, you should definitely use a professional solution like btcpayserver.org They have hardware wallet integration and it is free to use https://docs.btcpayserver.org/HardwareWalletIntegration/thanks for explaining about the script : i install Bit-Wasp/bitcoin-phpLibrary composer require bitwasp/bitcoin
and i make new file HD.php : link for HD.php : https://gist.githubusercontent.com/mariodian/5b67a1f315a74a7753a6f23d0198ec48/raw/2742a7909dd2621381de53209e85348a078df470/HD.phpOR <?php
require_once('vendor/autoload.php');
use BitWasp\Bitcoin\Bitcoin; use BitWasp\Bitcoin\Address\AddressCreator; use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig; use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig; use BitWasp\Bitcoin\Network\Slip132\BitcoinRegistry; use BitWasp\Bitcoin\Key\Deterministic\Slip132\Slip132; use BitWasp\Bitcoin\Key\KeyToScript\KeyToScriptHelper; use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory; use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence; use BitWasp\Bitcoin\Key\Deterministic\MultisigHD; use BitWasp\Bitcoin\Network\NetworkFactory; use BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\Base58ExtendedKeySerializer; use BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\ExtendedKeySerializer;
class HD { private $network = NULL; private $xpub = NULL; private $ypub = NULL; private $zpub = NULL; private $multisig_xpubs = NULL;
public function __construct($network = 'bitcoin') { if (version_compare(PHP_VERSION, '5.3') >= 0) { $this->network = NetworkFactory::$network(); } elseif (version_compare(PHP_VERSION, '5.2.3') >= 0) { $this->network = call_user_func("NetworkFactory::$network"); } else { $this->network = call_user_func('NetworkFactory', $network); } }
public function set_xpub($xpub) { $this->xpub = $xpub; }
public function set_ypub($ypub) { $this->ypub = $ypub; }
public function set_zpub($zpub) { $this->zpub = $zpub; }
public function set_multisig_xpubs($xpubs) { $this->multisig_xpubs = $xpubs; }
public function address_from_master_pub($path = '0/0') { if ($this->xpub === NULL && $this->ypub === NULL && $this->zpub === NULL) { throw new Exception("XPUB, YPUB or ZPUB key is not present!"); }
$adapter = Bitcoin::getEcAdapter(); $slip132 = new Slip132(new KeyToScriptHelper($adapter)); $bitcoin_prefixes = new BitcoinRegistry();
if ($this->xpub !== NULL) { $pubPrefix = $slip132->p2pkh($bitcoin_prefixes); $pub = $this->xpub; } else if ($this->ypub !== NULL) { $pubPrefix = $slip132->p2shP2wpkh($bitcoin_prefixes); $pub = $this->ypub; } else if ($this->zpub !== NULL) { $pubPrefix = $slip132->p2wpkh($bitcoin_prefixes); $pub = $this->zpub; }
$config = new GlobalPrefixConfig([ new NetworkConfig($this->network, [ $pubPrefix, ]) ]);
$serializer = new Base58ExtendedKeySerializer( new ExtendedKeySerializer($adapter, $config) );
$key = $serializer->parse($this->network, $pub); $child_key = $key->derivePath($path);
return $child_key->getAddress(new AddressCreator())->getAddress(); }
public function multisig_address_from_xpub($m, $path = '0/0') { if (count($this->multisig_xpubs) < 2) { throw new Exception("XPUB keys are not present!"); }
$keys = array();
foreach ($this->multisig_xpubs as $xpub) { $keys[] = HierarchicalKeyFactory::fromExtended($xpub, $this->network); }
$sequences = new HierarchicalKeySequence(); $hd = new MultisigHD($m, 'm', $keys, $sequences, TRUE);
$child_key = $hd->derivePath($path);
return $child_key->getAddress()->getAddress($this->network); } }
after that i include HD.php in my project like this : require_once('./HD.php');
$xpub = 'xpub......'; $path = $client_id.'/0'; $hd = new HD(); $hd->set_xpub($xpub); $address = $hd->address_from_master_pub($path); where $client_id is client id number
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 07:38:08 PM |
|
Since m/44'/0'/0' worked and the code you gave above, I think it goes: m/44'/client_id'/0' (either that or m/44'/0'/clientid'/0' -but that may be less likely) i try m/44'/client_id'/0' and m/44'/0'/clientid'/0' not working How do you know the addresses generated have actually been funded though? . i see the money on btc explorer
|
|
|
|
Cricktor
Legendary
Offline
Activity: 980
Merit: 1619
Crypto Swap Exchange
|
|
July 06, 2022, 08:20:54 PM |
|
Your xpub should be the extended master public key. Why do you believe that your derivation path is formed according to BIP44? Why do you believe that your provided per user path is hardened (like you tried with m/44'/client_id'/0' and m/44'/0'/clientid'/0')? I don't see any clue for that in your code. Is that somewhere implicitly used in the modules of that Bit-Wasp/bitcoin-phpLibrary?
Probably you'd need to dig in the code there further. You will have to find out what full derivation path for a client user address is used.
To narrow it down, print some log line for $pubPrefix, $config and add some log lines for function derivePath(), maybe you can see there how the derivation path is assembled.
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
Your xpub should be the extended master public key. Why do you believe that your derivation path is formed according to BIP44? Why do you believe that your provided per user path is hardened (like you tried with m/44'/client_id'/0' and m/44'/0'/clientid'/0')? I don't see any clue for that in your code. Is that somewhere implicitly used in the modules of that Bit-Wasp/bitcoin-phpLibrary?
Probably you'd need to dig in the code there further. You will have to find out what full derivation path for a client user address is used.
To narrow it down, print some log line for $pubPrefix, $config and add some log lines for function derivePath(), maybe you can see there how the derivation path is assembled.
here is the log when i use 0/0 in my script : $config : BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig Object ( [networkConfigs:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig:private] => Array ( [BitWasp\Bitcoin\Network\Networks\Bitcoin] => BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig Object ( [network:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig:private] => BitWasp\Bitcoin\Network\Networks\Bitcoin Object ( [base58PrefixMap:protected] => Array ( [p2pkh] => 00 [p2sh] => 05 [wif] => 80 )
[bech32PrefixMap:protected] => Array ( [segwit] => bc )
[bip32PrefixMap:protected] => Array ( [xpub] => 0488b21e [xprv] => 0488ade4 )
[bip32ScriptTypeMap:protected] => Array ( [xpub] => pubkeyhash [xprv] => pubkeyhash )
[signedMessagePrefix:protected] => Bitcoin Signed Message [p2pMagic:protected] => d9b4bef9 )
[scriptPrefixMap:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig:private] => Array ( [0488ade4] => BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix Object ( [privatePrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488ade4 [publicPrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488b21e [scriptDataFactory:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory Object ( [pubKeySerializer:protected] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer Object ( [ecAdapter:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
)
)
)
[0488b21e] => BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix Object ( [privatePrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488ade4 [publicPrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488b21e [scriptDataFactory:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory Object ( [pubKeySerializer:protected] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer Object ( [ecAdapter:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
)
)
)
)
[scriptTypeMap:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig:private] => Array ( [pubkeyhash] => BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix Object ( [privatePrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488ade4 [publicPrefix:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => 0488b21e [scriptDataFactory:BitWasp\Bitcoin\Key\Deterministic\HdPrefix\ScriptPrefix:private] => BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory Object ( [pubKeySerializer:protected] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer Object ( [ecAdapter:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
)
)
)
)
)
)
)
derivePath() /$child_key : BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey Object ( [ecAdapter:protected] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
[depth:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => 5 [parentFingerprint:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => 723835999 [sequence:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => 0 [chainCode:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => BitWasp\Buffertools\Buffer Object ( [size] => 32 [buffer] => 0xfb02983db7403c801564ac0282bec2be39722325968b530fc3505898e3b346da )
[key:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey Object ( [ecAdapter:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
[point:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey:private] => Mdanter\Ecc\Primitives\Point Object ( [x] => 109756113754416006883068144059295232931743649784206556207715924624422608984554 [y] => 30336686192482416354579004682961920948817072959615255523669782145222377339335 [z] => 0 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
[prefix:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey:private] => [compressed:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey:private] => 1 [pubKeyHash:protected] => )
[scriptDataFactory:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory Object ( [pubKeySerializer:protected] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer Object ( [ecAdapter:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Serializer\Key\PublicKeySerializer:private] => BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter Object ( [math:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => BitWasp\Bitcoin\Math\Math Object ( )
[generator:BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter:private] => Mdanter\Ecc\Primitives\GeneratorPoint Object ( [x] => 55066263022277343669578718895168534326250603453777594175500187360389116729240 [y] => 32670510020758816978083085130507043184471273380659243275938904335757337482424 [z] => 115792089237316195423570985008687907852837564279074904382605163141518161494337 [curve] => Mdanter\Ecc\Curves\NamedCurveFp Object ( [a] => 0 [b] => 7 [prime] => 115792089237316195423570985008687907853269984665640564039457584007908834671663 )
)
)
)
)
[scriptAndSignData:BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey:private] => )
|
|
|
|
Rickorick
Jr. Member
Offline
Activity: 109
Merit: 8
|
|
July 06, 2022, 10:39:52 PM |
|
t The screenshot makes it easier then, you can do this; 1. Go to electrum, in the derivation path, tick legacy and put m/clientid (m/489) underneath or 2. Use iancoleman.io/bip39 listed above(beware, using this may compromise your seed) put the seed in the mnemonic box and change the derivation path to bip32, select custom path and put m/client id (m/489).
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 10:53:18 PM |
|
t The screenshot makes it easier then, you can do this; 1. Go to electrum, in the derivation path, tick legacy and put m/clientid (m/489) underneath or 2. Use iancoleman.io/bip39 listed above(beware, using this may compromise your seed) put the seed in the mnemonic box and change the derivation path to bip32, select custom path and put m/client id (m/489). i try it , gave me different addresses and no btc
|
|
|
|
Rickorick
Jr. Member
Offline
Activity: 109
Merit: 8
|
|
July 06, 2022, 11:09:31 PM |
|
It seems like Electrum is treating each 'client id' as a change path. Your best bet may be to use the seed to manually recover the coins using iancoleman.
|
|
|
|
0xwork (OP)
Copper Member
Newbie
Offline
Activity: 12
Merit: 51
|
|
July 06, 2022, 11:18:43 PM |
|
It seems like Electrum is treating each 'client id' as a change path. Your best bet may be to use the seed to manually recover the coins using iancoleman.
thanx is iancoleman safe ? Does iancoleman have offline copy ?
|
|
|
|
Rickorick
Jr. Member
Offline
Activity: 109
Merit: 8
|
|
July 06, 2022, 11:51:21 PM |
|
Yes, you can use it offline..
|
|
|
|
bitmover
Legendary
Offline
Activity: 2520
Merit: 6372
Wheel of Whales 🐳
|
|
July 06, 2022, 11:59:51 PM |
|
Since m/44'/0'/0' worked and the code you gave above, I think it goes: m/44'/client_id'/0' (either that or m/44'/0'/clientid'/0' -but that may be less likely)
How do you know the addresses generated have actually been funded though? I think you need a script thst goes through and checks from an api (such as a block explorer) as to whether an address you control has been funded or not.
The problem is that m/44/2 is litecoin The third level will go to different altcoins. I don't know how to handle that (an altcoin path) in a bitcoin wallet. Just take a look at iancoleman and you will see. is iancoleman safe ? Does iancoleman have offline copy ?
Yes You can download it and run offline. It is safe.
|
|
|
|
jackg
Copper Member
Legendary
Offline
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
|
|
July 07, 2022, 12:08:01 AM |
|
Since m/44'/0'/0' worked and the code you gave above, I think it goes: m/44'/client_id'/0' (either that or m/44'/0'/clientid'/0' -but that may be less likely)
How do you know the addresses generated have actually been funded though? I think you need a script thst goes through and checks from an api (such as a block explorer) as to whether an address you control has been funded or not.
The problem is that m/44/2 is litecoin The third level will go to different altcoins. I don't know how to handle that (an altcoin path) in a bitcoin wallet. Just take a look at iancoleman and you will see. It's just replay protection and there are tools to convert litecoin public keys to bitcoin ones and vice versa (they just add an offset to the public key to make it different - the private key will be the same).
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3528
Merit: 17820
Thick-Skinned Gang Leader and Golden Feather 2021
|
When using https://iancoleman.io/bip39/ with the seed words from your hardware wallet, taking your computer offline is not enough: it should never go online again! Get a Linux LIVE DVD, boot from it, don't give it internet access, close the curtains, copy IanColeman's site on a USB stick, don't give it access to any hard drives, run from RAM only, and play around with it until you have the private keys you need. Then turn off the PC and wipe it's memory.
|
| | Peach BTC bitcoin | │ | Buy and Sell Bitcoin P2P | │ | . .
▄▄███████▄▄ ▄██████████████▄ ▄███████████████████▄ ▄█████████████████████▄ ▄███████████████████████▄ █████████████████████████ █████████████████████████ █████████████████████████ ▀███████████████████████▀ ▀█████████████████████▀ ▀███████████████████▀ ▀███████████████▀ ▀▀███████▀▀
▀▀▀▀███████▀▀▀▀ | | EUROPE | AFRICA LATIN AMERICA | | | ▄▀▀▀ █ █ █ █ █ █ █ █ █ █ █ ▀▄▄▄ |
███████▄█ ███████▀ ██▄▄▄▄▄░▄▄▄▄▄ █████████████▀ ▐███████████▌ ▐███████████▌ █████████████▄ ██████████████ ███▀███▀▀███▀ | . Download on the App Store | ▀▀▀▄ █ █ █ █ █ █ █ █ █ █ █ ▄▄▄▀ | ▄▀▀▀ █ █ █ █ █ █ █ █ █ █ █ ▀▄▄▄ |
▄██▄ ██████▄ █████████▄ ████████████▄ ███████████████ ████████████▀ █████████▀ ██████▀ ▀██▀ | . GET IT ON Google Play | ▀▀▀▄ █ █ █ █ █ █ █ █ █ █ █ ▄▄▄▀ |
|
|
|
witcher_sense
Legendary
Offline
Activity: 2464
Merit: 4418
🔐BitcoinMessage.Tools🔑
|
BIP44 derivation path has five levels: m / purpose' / coin_type' / account' / change / address_indexIn your case the derivation path is the following: m / 44' / 0' / 0' / $client_id.' / 0or m / 44' / 0' / 0' / $client_id.' / 0'But it should be this: m / 44' / 0' / $client_id.' / 0 / 0 for receive addresses m / 44' / 0' / $client_id.' / 1 / 0 for change addresses The code you have presented in the OP is not suitable for changing an "account" part of the BIP44 derivation path, it only generates receive and change addresses (albeit with non-standard derivation paths) for one account. Try changing it to something like this, but I am not sure it will work out: require_once('./HD.php');
$xpub = 'xpub......'; $path = '$client_id.'/0/0'; $hd = new HD(); $hd->set_xpub($xpub); $address = $hd->address_from_master_pub($path);
Also try the following paths to find your coins: m / 44' / 0' / 0' / 526' / 0m / 44' / 0' / 0' / 527' / 0m / 44' / 0' / 0' / 528' / 0m / 44' / 0' / 0' / 526' / 0'm / 44' / 0' / 0' / 527' / 0'm / 44' / 0' / 0' / 528' / 0'These are all non-standard derivation paths since you used hardened derivation on "change" and "address_index" levels, whereas they should be non-hardened (without ').
I guess I found the error (pay attention to quotation marks): <?php require_once('./HD.php');
$xpub = 'xpub661MyMwAqRbcGYcu6n1FmV1TbE8EwnSKecRZLvKAMyj4qLf15qXsoNryiKNvCkRq3z5kBCeZG81 15jj28eVqmeKBJZPqjAfwRD3TGx1w5hY'; $path = '0/0'; // 1st receiving address // $path = '0/2'; // 3rd receiving address // $path = '1/0'; // 1st change address // $path = '1/1'; // 2nd change address
$hd = new HD(); $hd->set_xpub($xpub); $address = $hd->address_from_master_pub($path);
echo $address;
Your code: require_once('./HD.php');
$xpub = 'xpub......'; $path = $client_id.'/0'; $hd = new HD(); $hd->set_xpub($xpub); $address = $hd->address_from_master_pub($path);
|
|
|
|
|