Bitcoin Forum
April 26, 2024, 01:57:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: REWARD $200: Funds not visible after using XPub to receive money in my store  (Read 418 times)
0xwork (OP)
Copper Member
Newbie
*
Offline Offline

Activity: 12
Merit: 51


View Profile
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)
 #1

i have big problem   Sad

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 :

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);


 where $client_id is number  like :

Code:
526
527
528
....



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 :

Code:
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 :
Code:
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

Code:

527/0
528/0
.
.



the REWARD $50 will be in BNB  
 
1714139860
Hero Member
*
Offline Offline

Posts: 1714139860

View Profile Personal Message (Offline)

Ignore
1714139860
Reply with quote  #2

1714139860
Report to moderator
1714139860
Hero Member
*
Offline Offline

Posts: 1714139860

View Profile Personal Message (Offline)

Ignore
1714139860
Reply with quote  #2

1714139860
Report to moderator
1714139860
Hero Member
*
Offline Offline

Posts: 1714139860

View Profile Personal Message (Offline)

Ignore
1714139860
Reply with quote  #2

1714139860
Report to moderator
You get merit points when someone likes your post enough to give you some. And for every 2 merit points you receive, you can send 1 merit point to someone else!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
NeuroticFish
Legendary
*
Offline Offline

Activity: 3654
Merit: 6365


Looking for campaign manager? Contact icopress!


View Profile
July 06, 2022, 04:49:40 PM
 #2

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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
0xwork (OP)
Copper Member
Newbie
*
Offline Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 05:00:17 PM
 #3

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 Offline

Activity: 107
Merit: 8


View Profile
July 06, 2022, 05:33:41 PM
 #4

use m/44'/0'/client id', try that first and see if you'd get the address.
0xwork (OP)
Copper Member
Newbie
*
Offline Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 06:04:58 PM
 #5

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 

Code:
m/44'/0'/0'

electrum   will gave me different XPub
bitmover
Legendary
*
Offline Offline

Activity: 2282
Merit: 5887


bitcoindata.science


View Profile WWW
July 06, 2022, 07:07:51 PM
 #6


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 :
Code:
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


Quote
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

Code:

527/0
528/0
.
.


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/

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
July 06, 2022, 07:14:53 PM
 #7

Code:
$path = $client_id.'/0'; 

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 Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 07:24:14 PM
Merited by vapourminer (2)
 #8


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 :
Code:
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


Quote
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

Code:

527/0
528/0
.
.


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
Code:
composer require bitwasp/bitcoin 


and i make new file HD.php :
link for HD.php :
https://gist.githubusercontent.com/mariodian/5b67a1f315a74a7753a6f23d0198ec48/raw/2742a7909dd2621381de53209e85348a078df470/HD.php
OR

Code:
<?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$sequencesTRUE);

    
$child_key $hd->derivePath($path);

    return 
$child_key->getAddress()->getAddress($this->network);
  }
}


after that i include HD.php in my project like this :

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);

where $client_id is client id  number


0xwork (OP)
Copper Member
Newbie
*
Offline Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 07:38:08 PM
 #9

Code:
$path = $client_id.'/0'; 

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

 
Code:
How do you know the addresses generated have actually been funded though? .
i see the money on btc explorer
Cricktor
Hero Member
*****
Offline Offline

Activity: 742
Merit: 1072


Crypto Swap Exchange


View Profile
July 06, 2022, 08:20:54 PM
 #10

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.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
0xwork (OP)
Copper Member
Newbie
*
Offline Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 10:14:53 PM
Merited by vapourminer (2)
 #11

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 :

Code:
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 :

Code:
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 Offline

Activity: 107
Merit: 8


View Profile
July 06, 2022, 10:39:52 PM
Merited by bitmover (2)
 #12

i try to search  here :
https://blockpath.com/wallets/local/101?action=appxpub


i find my btc :






now how i can make electrum  generate the same path ?


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 Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 10:53:18 PM
 #13

i try to search  here :
https://blockpath.com/wallets/local/101?action=appxpub


i find my btc :






now how i can make electrum  generate the same path ?


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 Offline

Activity: 107
Merit: 8


View Profile
July 06, 2022, 11:09:31 PM
 #14

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 Offline

Activity: 12
Merit: 51


View Profile
July 06, 2022, 11:18:43 PM
 #15

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 Offline

Activity: 107
Merit: 8


View Profile
July 06, 2022, 11:51:21 PM
 #16

Yes, you can use it offline..
bitmover
Legendary
*
Offline Offline

Activity: 2282
Merit: 5887


bitcoindata.science


View Profile WWW
July 06, 2022, 11:59:51 PM
 #17

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
July 07, 2022, 12:08:01 AM
Merited by bitmover (2)
 #18

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
*
Online Online

Activity: 3290
Merit: 16553


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
July 07, 2022, 05:11:46 AM
Merited by bitmover (2), vapourminer (1)
 #19

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.

█▀▀▀











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











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

Activity: 2310
Merit: 4313

🔐BitcoinMessage.Tools🔑


View Profile WWW
July 07, 2022, 06:19:05 AM
Last edit: July 07, 2022, 07:01:37 AM by witcher_sense
Merited by vapourminer (6), LoyceV (4), o_e_l_e_o (4), Pmalek (1)
 #20

BIP44 derivation path has five levels:

m / purpose' / coin_type' / account' / change / address_index

In your case the derivation path is the following:

m / 44' / 0' / 0' / $client_id.' / 0

or

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:

Code:
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' / 0
m / 44' / 0' / 0' / 527' / 0
m / 44' / 0' / 0' / 528' / 0
m / 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:

Quote
require_once('./HD.php');

$xpub = 'xpub......';
$path = $client_id.'/0';
$hd = new HD();
$hd->set_xpub($xpub);
$address = $hd->address_from_master_pub($path);

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1] 2 3 »  All
  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!