StrongHandsのWalletをLinuxで使おう その2

2018/08/17仮想通貨StrongHnds, Wallet, Ubuntu, VPS

前回の続き。
無事、VPSにWalletをインストールできたところで、続いては使い方です。

Bootstrapの適用と、よく使うコマンドなんかを見ていきたいと思います。

Bootstrap入れてみる

入れなくても勝手に同期始まるので、時間たっぷりな方は入れなくても大丈夫です。

Bootstrapのダウンロード

結構容量多いです。
こちらからダウンロードしてください。

MEGAだよおい。。。

UbuntuからMEGAで直接ダウンロードするのには、「megatools」というのを使うみたいです。
ソースコード落としてスクリプト書いてコンパイルして~ってのがダルいので今回はやりません。あんまり使わないし。

PCでダウンロード

そんな訳でPCからダウンロードします。
WinでもMacでもOKです。

.rarだよおい。。。

なんてこったい。rarもあんまり使わないよ。。。
仕方ないので使ってるPCに合わせて解凍ソフト入れてください。
Winだと7-Zipいれとけば色んなの解凍できるからオススメ。

Ubuntuでやる場合は

sudo apt install unrar

で解凍用のパッケージ入れてくださいな。

で、解凍。

sudo unrar ダウンロードしてきたファイル.rar

Bootstrapの適用

解凍してできたフォルダの中に「database」「ExtraConfFiles」「blk0001」「blkindex」っていうのがあるので、stronghandsのディレクトリへまるっとコピーします。
stronghandsdを起動している場合は一度止めてから、

cp -r 解凍したディレクトリ /home/usr_name/.stronghands/

とやって、必要なファイル類をコピーしてください。
コピーが終わったらstronghandsdを起動。

Walletの操作いろいろ

ここからが本番。
ひとまずhelpコマンドで一覧をざっと確認。

長い。。。
各コマンドを入力する前に、”stronghandsd”を入れるのを忘れずに。

stronghandsd help
addmultisigaddress <nrequired> <'["key","key"]'> [account]
backupwallet <destination>
checkwallet
createmultisig nrequired ["key",...]
createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
decoderawtransaction <hex string>
dumpprivkey <stronghandsaddress>
encryptwallet <passphrase>
getaccount <stronghandsaddress>
getaccountaddress <account>
getaddressesbyaccount <account>
getbalance [account] [minconf=1]
getblock <hash> [txinfo] [txdetails]
getblockcount
getblockhash <index>
getblocktemplate [params]
getcheckpoint
getconnectioncount
getdifficulty
getgenerate
gethashespersec
getinfo
getmininginfo
getnetworkghps
getnewaddress [account]
getpeerinfo
getrawmempool
getrawtransaction <txid> [verbose=0]
getreceivedbyaccount <account> [minconf=1]
getreceivedbyaddress <stronghandsaddress> [minconf=1]
gettransaction <txid>
gettxout "txid" n ( includemempool )
getwork [data]
help [command]
importprivkey <stronghandsprivkey> [label]
keypoolrefill
listaccounts [minconf=1]
listminting [count=-1] [from=0]
listreceivedbyaccount [minconf=1] [includeempty=false]
listreceivedbyaddress [minconf=1] [includeempty=false]
listsinceblock [blockhash] [target-confirmations]
listtransactions [account] [count=10] [from=0]
listunspent [minconf=1] [maxconf=9999999] ["address",...]
makekeypair [prefix]
move <fromaccount> <toaccount> <amount> [minconf=1] [comment]
repairwallet
reservebalance [<reserve> [amount]]
sendalert <message> <privatekey> <minver> <maxver> <priority> <id> [cancelupto]
sendfrom <fromaccount> <tostronghandsaddress> <amount> [minconf=1] [comment] [comment-to]
sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]
sendrawtransaction <hex string> [checkinputs=0]
sendtoaddress <stronghandsaddress> <amount> [comment] [comment-to]
setaccount <stronghandsaddress> <account>
setgenerate <generate> [genproclimit]
settxfee <amount>
signmessage <stronghandsaddress> <message>
signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighashtype="ALL"]
stop
submitblock <hex data> [optional-params-obj]
validateaddress <stronghandsaddress>
verifymessage <stronghandsaddress> <signature> <message>

まずは、

encryptwallet <passphrase>

を忘れずに。
お好きなパスワードを決めてください。

上記コマンドを実行すると、その後のhelpに下記が追加されます。

walletlock
walletpassphrase <passphrase> <timeout> [mintonly]
walletpassphrasechange <oldpassphrase> <newpassphrase>

<>は必須、[]はオプションとなっています。
アカウント作成は必須ではないので、setaccountしていなければ<account>欄は全て””と入力してください。

