Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php to implement EOS offline signature transaction

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use php to implement EOS offline signature transactions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Keosd, the wallet server of the EOS blockchain, provides a sign_transaction development interface that allows developers to sign transactions. But if we want to manage the key ourselves instead of handing it over to keosd, how can we implement the offline signature of the transaction in the PHP code?

The answer is to use EosTool, the PHP package for EOS application development. EosTool's LocalSigner class makes it easy to sign EOS transactions offline. For example, the following code uses a private key that it manages to sign a token transfer transaction:

Use EosTool\ Signer\ LocalSigner $tx = ['expiration'= >' 2018-12-04T17VIED 00V, 'ref_block_num' = > 2878,' ref_block_prefix' = > 29012031, 'max_net_usage_words' = > 0,' max_cpu_usage_ms' = > 0, 'delay_sec' = > 0,' context_free_actions' = > [], 'actions' = > [' account' = > 'eosio.token',' name' = > 'transfer'' 'authorization' = > [[' actor' = > 'eosio',' permission' = > 'active']],' data' = > '11223344556677889900112233456677.889900']],' transaction_extensions' = > [] $pubKeys = [...]; $chainId = '...'; $signer = new LocalSigner (['5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'] / * private keys*/); $signatures = $signer- > sign ($tx,$pubKeys,$chainId)

To instantiate LocalSigner, you need to pass in a set of private keys for signature, and then call its sign () method to pass in the transaction initiation account public key array and chunk chain ID. The returned result is the authoritative signature array of the transaction.

Thank you for reading! On "how to use php to achieve EOS offline signature transactions" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report