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

The restored address is different from the address generated on imtoken app #913

Open
AegisFor opened this issue Nov 29, 2023 · 0 comments

Comments

@AegisFor
Copy link

AegisFor commented Nov 29, 2023

Try recovering the address using a mnemonic phrase

 public function restore(){
        
        $mnemonic = "";
        
        $mnemonic = $mnemonic;

        $seedGenerator = new Bip39SeedGenerator(new Random());
        $seed = $seedGenerator->getSeed($mnemonic);

        $hierarchicalKeyFactory = new HierarchicalKeyFactory();

        $rootKey = $hierarchicalKeyFactory->fromEntropy($seed);

        $path = "44'/0'/0'"; 

        $key = $rootKey->derivePath($path);
        
        $publicKey = $key->getPublicKey();

        $pubKeyHash = $publicKey->getPubKeyHash();

        $address = new PayToPubKeyHashAddress($pubKeyHash);

        $Address = $address->getAddress();
        print_r($Address);die;
 
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant