我调用直接调用web3.shh.xxx会报错没有这类方法 web3.shh.addPrivateKey('0x8bda3abeb454847b515fa9b404cede50b1cc63cfdeddd4999d074284b4c21e15').then(console.log); Error: the method shh_addPrivateKey does not exist/is not available at web3.js:3143:20 at web3.js:6347:15 at web3.js:5081:36 at <anonymous>:1:1
可以用: https://github.com/ethereumjs/ethereumjs-util
> const util = require('ethereumjs-util')
> util.privateToPublic(privateKey)
或者 用 secp256k1:
> const secp256k1 = require('secp256k1')
> secp256k1.publicKeyCreate(privateKey, false).slice(1)