6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

catapult環境でのxemの送金(nem2-cli)

Last updated at Posted at 2018-05-25

2分でできるcatapult環境構築 on Amazon EC2でcatapult環境構築後、nem2-cliでxemの送金してみた。

以下、手順。

nem2-cliインストール

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
source ~/.bashrc
nvm ls-remote
nvm install v10.2.0
npm install nem2-cli -g

xem所有者の秘密鍵特定

nemesisファイルの設定ファイル[distribution>nem:xem]セクションの中から適当なアドレスを特定。

$ cat catapult-service-bootstrap/build/nemesis/block-properties-file.properties
...
[distribution>nem:xem]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = 409'090'909'000'000
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY = 409'090'909'000'000
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ = 409'090'909'000'000
...

最初の"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"(409,090,909,000,000 xem所有)にしよう。

次に、XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXの秘密鍵を特定。

$ cat catapult-service-bootstrap/build/generated-addresses/raw-addresses.txt
...

  address (mijin-test): XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

           private key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            public key: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

これで準備ができたので、nem2-cliを使ってxemを新規ユーザに送ってみよう。

初期ユーザのプロファイル作成

$ nem2-cli profile create --privatekey AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --network MIJIN_TEST --url http://localhost:3000 --profile nemesis

初期ユーザのアカウント情報確認

$ nem2-cli account info --profile nemesis
Account:        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXTXXXXXX
-------------------------------------------------------

Address:        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXTXXXXXX
at height:      1

PublicKey:      0000000000000000000000000000000000000000000000000000000000000000
at height:      0

Importance:     409090909
at height:      359

Mosaics
nem:xem:        409090909

409,090,909 xemもっていることを確認!

新規ユーザ作成

$ nem2-cli account generate --network MIJIN_TEST -s --url http://localhost:3000 --profile test_user
New Account:    YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Public Key:     DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Private Key:    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

初期ユーザから新規ユーザに10 xem転送!

$ nem2-cli transaction transfer --recipient YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY --message "payout of 10 xem" --mosaics nem:xem::10000000 --profile nemesis
Hash:    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Signer:  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

新規ユーザで確認

$ nem2-cli account info --profile test_user
Account:        YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
-------------------------------------------------------

Address:        YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
at height:      379

PublicKey:      0000000000000000000000000000000000000000000000000000000000000000
at height:      0

Importance:     0
at height:      0

Mosaics
nem:xem:        10

きてる、きてる。10 xem受け取ったことを確認。

一応トランザクション確認

$ nem2-cli transaction info --hash AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --profile nemesis
TransferTransaction: Recipient:SCYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY Message:"payout of 10 xem" Mosaics: d525ad41d95fcf29:10000000 Signer:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Deadline:2018-05-25 Hash:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

以上、無事に送金できた。

6
1
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
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?