我需要为我的网站的每个用户生成以太钱包。我需要获取私钥和公钥。如何使用PHP或Javascript来实现?
对于以太坊,我找到了web3.js库,我可以使用它来访问以太坊节点,但我看到的示例仅用于检查余额或发送已有钱包的交易。如何在没有私钥/公钥的情况下从乞求中创建它们?
发布于 2018-07-17 14:26:44
尝试在web3js中使用"web3.eth.accounts“
web3.eth.accounts.create();
更多信息请访问:https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#create
或者尝试在web3.php中使用PHP
newAccount = '';
$web3->personal->newAccount('123456', function ($err, $account) use(&$newAccount) {
if ($err !== null) {
echo 'Error: ' . $err->getMessage();
return;
}
$newAccount = $account;
echo 'New account: ' . $account . PHP_EOL;
});
更多信息请访问:https://github.com/sc0Vu/web3.php#assign-value-to-outside-scopefrom-callback-scope-to-outside-scope
https://stackoverflow.com/questions/48346907
复制相似问题