1

User A has signed a message msg with signature sig.How can the third party verify this message in a contract? The verify method contract is like this: void verify_user_sig(account_name user,string msg,string sig,public_key pubkey);

Because we can know user,msg,sig and user's pubkey ,we can recover the public key in contract.But the problem is how can we know that the pubkey submitted is the user's public key ?

So the question is:
How to get the account name of a public key in contract?

| improve this question | | | | |
  • It does not make sense to do crypto validation in the smart contract, that is way too expensive. – friedger Sep 22 '18 at 6:33
1

There is no system table that stores the relation between accounts and public keys. Therefore, it is not possible to get account names from a public key in a contract.

Cleos is using the history plugin of nodeos to get the account names from a public key. (https://github.com/EOSIO/eos/blob/8f0f54cf0c15c4d08b60c7de4fd468c5a8b38f2f/programs/cleos/httpc.hpp#L108)

The table of the history plugin is updated e.g. through the updateauth action ( https://github.com/EOSIO/eos/blob/2232802dee4be1a3f6ca436edad64af3c45d7029/plugins/history_plugin/history_plugin.cpp#L239)

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.