よく使うのは

getaddressesbyaccount <account>
getinfo
listminting
listtransactions
sendtoaddress <stronghandsaddress> <amount>

辺りでしょうか。

walletpassphrase <passphrase> <timeout> [mintonly]

はちょっと注意が必要です(詳細後述)

よく使うコマンド

順に見てみます。

getaddressesbyaccount “”

[
    "your address"
]

そのまんま、Walletのアドレスです。

stronghandsd getinfo

{
    "version" : "v0.1.5.3-unk",
    "protocolversion" : 60005,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "newmint" : 0.00000000,
    "stake" : 0.00000000,
    "blocks" : 635026,
    "moneysupply" : 11713991.31000000,
    "connections" : 63,
    "proxy" : "",
    "ip" : "xxx.xxx.xxx.xxx",
    "difficulty" : 116664.90356929,
    "testnet" : false,
    "keypoololdest" : 1522865944,
    "keypoolsize" : 101,
    "paytxfee" : 0.01000000,
    "errors" : ""
  }

とりあえずこれでbalance含めた情報が見れます。

listminting

{
  "account" : "",
  "address" : "your address",
  "input-txid" : "your transaction",
  "time" : "1523327759",
  "amount" : "40000000000000",
  "status" : "immature",
  "age-in-day" : "0",
  "coin-day-weight" : "0",
  "proof-of-stake-difficulty" : 413047.34215657,
  "minting-probability-10min" : 0.00000000,
  "minting-probability-24h" : 0.00000000,
  "minting-probability-30d" : 0.00000000,
  "minting-probability-90d" : 0.96819592,
  "search-interval-in-sec" : 0,
  "attempts" : 0
  }

今どのくらいかな~ってのを確認してください。
上記の例でamountが40兆なのは仕様です()
10万分の1で見るので、実際は4000万ですね。

listtransactions

{
  "account" : "",
  "address" : "your address",
  "category" : "receive",
  "amount" : 12000000.00000000,
  "confirmations" : 4528,
  "blockhash" : "41c8f30056f38200911c4dedb1d3b8ae36e320672ac0972e872b3e6c2fc568c3",
  "blockindex" : 2,
  "txid" : "e0e5af5039b760b146427904e54b3c796544b286ed5ac131da26fd31652b0a1d",
  "time" : 1522857713
}

transaction確認したいときはこちら(今までに発生したtransactionが全部出るので段々長くなります)

sendtoaddress <stronghandsaddress> <amount>

出金したい時はこちらですね

ハマったところ

先述の

walletpassphrase <passphrase> <timeout> [mintonly]

を適切に設定しておかないとハマります。
てゆーかハマりました。。。

デフォルトでwalletはロックされているので、アンロックします

stronghandsd walletpassphrase <passphrase> <timeout> [mintonly]

のコマンドで
<passphrase>に設定したパスワード、<timeout>にwalletlockまでの時間、[mintonly]に true/false の指定
を入れます

こんな感じ

stronghandsd walletpassphrase hogehoge 999999 true

で、改めてgetinfoすると

{
    "version" : "v0.1.5.3-unk",
    "protocolversion" : 60005,
    "walletversion" : 60000,
    "balance" : 40000000.00000000,
    "newmint" : 0.00000000,
    "stake" : 0.00000000,
    "blocks" : 635189,
    "moneysupply" : 547185798321.05609131,
    "connections" : 61,
    "proxy" : "",
    "ip" : "xxx.xxx.xxx.xxx",
    "difficulty" : 98694.80341016,
    "testnet" : false,
    "keypoololdest" : 1522865944,
    "keypoolsize" : 101,
    "paytxfee" : 0.01000000,
    "unlocked_until" : 1524326884,
    "errors" : ""
}

こんな感じになります。

"unlocked_until" : 1524326884,

っていう行が増えていますね。
ここが0以外の数値になっていればアンロックできています。
これやらないといつまで経っても着金しないので注意。

後は取引所等でStrongHandsを買って送金すればPoS Mintingが始まります。

ところがどっこい。
出金しようとすると、

Error: Wallet unlocked for block minting only, unable to create transaction.

こんなエラーが出て出金できない罠があったりします。

minting only なのでtransactionが発行できないよーってことですね(多分)

ここでさっきのを見返すと

walletpassphrase <passphrase> <timeout> [mintonly]

最後のオプションに[mintonly]がありますね。
こいつをfalseで指定してやります。

stronghandsd walletpassphrase hogehoge 999999 false

これで出金できるようになります。

暇があったらtransactionまとめるのとかやろうかな。

おしまい

とりあえずこれでPCつけっぱなしから開放されました。
それでは、良い筋肉ライフをお過ごし下さい。

スポンサーリンク