connecting...
Google translation for articles :
3 NEMBER donated to you!!

テストネット使ってみた (nem2-cli,python3をつかって)

nem2.55xem (3) 163 1 0

DAOKAさんのテストネットを使ってみた

 

ニズベールさんのテストネットのまとめ
https://jp-nem-dev.growi.cloud/testnet

 

やったこと nem2-cliでアカウントを2つ作る(defaultは一つ) nem2-cliも名前変わるのだろうか?

Macで実行してます

python3

nem2-cli 最新版

 

↓のようなのはコマンド打ってます

>nem2-cli account generate

 

[1] MAIN_NET
[2] TEST_NET
[3] MIJIN
[4] MIJIN_TEST
[0] CANCEL

 

ネットワークを聞かれるけど[2]でよいのでしが。気がつけば。。

 

前は[4] MIJIN_TESTだったのではまった

 

あとはアカウント名
パスワード
デフォールトにするかどうか  (1つ目はデフォールトで)

 

作成したデータが一覧表示されるので2つ目を同じ様に作成

 

次に送るためのモザイクをもらう

 

ニズベールさんのテストネットのまとめ
https://jp-nem-dev.growi.cloud/testnet

上のページのフォーセットのどれかにいって自分のアドレスをいれてメッセージをいれてボタンを押す


アドレスごとのデータ確認

>nem2-cli account info --address アドレス入れる

 

Mosaic Id │ Relative Amount │ Absolute Amount │ Expiration Height │

│ 75AF035421401EF0 │ 501 │ 501000000 │ Never │

 

これがもらったモザイク

 

現状モザイク名は番号でNIS1みたいにxemはない

 

モザイクを1つ目から二つ目に送る

 

>nem2-cli transaction transfer -r 受けてのアドレス

Enter your wallet password: ***********
Mosaics to transfer in the format (mosaicId(hex)|@aliasName)::absoluteAmount, (Ex: sending 1 cat.currency, @cat.currency::1000000). Add multiple mosaics with commas: 75AF035421401EF0::1000
Enter a message: ops
Enter the maximum fee (absolute amount): 1
Do you want to announce this transaction? Payload:
B400000000000000B9FE53A7519B8D540B251CBA36266DC82ABFE4DFDBF3BA91
5F16C03A795554C7D7217E9541C748D3CBE56B108679101AEB241C5CA1AEE0E6
EE943B10BE552301CCEB49F459B4BD7707C935949C6199B2387F70C47A34C39E
13ABC1377A3A6C9400000000019854410100000000000000D4BBDE3501000000
98149F039ED22B00CE28C50EDC8C415E2C57F4341C30FE7D2701040000000000
F01E40215403AF75E803000000000000006F7073 [y/n]: y
Transaction announced correctly
Hash: A6D67E6FA5497A9E8E84C8EADECBCA1DE253531009E05AE05207ACFB3EDD9C76
SignerPublicKey: CCEB49F459B4BD7707C935949C6199B2387F70C47A34C39E13ABC1377A3A6C94

 

こんなふうにトランザクションが表示される

 

2つ目のアドレスから1つ目に送り返す
一つ目はデフォールトだったのでちょっと違う

 

>nem2-cli transaction transfer --profile プロファイル名 -r 受けてアドレス

 

(プロファイル名がわからないときは >nem2-cli profile list で表示する)

 

Enter your wallet password: **********
Mosaics to transfer in the format (mosaicId(hex)|@aliasName)::absoluteAmount, (Ex: sending 1 cat.currency, @cat.currency::1000000). Add multiple mosaics with commas: 75AF035421401EF0::1000
Enter a message: opai
Enter the maximum fee (absolute amount): 1
Do you want to announce this transaction? Payload:
B5000000000000005C7207EBBB61073620475407D438289B65571E7D3A3BDCA0
40687D3A26F181954B91F012AB3833368CE533C369A5E9DC186E4D5D6726BAAD
1CED414F50F13006EBB5DDB010EABB4C8C3F2C23640C22375159890F0447FE2E
329717AE8391DB0100000000019854410100000000000000BCD0E13501000000
98887E4BFF8696F222E58FC91032E90476C7D0FA15518D1B6301050000000000
F01E40215403AF75E803000000000000006F706169 [y/n]: y
Transaction announced correctly
Hash: B45DE50A11C19328249D021ADAA6FA089DEC9F5CB33142418004DC25D1C83E39
SignerPublicKey: EBB5DDB010EABB4C8C3F2C23640C22375159890F0447FE2E329717AE8391DB01

 

とりあえず送金終了


ここでAPIでデータを見てみる

使用したプログラム

 

python3 アドレスとパブリックキーからアカウントデータを表示する アドレスはハイフンを抜かないとエラーになる

 

import requests
import json

url = 'https://catapult-test.opening-line.jp:3001/'
#api = 'account/transfers/'
api = 'account/'
account = 'EBB5DDB010EABB4C8C3F2C23640C22375159890F0447FE2E329717AE8391DB01' #publickey
address = 'TAKJ6A462IVQBTRIYUHNZDCBLYWFP5BUDQYP47JH'

