在本例中,我正在学习如何使用web3js创建一个ethereum地址和一个私钥,以生成一个简单的dapp。
有人能告诉我使用这个web3js吗?如果你高兴的话,我向你寻求如何使用它的帮助:
我最近的研究成果是为了了解以太和令牌ERC20之间的平衡。
为了进一步巩固这篇文章,也许还有人可以分享关于web3js的信息,作为我和其他人的参考。
发布于 2018-10-08 15:55:27
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
<script>
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider)
} else {
// Set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io"))
}
console.log(web3.eth.accounts.create())
</script>你会得到
{
address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}
}https://stackoverflow.com/questions/52485099
复制相似问题