LoginSignup
0
0

More than 5 years have passed since last update.

web3.jsでノード上にアカウントを作る

Last updated at Posted at 2019-01-11

web3 1.0.0-beta を利用して、geth(private)のノード上にアカウントを作る手順。
(ローカルに秘密鍵を作るのではなく、接続先のノード上に秘密鍵を作る)

geth起動

geth --rpc --rpcapi "personal" --networkid "15" --nodiscover console

Node.js側でJavaScript実装(web3.jsを用いて)

newAccount.js
web3.eth.personal.newAccount('password1').then( function (address) {
  console.log("typeof(address)", typeof(address));
  console.log("address", address);
}).catch( function ( error ) {
  console.log(error);
});

実行

$ node newAccount.js
typeof(address) string
address 0x890917A6AE8E24667f75679dAB5dfb30Fd7599F6

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0