CLI Interface

很多人產生了 Electroneum 錢包位址後,就不知道要怎麼轉出轉入加密貨幣,官方也只提供 CLI 介面的錢包,現在 Windows 的盛行,造成許多人都只會操作 GUI 軟體,反而不會使用 CLI 程式;今天介紹的教學,是最正統的方式,也就是用 CLI 介面操作,請先從 Electroneum 官方 Github Release 下載 Electroneum CLI 錢包,再按照教學做。

以下教學 Monero 的 CLI 錢包也適用,只要把指令中的 electroneum 替代成 monero 就可以了,但別忘記錢包軟體要換成 Monero 的。

使用節點

如果你手上有架好的 ETN 節點,就不需要自行同步啦,這是最方便最快速的做法。

在資料夾開啟 CMD,執行 electroneum-wallet-cli --daemon-host 你的節點網址 就可以開始操作錢包了。

自行同步區塊鏈

解壓縮官方的錢包檔案後,執行 electroneumd.exe 開始同步,再開啟錢包 electroneum-wallet-cli.exe

你也可以把區塊鏈檔案放在你想要的位置,建議寫個腳本來同步,D:\blockchain\electroneum 可以替換成你想要的路徑。

1
electroneumd --data-dir D:\blockchain\electroneum

更多參數可以輸入 --help 取得詳細內容。

1
electroneumd --help

查看種子碼

輸入 seed,再輸入錢包密碼,就會顯示出種子碼了,還是老話一句,很重要不可洩漏。(測試用錢包,裡面沒錢。)

1
2
3
4
5
6
7
8
[wallet etnk1U (out of sync)]: seed
Wallet password: **************

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.

waxing liar gave coal vixen geyser satin punch
neon yeti alerts loudly tugs urchins unafraid symptoms
textbook vain amply oatmeal gels future fawns frying textbook

查看餘額

進入錢包後,輸入 balance 即可查看錢包餘額。

1
2
[wallet etnkKX (out of sync)]: balance
Balance: 0.00, unlocked balance: 0.00

轉帳

下面是發送 100 ETN 的範例,etnkKXAv5TaVAnQuhc3ZCg8nJCSnLQYWCNREJwi5QitHiTzDmS179GbBdzLHp2z3bFNsFzrJmjhuHLzX475oEWVr8CgN4AucjM 記得換成你要發送的目標位址,你要發錢給我我也不介意。

1
transfer etnkKXAv5TaVAnQuhc3ZCg8nJCSnLQYWCNREJwi5QitHiTzDmS179GbBdzLHp2z3bFNsFzrJmjhuHLzX475oEWVr8CgN4AucjM 100

