-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new cli
- Loading branch information
Showing
12 changed files
with
1,407 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
name = "demo-wallet" | ||
version = "0.1.0" | ||
edition = "2021" | ||
description = "Bitcoin and Ethereum minimalist wallet CLI app on top of Gotham City Client" | ||
|
||
[dependencies] | ||
# Common | ||
serde = "1.0" | ||
serde_json = "1.0" | ||
clap = { version = "4.3", features = ["derive"] } | ||
config = "0.13" | ||
|
||
# Etherum | ||
ethers = { version = "2.0", features = ["rustls"] } | ||
tokio = { version = "1", features = ["macros", "rt-multi-thread"] } | ||
eyre = "0.6" | ||
async-trait = "0.1" | ||
thiserror = "1.0" | ||
|
||
# Bitcoin | ||
uuid = { version = "0.7", features = ["v4"] } | ||
bitcoin = "0.27.1" | ||
itertools = "0.11.0" | ||
electrumx_client = { git = "https://github.com/ZenGo-X/rust-electrumx-client.git", tag = "[email protected]"} | ||
kms.workspace = true | ||
two-party-ecdsa.workspace = true | ||
log.workspace = true | ||
hex.workspace = true | ||
|
||
# Client | ||
gotham-client.workspace = true | ||
|
||
|
||
[dev-dependencies] | ||
mockall = "0.11.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
# Demo Wallet | ||
Bitcoin and Ethereum minimalist wallet CLI app on top of Gotham City Client. | ||
|
||
## Requirement | ||
Gotham server is required to interact with the client, for instruction on how to run it see [here](../gotham-server/README.md). | ||
|
||
## Installation | ||
```bash | ||
git clone https://github.com/ZenGo-X/gotham-city.git | ||
cargo run --bin demo-wallet | ||
``` | ||
|
||
## Usage | ||
``` | ||
Commands: | ||
evm EVM-compatible blockchain | ||
bitcoin Bitcoin blockchain | ||
help Print this message or the help of the given subcommand(s) | ||
Options: | ||
-s, --settings <SETTINGS> Settings file [default: settings.toml] | ||
-h, --help Print help | ||
``` | ||
|
||
## Ethereum Wallet | ||
Configuration variables in settings file: | ||
* __rpc_url__ - endpoint to communicate with the Ethereum network. | ||
* __wallet_file__ - file-path to wallet JSON file `[default: wallet.json]`. | ||
* __gotham_server_url__ - URL to Gotham Server`[default: http://127.0.0.1:8000]`. | ||
|
||
### Commands | ||
``` | ||
Usage: demo-wallet evm [OPTIONS] <COMMAND> | ||
Commands: | ||
new Create new MPC EVM wallet | ||
send Broadcast a transaction to the network | ||
transfer Broadcast an ERC20 transfer command to the network | ||
balance Retrieve wallet balance | ||
help Print this message or the help of the given subcommand(s) | ||
Options: | ||
--no-mpc | ||
Disable MPC Gotham wallet, use a wallet instantiated with a locally stored private key | ||
-h, --help | ||
Print help (see a summary with '-h') | ||
``` | ||
|
||
### New wallet | ||
Create new MPC EVM wallet | ||
|
||
``` | ||
Usage: demo-wallet evm new [OPTIONS] --chain-id <CHAIN_ID> | ||
Options: | ||
--chain-id <CHAIN_ID> Network Chain ID | ||
-o, --output <OUTPUT> Output filepath [default: wallet.json] | ||
--hd-path <HD_PATH> Hierarchical Deterministic path | ||
-h, --help Print help | ||
``` | ||
|
||
### Send transaction | ||
Broadcast a transaction to the network | ||
|
||
``` | ||
Usage: demo-wallet evm send [OPTIONS] --to <TO> --amount <AMOUNT> | ||
Options: | ||
--to <TO> Recipient address | ||
--amount <AMOUNT> Amount of Wei to transfer (10^18 Wei = 1 ETH) | ||
--gas-limit <GAS_LIMIT> Maximum amount of gas units this transaction can consume | ||
--gas-price <GAS_PRICE> Amount of Giga-Wei to pay for gas (10^9 Giga-Wei = 1 ETH) | ||
--nonce <NONCE> Sequentially incrementing counter to indicates transaction number | ||
-h, --help Print help | ||
``` | ||
|
||
### Transfer ERC20 | ||
Broadcast an ERC20 transfer command to the network | ||
|
||
``` | ||
Usage: demo-wallet evm transfer [OPTIONS] --token <TOKEN> --to <TO> --amount <AMOUNT> | ||
Options: | ||
--token <TOKEN> ERC20 token address | ||
--to <TO> Recipient address | ||
--amount <AMOUNT> Amount of tokens to transfer | ||
--gas-limit <GAS_LIMIT> Maximum amount of gas units this transaction can consume | ||
--gas-price <GAS_PRICE> Amount of Giga-Wei to pay for gas (10^9 Giga-Wei = 1 ETH) | ||
--nonce <NONCE> Sequentially incrementing counter to indicates transaction number | ||
-h, --help Print help | ||
``` | ||
|
||
### See balance | ||
Retrieve wallet balance | ||
|
||
``` | ||
Usage: demo-wallet evm balance [OPTIONS] | ||
Options: | ||
--tokens <TOKENS> ERC20 token addresses seperated by commas | ||
-h, --help Print help | ||
``` | ||
|
||
## Bitcoin Wallet | ||
Configuration variables in settings file: | ||
* __electrum_server_url__ - endpoint of [Electrum server](https://thebitcoinmanual.com/articles/btc-electrum-server/). | ||
* __wallet_file__ - file-path to wallet JSON file `[default: wallet.json]`. | ||
* __gotham_server_url__ - URL to Gotham Server`[default: http://127.0.0.1:8000]`. | ||
|
||
### Commands | ||
``` | ||
Usage: demo-wallet bitcoin <COMMAND> | ||
Commands: | ||
create-wallet Create an MPC Bitcoin wallet | ||
new-address Generate a new address | ||
get-balance Total balance | ||
list-unspent List unspent transactions (tx hash) | ||
send Send a transaction | ||
backup Private share backup | ||
verify Backup verification | ||
help Print this message or the help of the given subcommand(s) | ||
Options: | ||
-h, --help | ||
Print help (see a summary with '-h') | ||
``` | ||
|
||
### New wallet | ||
Create an MPC Bitcoin wallet | ||
|
||
``` | ||
Usage: demo-wallet bitcoin create-wallet [OPTIONS] | ||
Options: | ||
-n, --network <NETWORK> Bitcoin network [bitcoin|testnet|signet|regtest] [default: testnet] | ||
-o, --output <OUTPUT> Output filepath [default: wallet.json] | ||
-e, --escrow-path <ESCROW_PATH> Escrow filepath [default: escrow-bitcoin.json] | ||
-h, --help Print help | ||
``` | ||
|
||
### New Address | ||
Generate a new address | ||
|
||
``` | ||
Usage: demo-wallet bitcoin new-address | ||
Options: | ||
-h, --help Print help | ||
``` | ||
### Get Balance | ||
Retrieve total wallet balance | ||
|
||
``` | ||
Usage: demo-wallet bitcoin get-balance | ||
Options: | ||
-h, --help Print help | ||
``` | ||
|
||
### Unspent transactions | ||
List unspent transactions (tx hash) | ||
|
||
``` | ||
Usage: demo-wallet bitcoin list-unspent | ||
Options: | ||
-h, --help Print help | ||
``` | ||
|
||
### Send | ||
Send a transaction | ||
|
||
``` | ||
Usage: demo-wallet bitcoin send --to <TO> --amount <AMOUNT> | ||
Options: | ||
-t, --to <TO> Recipient | ||
-a, --amount <AMOUNT> Amount in BTC | ||
-h, --help Print help | ||
``` | ||
|
||
|
||
### Backup | ||
Private share backup | ||
|
||
``` | ||
Usage: demo-wallet bitcoin backup [OPTIONS] | ||
Options: | ||
-b, --backup-path <BACKUP_PATH> Backup filepath [default: backup-bitcoin.json] | ||
-e, --escrow-path <ESCROW_PATH> Escrow filepath [default: escrow-bitcoin.json] | ||
-h, --help Print help | ||
``` | ||
|
||
### Verify | ||
Backup verification | ||
|
||
``` | ||
Usage: demo-wallet bitcoin verify [OPTIONS] | ||
Options: | ||
-b, --backup-path <BACKUP_PATH> Backup filepath [default: backup-bitcoin.json] | ||
-e, --escrow-path <ESCROW_PATH> Escrow filepath [default: escrow-bitcoin.json] | ||
-h, --help Print help | ||
``` |
Oops, something went wrong.