r = requests.get(url + api + address ).json()
print(url + api + address )
s = requests.get(url + api + account ).json()
print(url + api + account )

print('account-info from address')

print(json.dumps(r,indent=4))

print('account-info from public-key')

print(json.dumps(s,indent=4))


print('incoming-data')

url = 'https://catapult-test.opening-line.jp:3001/'
#api = 'account/transfers/'
api = 'account/'
api2 = '/transactions/incoming'
api3 = '/transactions/outgoing'

q = requests.get(url + api + account +api2 ).json()
print(url + api + account +api2 )


print(json.dumps(q,indent=4))

for i in range(1,2):
print(i-1)
print('id: {}'.format(q[i-1]['meta']['id']))
print('address: {}'.format(q[i-1]['transaction']['recipientAddress']))
print('publickey: {}'.format(q[i-1]['transaction']['signerPublicKey']))
print('mosaics:{}'.format(q[i-1]['transaction']['mosaics']))

p = requests.get(url + api + account +api3 ).json()
print(url + api + account +api3 )

 


実行結果

https://catapult-test.opening-line.jp:3001/account/TAKJ6A462IVQBTRIYUHNZDCBLYWFP5BUDQYP47JH
https://catapult-test.opening-line.jp:3001/account/EBB5DDB010EABB4C8C3F2C23640C22375159890F0447FE2E329717AE8391DB01
account-info from address
{
"account": {
"address": "98149F039ED22B00CE28C50EDC8C415E2C57F4341C30FE7D27",
"addressHeight": "159529",
"publicKey": "0000000000000000000000000000000000000000000000000000000000000000",
"publicKeyHeight": "0",
"accountType": 0,
"linkedAccountKey": "0000000000000000000000000000000000000000000000000000000000000000",
"activityBuckets": [],
"mosaics": [
{
"id": "75AF035421401EF0",
"amount": "601000000"
}
],
"importance": "0",
"importanceHeight": "0"
}
}
account-info from public-key
{
"account": {
"address": "98149F039ED22B00CE28C50EDC8C415E2C57F4341C30FE7D27",
"addressHeight": "159529",
"publicKey": "0000000000000000000000000000000000000000000000000000000000000000",
"publicKeyHeight": "0",
"accountType": 0,
"linkedAccountKey": "0000000000000000000000000000000000000000000000000000000000000000",
"activityBuckets": [],
"mosaics": [
{
"id": "75AF035421401EF0",
"amount": "601000000"
}
],
"importance": "0",
"importanceHeight": "0"
}
}
incoming-data
https://catapult-test.opening-line.jp:3001/account/EBB5DDB010EABB4C8C3F2C23640C22375159890F0447FE2E329717AE8391DB01/transactions/incoming
[
{
"meta": {
"height": "159529",
"hash": "248D147FA1035E656A866CD41CC6924351075FC1082BC725D7654A9637F63ABE",
"merkleComponentHash": "248D147FA1035E656A866CD41CC6924351075FC1082BC725D7654A9637F63ABE",
"index": 0,
"id": "5E17DA712B5AEF7E9B14B85D"
},
"transaction": {
"signature": "A30E39868FD2A8375B90C3F915F01E00BCB77E4BDFAA335110FCD8B93BB10F352D9A2FA78C2B0D9B81357414500737AED9FF5B3BC895B7B2A45069AF4C20DA0E",
"signerPublicKey": "270DCB97730D2A06F57F58B307A963CEBFD1913CD2303239F3E914457E1D37C7",
"version": 1,
"network": 152,
"type": 16724,
"maxFee": "20000",
"deadline": "5191441881",
"recipientAddress": "98149F039ED22B00CE28C50EDC8C415E2C57F4341C30FE7D27",
"message": {
"type": 0,
"payload": "7468616E6B73"
},
"mosaics": [
{
"id": "75AF035421401EF0",
"amount": "601000000"
}
]
}
}
]
0
id: 5E17DA712B5AEF7E9B14B85D
address: 98149F039ED22B00CE28C50EDC8C415E2C57F4341C30FE7D27
publickey: 270DCB97730D2A06F57F58B307A963CEBFD1913CD2303239F3E914457E1D37C7
mosaics:[{'id': '75AF035421401EF0', 'amount': '601000000'}]

 

とりあえず本日の成果

 

Why don't you get crypt currency 'nem' by posting your blog article?

nemlog is blog posting service which has donation feature by crypt currency nem.
nemlog was launched to create environment which can be donated nem among NEMbers via blog articles.
Let's get nem by posting good blogs.

Nem prize event is being held frequently, Please join us on this opportunity!

nemlog registration from here
Register
Comments from NEMber
ゼム🐳ゼム.
2020-01-10 14:59:23ID:168736

・w・ハイフンを抜かないとエラーに!

NEMber who posted this article

nem好き 同じ県内でNEMって聞いたことのない僻地にいます。ひっそりと苔のように生息中。
37492
0