Skip to content

hhun/web3-recover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

还原Web3签名消息的签名帐户

中文 | English

使用方法

JavaScript 签名消息

var msg = 'login'
var from = web3.eth.accounts[0]
web3.eth.sign(msg, from, function (err, result) {
	if (err) {
		return console.error(err);
	}
	console.log('signed: ' + result);
});

PHP恢复签名地址

use hhun\Web3Recover\Web3Recover;

$signed = '0x4cde93d4........'; // 签名内容

$msg = 'login';
echo Web3Recover::fromText($msg, $signed);

$hex = '0x6c6f67696e';
echo Web3Recover::fromHex($hex, $signed);