No description, website, or topics provided.
Clone or download
Latest commit 0754e0a Nov 29, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
btcUtils update test case Nov 29, 2018
docs update doc Aug 29, 2018
logger update btc Aug 17, 2018
tests update test case Nov 29, 2018
.gitignore add tests Nov 29, 2018
LICENSE Initial commit Jun 21, 2018 Update readme. Nov 2, 2018
cli.js update test case Nov 29, 2018
config.js Merge branch 'wanchain30_release' of… Nov 29, 2018
package.json add tests Nov 29, 2018



1) node version v8.11.3 or higher
2) npm  version 5.6.0 or higher

How to install cli wallet?

	mkdir -p <workspace>
	cd <workspace>
	git clone

	cd <workspace>/wanchain-crosschain-walletcli
	git checkout -b wanchain30_release origin/wanchain30_release
	npm install

How to start cli wallet?

	cd <workspace>/wanchain-js-walletcli

	node cli.js
	node cli.js --testnet


How to use cli wallet ?


Commands supported by cli wallet:

1. help [command...]    Provides help for a given command.
2. exit                 Exits application.
3. createBtcAddress     create new bitcoin address
4. createWanAccount     create new wan address
5. listBtcAddress       get bitcoin address list
6. getBtcBalance        get bitcoin address balance
7. listWbtcBalance      get wbtc address balance
8. listWanBalance       list wanchain address balances
9. listStoremanGroups   get all storeman
10. listTransactions     list all transasctions
11. sendBtcToAddress     bitcoin normal transaction
12. lockBtc              crosschain lockBtc
13. redeemBtc            crosschain redeemBtc
14. revokeBtc            crosschain revokeBtc
15. lockWbtc             crosschain lockWbtc
16. redeemWbtc           crosschain redeemWbtc
17. revokeWbtc           crosschain revokeWbtc


Example 1: (Lock on BTC chain, redeem on WAN chain)

Alice has BTC and WAN coins in her btc account and wan account. She wants to cross BTC from BTC chain to WAN chain. Firstly she needs lock BTC on the source chain(here the source chain is BTC), and redeem her BTC on the destination chain
(here the destination chain is WAN).

Select source storeman by input the index.
wallet-cli$ lockBtc
stroeman address
1: 0x83e5ca256c9ffd0ae019f98e4371e67ef5026d2d
Input the index or StoremanGroup: 1

Select the dest wan account index
WAN address                                                  balance               wbtc balance
1: 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec    9661.815699024684892751                  0.2440179
2: 0x08eaafb273fe6b85c7849abb4fee3b2404aaf9fa                          6                          0
3: 0x78e1ae33016e3a3037e209be461dcd4bc082ab4d       4.127392653589797188                          0
4: 0xb986080afcbf51152f086732cab9b52c277ee7c7                       0.01                          0
5: 0x844e6137bf3302dfc7068318eaf393325f4000fa                          0                          0
Input the index: 1

Input transfer amount, and password

Input transaction amount(>=0.002):0.002
wait a moment...
transaction Sign ChainType :  WAN
sendWanNotice txHash: 0x1869a5451bb2adaaeffc3ae1470ba1888cc3300b8d723f818717a745701ba1f8

wallet-cli$ redeemBtc
No transaction for redeem found. Please try later.

    After lock token done, Alice should wait some minutes. She can use listTransaction command to check the status, when status change to waitingX, it mean's ready for redeem.

Example 2: (Check Alice's balance)

step1: check token amount on source chain.

wallet-cli$ getBtcBalance
wait a moment...
btcBalance: 0.0098193

step2: check token amount on destination chain.
wallet-cli$ listWbtcBalance
         WAN address                                               WBTC balance
1: 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec                  0.2440179
2: 0x08eaafb273fe6b85c7849abb4fee3b2404aaf9fa                          0
3: 0x78e1ae33016e3a3037e209be461dcd4bc082ab4d                          0
4: 0xb986080afcbf51152f086732cab9b52c277ee7c7                          0
5: 0x844e6137bf3302dfc7068318eaf393325f4000fa                          0

Example 3 (list transaction detailed info.) wallet-cli$ listTransaction

wait a moment...
   from                                       to                                    value     status      chain
1: mkcCxUf5WieTXxPLrXBrbCrUxoWCn1tKyG 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec 0.0020001 BTC revokeFinished        BTC
   from                                       to                                    value     status      chain
2: mkcCxUf5WieTXxPLrXBrbCrUxoWCn1tKyG 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec 0.0020001 BTC revokeFinished        BTC
   from                                       to                                    value     status      chain
3: mkcCxUf5WieTXxPLrXBrbCrUxoWCn1tKyG 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec 0.0020001 BTC revokeFinished        BTC
   from                                       to                                    value     status      chain
4: mkcCxUf5WieTXxPLrXBrbCrUxoWCn1tKyG 0x8c2a45ddcd08b546d19f9aefd9f7aaba9d9237ec 0.0020001 BTC redeemFinished        BTC

Example 4 (Revoke on source chain)

After Alice lock token on source chain, she change her mind. Now ,she can revoke this transaction on source chain. She can revoke after the revoke time arrived. when the transaction's status changed to waitingRevoke.

wallet-cli$ revokeBtc
select the transaction which to revoke, and input password.

How to perform a reverse transaction.

The reverse transaction which from wbtc to btc use the command of :