In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to write the PHP code generated by Eos offline key? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Although EOS's key algorithm is similar to Bitcoin, it has made some adjustments to define its own format. The development kit EosTool contains the EOS offline key generation module, which can generate EOS keys offline without connecting any nodes. This article gives an example of PHP code for EOS offline key generation.
If you want to learn EOS application development, you can visit this [EOS Intelligent contract and DApp Development tutorial], which covers core knowledge points such as EOS tool chain, account and wallet, token issuance, intelligent contract development, deployment and interaction, and finally uses each knowledge point to complete the development of a note DApp.
Use the static method new () of the PrivateKey class to generate a random private key. For example:
Use EosTool\ Crypto\ PrivateKey;$prv = PrivateKey::new (); echo $prv- > toEos (). PHP_EOL; / / similar: 5Hu6nxM6s6UQ3nYkr1s1GKA17zPqpceUuWxH3JBwK8ZorMSRqGi
The toEos () method is used to convert the private key object to the custom format of EOS.
A public key can be derived from a private key, for example:
$pub = $prv- > getPublicKey (); echo $pub- > toEos (). PHP_EOL; / / similar: EOS6wQ6t3n148GfzLzgxq7cC8ARDKxeaB3hQXdXn7oZYdwEyAXiSv
Similarly, use the toEos () method of the public key object to convert the public key to the custom format of EOS.
You can convert a private key in EOS format to a PrivateKey object of EosTool. For example, the following code imports the specified EOS private key and displays its corresponding EOS public key:
$prv = PrivateKey::fromEos ('5Hu6nxM6s6UQ3nYkr1s1GKA17zPqpceUuWxH3JBwK8ZorMSRqGi'); echo $prv- > getPublicKey ()-> toEos (). PHP_EOL
The sign () method of PrivateKey supports both normal signatures and authoritative signatures required by the EOS node. For example, the following code returns a normal signature:
$hex = '1234567890abcdef.alternative signature = $prv- > sign ($hex)
Obtain the authoritative signature of the specified data by passing in an additional parameter true:
$hex = '1234567890abcdef.alternate signature = $prv- > sign ($hex,true); this is the answer to the question on how to write the PHP code generated by Eos offline key. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.