Monero 核心 (CLI 命令列介面) 教學
Monero 錢包管理程式 (monero-wallet-cli) 是包含在 Monero 核心內的一個指令介面應用程式。比特幣錢包同時管理錢包帳戶及區塊鏈同步資料,而在 Monero 則是將這兩個工作分為兩支程式:區塊鏈同步程式(monerod)負責處理區塊鏈,錢包管理程式(monero-wallet-cli)負責處理錢包帳戶。
此份教學將會示範數種monero-wallet-cli的操作,此份教學是基於版本 0.10.1的 Monero 核心製作。
創建錢包
- 必須先執行區塊鏈同步程式(monerod)建立節點後讓它繼續在一旁執行
- monerd尚未完成同步前,錢包無法看到正確的餘額
- 找到 Monero 核心的 monero-wallet-cli 程式並執行它,會看到以下畫面:
C:\monero>monero-wallet-cli.exe
Monero 'Wolfram Warptangent' (v0.10.1.0-release)
Logging at log level 0 to C:\monero\monero-wallet-cli.log
Specify wallet file name (e.g., MyWallet). If the wallet doesn't exist, it will be created.
Wallet file name (or Ctrl-C to quit):
- 輸入錢包的帳戶名稱(以 lafudoci 舉例),即會顯示是否新增錢包帳戶
No wallet found with that name. Confirm creation of new wallet named: lafudoci
(Y/Yes/N/No): Y
- 輸入 Y 表示確認後,需要為錢包帳戶設定密碼,重複一次確認 接著會列出種子碼的語言選擇
Enter a password for your new wallet: **********
Confirm Password: **********
List of available languages for your wallet's seed:
0 : English
1 : Spanish
2 : German
3 : Italian
4 : Portuguese
5 : Russian
6 : Japanese
Enter the number corresponding to the language of your choice:
- 通常選擇英語,於是輸入0,程式開始產生錢包,然後顯示錢包位址,唯讀金鑰
Generated new wallet: 4Ao4GXj8fmHU7AfACWQqyvEEMUHsnvWd4THmbvBKDAHUNCaCGU4UcD2DRNagXSSnfXBHx94QNx8ucSHNzEn6ewFMUp4BYng
View key: 502f54c6a3c912b90773193eda9b954b70daf582085000e93d76c8ecba459807
- 還有最重要的:由 25 個英文單字組成的種子碼(seed)
**********************************************************************
Your wallet has been generated!
To start synchronizing with the daemon, use "refresh" command.
Use "help" command to see the list of available commands.
Always use "exit" command when closing monero-wallet-cli to save your
current session's state. Otherwise, you might need to synchronize
your wallet again (your wallet keys are NOT at risk in any case).
PLEASE NOTE: the following 25 words can be used to recover access to your wallet
. Please write them down and store them somewhere safe and secure. Please do not
store them in your email or on file storage services outside of your immediate
control.
visited fidget irritate kernels oval trendy tirade orchid
anvil oaks calamity damp nasty comb criminal cause
luxury gymnast uncle arises uncle remedy dusted each luxury
**********************************************************************
重要步驟!
visited fidget irritate kernels oval trendy tirade orchid
anvil oaks calamity damp nasty comb criminal cause
luxury gymnast uncle arises uncle remedy dusted each luxury
- 請抄寫上面剛剛在您的畫面產生的25字種子碼組成的種子碼(seed)。
千萬不可洩漏此份種子碼且請確保這組文字被安全的備份
萬一遺失了這份種子碼,您將無法回復您的帳戶
若這份種子碼洩漏或被盜取,獲得此份種子碼的人將可以取得這份的錢包完整的控制權
錢包的種子碼無法改變,若您的種子碼資訊被竊取或其他原因而洩漏,您將需要另外創建新的錢包帳戶
把種子碼洩漏的錢包資金轉移至新的錢包,並繼續妥善保管新的種子碼資訊
- 接著錢包會從區塊鏈裡掃描更新您的資金餘額
Starting refresh...
Height 269922 / 1209934
- 過一段時間更新完成後您將可看見您的錢包餘額(balance)
Refresh done, blocks received: 1
Balance: 0.000000000000, unlocked balance: 0.000000000000
Background refresh thread started
收款操作
- 在上一個步驟產生的錢包位址將會存放在 Monero 核心的資料夾內,附檔名為.address,以記事本開啟後即可獲得錢包的位址
- 以此份範例產生的位址為以下的格式字串
4Ao4GXj8fmHU7AfACWQqyvEEMUHsnvWd4THmbvBKDAHUNCaCGU4UcD2DRNagXSSnfXBHx94QNx8ucSHNzEn6ewFMUp4BYng
- 將錢包位址提供給支付方即可開始等待對方付款至錢包內。
- 對方付款後在錢包畫面中輸入 refresh 會更新錢包的餘額,交易確認等待時間通常只會需要數分鐘的時間。
付款操作
- 使用 transfer 指令如下格式
transfer (混幣數量) 收款方錢包位址 金額 (付款ID)
- 混幣數量(mixin):可不填,預設為4,數字指定得越高能使得此次交易的資訊越難被追蹤,相對的手續費也會高一些。
- 付款ID(Payment ID):若為轉帳至交易所則此項必填,否則交易所會無法辨識而讓您損失這筆資金!
金額 (amount):金額單位為XMR。
以下為簡易的發送1XMR至另一個錢包的範例,在錢包中輸入:
transfer 45RByKZ4n3qHecCcTLH9poJyPAQLuYGEDVtBEEnyhwPYBHquxPZ1kNCGMiee8iHm6yQM6u8pDZRQfDYnTz9Cdf6fCLmJSV8 1
- 程式會提示是否需要付款ID及計算手續費,輸入Y確認。
No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): Y
Sending 1.000000000000. The transaction fee is 0.006000000000.
Is this okay? (Y/Yes/N/No): Y
- 如此交易就成功發送出去了,交易確認等待時間通常只會需要數分鐘的時間。
Money successfully sent, transaction <61b48eb889285172ba1062fd726f393d6b1aa7d6d916a4a0420e0cc5379a8783>
- 很好,剛剛的範例地址就是本篇教學作者的贊助位址,謝謝您的贊助!我會繼續努力的!
- 什麼?你說你剛剛沒有真的送出交易?這...無論如何我還是會繼續努力的 (淚)
再次登入
- 確保您的monerod有在正在執行
- 只需要在執行monero-wallet-cli後輸入您的使用者名稱及密碼即可登入錢包。
其他功能
- 在錢包畫面中輸入help,即可參閱其他功能的說明。
Commands:
address Show current wallet public address
balance Show current wallet balance
bc_height Show blockchain height
check_tx_key Check amount going to <address> in <txid>
export_key_images Export a signed set of key images
export_outputs Export a set of outputs owned by this wallet
get_tx_key Get transaction key (r) for a given <txid>
get_tx_note Get a string note for a txid
help Show this help
import_key_images Import signed key images list and verify their spent status
import_outputs Import set of outputs owned by this wallet
incoming_transfers incoming_transfers [available|unavailable] - Show incoming transfers, all or filtered by availability
integrated_address integrated_address [PID] - Encode a payment ID into an integrated address for the current wallet public address (no argument uses a random payment ID), or decode an integrated address to standard address and payment ID
locked_transfer locked_transfer [<mixin_count>] <addr> <amount> <lockblocks>(Number of blocks to lock the transaction for, max 1000000) [<payment_id>]
payments payments <PID_1> [<PID_2> ... <PID_N>] - Show payments for given payment ID[s]
refresh Synchronize transactions and balance
rescan_bc Rescan blockchain from scratch
rescan_spent Rescan blockchain for spent outputs
save Save wallet data
save_bc Save current blockchain data
save_watch_only Save a watch-only keys file
seed Display Electrum-style mnemonic seed
set Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID,tx secret key) for future reference; default-mixin <n> - set default mixin (default is 4); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [1|2|3] - normal/elevated/priority fee; confirm-missing-payment-id <1|0>
set_log set_log <level> - Change current log detail level, <0-4>
set_tx_note Set an arbitrary string note for a txid
show_transfers show_transfers [in|out] [<min_height> [<max_height>]] - Show incoming/outgoing transfers within an optional height range
sign Sign the contents of a file
sign_transfer Sign a transaction from a file
spendkey Display private spend key
start_mining start_mining [<number_of_threads>] - Start mining in daemon
status Show wallet status information
stop_mining Stop mining in daemon
submit_transfer Submit a signed transaction from a file
sweep_all sweep_all [mixin] address [payment_id] - Send all unlocked balance an address
sweep_unmixable Send all unmixable outputs to yourself with mixin 0
transfer Same as transfer_original, but using a new transaction building algorithm
transfer_original transfer [<mixin_count>] <addr_1> <amount_1> [<addr_2> <amount_2> ... <addr_N> <amount_N>] [payment_id] - Transfer <amount_1>,... <amount_N> to <address_1>,... <address_N>, respectively. <mixin_count> is the number of extra inputs to include for untraceability (from 2 to maximum available)
verify Verify a signature on the contents of a file
viewkey Display private view key