更多指令可以輸入 help 取得詳細資訊。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
[wallet etnkKX (out of sync)]: help
Commands:
  address              Show current wallet public address
  address_book         address_book [(add (<address> [pid <long or short payment id>])|<integrated address> [<description possibly with whitespaces>])|(delete <index>)] - Print all entries in the address book, optionally adding/deleting an entry to/from it
  balance              Show current wallet balance
  bc_height            Show blockchain height
  check_tx_key         Check amount going to <address> in <txid>
  check_tx_proof       Check tx proof for payment going to <address> in <txid>
  donate               donate [<ring_size>] <amount> [payment_id] - Donate <amount> to the development team (donate.getmonero.org)
  export_key_images    Export a signed set of key images
  export_outputs       Export a set of outputs owned by this wallet
  fee                  Print information about fee and current transaction backlog
  get_tx_key           Get transaction key (r) for a given <txid>
  get_tx_note          Get a string note for a txid
  get_tx_proof         Generate a signature to prove payment to <address> in <txid> using the transaction secret key (r) without revealing it
  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 [<ring_size>] <addr> <amount> <lockblocks>(Number of blocks to lock the transaction for, max 1000000) [<payment_id>]
  password             Change wallet password
  payment_id           Generate a new random full size payment id - these will be unencrypted on the blockchain, see integrated_address for encrypted short payment ids
  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; print-ring-members <1|0> - whether to print detailed information about ring members during confirmation; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-ring-size <n> - set default ring size (default is 5); 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 [0|1|2|3|4] - default/unimportant/normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>; unit <electroneum|ecent> - set default monero (sub-)unit; min-outputs-count [n] - try to keep at least that many outputs of value at least min-outputs-value; min-outputs-value [n] - try to keep at least min-outputs-count outputs of at least that value; merge-destinations <1|0> - whether to merge multiple payments to the same destination address; confirm-backlog <1|0> - whether to warn if there is transaction backlog
  set_log              set_log <level>|<categories> - Change current log detail (level must be <0-4>)
  set_tx_note          Set an arbitrary string note for a txid
  show_transfer        Show information about a transfer to/from this address
  show_transfers       show_transfers [in|out|pending|failed|pool] [<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 [ring_size] address [payment_id] - Send all unlocked balance to an address
  sweep_below          sweep_below <amount_threshold> [ring_size] address [payment_id] - Send all unlocked outputs below the threshold to an address
  sweep_unmixable      Send all unmixable outputs to yourself with ring_size 1
  transfer             transfer [<priority>] [<ring_size>] <address> <amount> [<payment_id>] - Transfer <amount> to <address>. <priority> is the priority of the transaction. The higher the priority, the higher the fee of the transaction. Valid values in priority order (from lowest to highest) are: unimportant, normal, elevated, priority. If omitted, the default value (see the command "set priority") is used. <ring_size> is the number of inputs to include for untraceability. Multiple payments can be made at once by adding <address_2> <amount_2> etcetera (before the payment ID, if it's included)
  transfer_original    Same as transfer, but using an older transaction building algorithm
  unspent_outputs      unspent_outputs [<min_amount> <max_amount>] - Show unspent outputs within an optional amount range
  verify               Verify a signature on the contents of a file
  viewkey              Display private view key

從種子碼還原錢包

在 CLI 錢包的資料夾開啟 CMD,執行下面指令。

1
electroneum-wallet-cli --restore-deterministic-wallet

輸入要還原的錢包名稱,restore 可換成你想要的錢包名稱。

1
2
Specify a new wallet file name for your restored wallet (e.g., MyWallet).
Wallet file name (or Ctrl-C to quit): restore

然後輸入種子碼。

1
2
3
Specify Electrum seed: waxing liar gave coal vixen geyser satin punch
Electrum seed continued: neon yeti alerts loudly tugs urchins unafraid symptoms
Electrum seed continued: textbook vain amply oatmeal gels future fawns frying textbook

要求輸入密碼加密錢包。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Enter new wallet password: ************
Confirm Password: ************
Generated new wallet: etnk1UfXSXj9uGadvvE3AZhCZVj3peVqpjnenhmYYYD2cafTrQX3oyZQxLEmNz3eLahqxfGfYzCywEv4K2mC9uwq2w1qEjs2kY
View key: 2fda80d79c3a9cd2bde21a597c0b3de8db6c3671dea09cccae668a6355e4620c
**********************************************************************
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 electroneum-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.

waxing liar gave coal vixen geyser satin punch
neon yeti alerts loudly tugs urchins unafraid symptoms
textbook vain amply oatmeal gels future fawns frying textbook
**********************************************************************

詢問從哪個區塊鏈高度同步,通常選 0 就好,之後就開始同步錢包了。

1
2
3
4
Restore from specific blockchain height (optional, default 0),
or alternatively from specific date (YYYY-MM-DD): 0
Starting refresh...
Height 771 / 34449

錢包資料夾會多出 restorerestore.address.txtrestore.keyrestorerestore.key 是加密後的檔案,沒有你的密碼是解不開的,restore.address.txt 裡面是錢包位址,這些檔案可以放心放在雲端空間上,如果要操作錢包,把這些檔案下載回來,輸入密碼就可以開始操作,很方便。

如果覺得我的文章有幫助到您,可以透過發送加密貨幣到以下地址贊助我:

BTC:1AG6wprRirfBwV4FoYEEbZebGacroh7CHV

ETH:0xe1BCEAa7e2863F58430ace725a79EcEDaE747b07

XMR:45ceB7fA4r4Mo8trRQG6bSYTHmFaYQeA7Q3B192FZLsYfipV4LfRWwNjA72aSgWbhPQQqcxkXmpmi7KZbd1zxCwe3TdHyvm

ETN:etnkKXAv5TaVAnQuhc3ZCg8nJCSnLQYWCNREJwi5QitHiTzDmS179GbBdzLHp2z3bFNsFzrJmjhuHLzX475oEWVr8CgN4AucjM

Reference