Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

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

参考

tokuryoo
ブロックチェーン/Ethereum/geth // ディープラーニング/Keras/ゆるくKaggle // 仕事/ブロックチェーン8割ディープラーニング2割/R&D http://b.hatena.ne.jp/tokuryoo/
https://twitter.com/tokuryoo
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away