In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use the ethernet mnemonic PHP development kit". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Overview of the development package
The ethernet mnemonic PHP package mainly includes the following features:
Generate mnemonic words that conform to the BIP39 standard
Convert BIP39 mnemonic words to hierarchical determination keys that conform to the BIP32 standard
Support BIP44 multi-currency level deterministic wallet specification
Mnemonic words and key / address conversion compatible with imtoken, metamask and other common wallets
2. Instructions for using the core class
The Mnemonic class is the entry class of the Ethernet mnemonic PHP package, which is used to generate mnemonic words that conform to the BIP39 standard, or to convert existing mnemonic words into corresponding random entropy values for the generation of private keys.
The Mnemonic class provides the following static methods for instantiation:
New (): create a new Mnemonic object
FromWords (): instantiate Mnemonic objects with existing mnemonics
FromEntropy (): instantiates Mnemonic objects using existing random entropy
Mnemonic examples provide the following methods to obtain random entropy and mnemonics of their representations:
GetEntropy (): get random entropy
GetWords (): get mnemonic words
The HDKey class is used to create a hierarchical determination key that supports the BIP32/BIP44 standard and provides the following static method instantiation:
FromMnemonic (): use mnemonics to create levels to determine the master key
FromSeed (): use seed data to create a hierarchy to determine the master key
The HDKey instance object provides the following methods to derive descendant HDKey:
DeriveChild (): derives the subkey of the specified sequence number
DerivePath (): derives the descendant key of the specified hierarchical path
3. Sample code: generate new mnemonic words
The following code uses the static method new () of the Mnemonic class to generate new mnemonics, and then outputs and displays the generated mnemonics and their corresponding random entropy:
Use EthTool\ Mnemonic;$mnemonic = Mnemonic::new (); / * create a new mnemonic * / echo 'mnemonic = >'. $mnemonic- > getWords (). PHP_EOL; / * displays the mnemonic * / echo 'entropy = >'. $mnemonic- > getEntropy (). PHP_EOL; / * shows the corresponding random entropy * /
Use mnemonics to generate a hierarchical master key and determine the wallet's first Ethernet Fong key and address according to the BIP44 convention generation level:
$master = HDKey::fromMnemonic ($mnemonic- > getWords ()); / * generate the BIP32 hierarchical master key using mnemonics * / $key0 = $master- > derive ("m _ max 44 cents / 60 cents); / * generate the first hierarchical key corresponding to the Ethernet Fong key path of the BIP44 agreement * / echo 'key = >'. $key0- > privateKey. PHP_EOL; / * displays the private key corresponding to the hierarchical key, hexadecimal string * / echo 'address = >'. $key0- > address. PHP_EOL; / * display the ethernet address corresponding to the hierarchical key * / 4, sample code: import existing mnemonics
The following code uses the static method fromWords () of the Menmonic class to import the existing mnemonic, and then uses the mnemonic to generate the corresponding hierarchical key and BIP44 ethernet wallet address:
Use EthTool\ HDKey;// mnemonic $words = 'moral predict wash pledge hybrid box virtual length clap volcano shadow notice';$master = HDKey::fromMnemonic ($words); / * use mnemonics to generate a BIP32-level master key * / $key0 = $master- > derive ("m-pinch-44-pound-60-pound-0-pound-0-pound"); / * generate the first hierarchical key corresponding to the Ethernet Fong key path of the BIP44 agreement * / echo' private key = >'. $key0- > privateKey. PHP_EOL; / * displays the private key corresponding to the hierarchical key, hexadecimal string * / echo 'address = >'. $key0- > address. PHP_EOL; / * shows the Ethernet Square address corresponding to the hierarchical key * / "how to use the Ethernet Square mnemonic PHP Development Kit". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.