We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
My code to Generate ETH Address and other Address like BCH looks like this
function generateEthAddress($xpub, $index){ $Bitcoin = new Bitcoin(); $Bitcoin->setNetwork($this->isMainNet() ? new MultiCoinNetwork('ETH') : new MultiCoinNetwork('ETH', 'test')); $network = $Bitcoin->getNetwork(); $factory = new HierarchicalKeyFactory(); $root = $factory->fromExtended($xpub, $network) ->withoutPrivateKey() ->derivePath($index); $pubkey = $root->getPublicKey(); $hdaddress = new PayToPubKeyHashAddress($pubkey->getPubKeyHash()); $array = array("address" => $hdaddress->getAddress()); return json_encode($array); }
My code to Generate ETH WIF and other WIF like BCH looks like this
function generateEthPrivateKey($mnemonic, $index){ $Bitcoin = new Bitcoin(); $Bitcoin->setNetwork($this->isMainNet() ? new MultiCoinNetwork('ETH') : new MultiCoinNetwork('ETH', 'test')); $network = $Bitcoin->getNetwork(); $path = $this->getPath("ETH"); $seedGenerator = new Bip39SeedGenerator(); $seed = $seedGenerator->getSeed($mnemonic); $factory = new HierarchicalKeyFactory(); $root = $factory->fromEntropy($seed); $hdwallet = $root->derivePath($path."/".$index)->getPrivateKey(); $array = array("key" => $hdwallet->toWif($network)); return json_encode($array); }
but this is not giving me promising result please can you refactor my code to let me me get the real way of how it will work?
this Exactly works when i use with BTC and LTC using
$Bitcoin->setNetwork($this->isMainNet() ? NetworkFactory::bitcoin() : NetworkFactory::bitcoinTestnet()); and $Bitcoin->setNetwork($this->isMainNet() ? NetworkFactory::litecoin() : NetworkFactory::litecoinTestnet());
thanks. i have really tried but i didn't want to rewrite another code just give me how this lib can solve my question with my approach above thanks.
The text was updated successfully, but these errors were encountered:
@dan-da help me with little refactoring.
Sorry, something went wrong.
No branches or pull requests
My code to Generate ETH Address and other Address like BCH looks like this
My code to Generate ETH WIF and other WIF like BCH looks like this
but this is not giving me promising result please can you refactor my code to let me me get the real way of how it will work?
this Exactly works when i use with BTC and LTC using
thanks.
i have really tried but i didn't want to rewrite another code just give me how this lib can solve my question with my approach above thanks.
The text was updated successfully, but these errors were encountered: