From 9b0467d43a91cc912b15ac66fb2390a4bd6a625a Mon Sep 17 00:00:00 2001 From: rishflab Date: Thu, 1 Apr 2021 15:13:29 +1100 Subject: [PATCH] Remove default connection details from CLI Connecting buyers to us by default is not consistent with our vision of a decentralised network of sellers. Closes #395 --- CHANGELOG.md | 7 +++++++ README.md | 8 +++++++- swap/src/cli/command.rs | 42 +++-------------------------------------- 3 files changed, 17 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f96cedf4..6ea1192a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Automatic resume of unfinished swaps for the `asb` upon startup. Unfinished swaps from earlier versions will be skipped. +### Changed + +- Require the buyer to specify the connection details of the peer they wish to swap with. + Throughout the public demo phase of this project, the CLI traded with us by default if the peer id and multiaddress of the seller were not specified. + Having the defaults made it easy for us to give something to the community that can easily be tested, however it is not aligned with our long-term vision of a decentralised network of sellers. + We have removed these defaults forcing the user to specify the seller they wish to trade with. + ### Fixed - An [issue](https://github.com/comit-network/xmr-btc-swap/issues/353) where the `swap` CLI would fail on systems that were set to a locale different than English. diff --git a/README.md b/README.md index 4d710664..ca390187 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,13 @@ More information about the protocol in this [presentation](https://youtu.be/Jj8r ## Quick start - CLI 1. Download the [latest `swap` binary release](https://github.com/comit-network/xmr-btc-swap/releases/latest) for your operating system -2. Run the binary: `./swap buy-xmr --receive-address ` +2. Run the binary specifying the monero address where you wish to receive monero and the connection details of the seller: + `./swap buy-xmr --receive-address --seller-peer-id --seller-multiaddr ` + You can generate a receive address using your monero wallet. + The seller will provide you their peer id and multiaddress. + We are running an `asb` instance on testnet. + You can swap with to get familiar with the `swap` CLI. + Our peer id is `12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi` and our multiaddress is `/dns4/xmr-btc-asb.coblox.tech/tcp/9876` 3. Follow the instructions printed to the terminal ## Limitations diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index ae76e80b..295dbfd0 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -7,9 +7,6 @@ use std::str::FromStr; use url::Url; use uuid::Uuid; -pub const DEFAULT_ALICE_MULTIADDR: &str = "/dns4/xmr-btc-asb.coblox.tech/tcp/9876"; -pub const DEFAULT_ALICE_PEER_ID: &str = "12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi"; - // Port is assumed to be stagenet standard port 38081 pub const DEFAULT_STAGENET_MONERO_DAEMON_HOST: &str = "monero-stagenet.exan.tech"; @@ -37,18 +34,10 @@ pub struct Arguments { pub enum Command { /// Start a XMR for BTC swap BuyXmr { - #[structopt( - long = "seller-peer-id", - default_value = DEFAULT_ALICE_PEER_ID, - help = "The peer id of a specific swap partner can be optionally provided" - )] + #[structopt(long = "seller-peer-id", help = "The seller's peer id")] alice_peer_id: PeerId, - #[structopt( - long = "seller-addr", - default_value = DEFAULT_ALICE_MULTIADDR, - help = "The multiaddr of a specific swap partner can be optionally provided" - )] + #[structopt(long = "seller-addr", help = "The seller's multiaddress")] alice_multiaddr: Multiaddr, #[structopt(long = "electrum-rpc", @@ -70,11 +59,7 @@ pub enum Command { )] swap_id: Uuid, - #[structopt( - long = "seller-addr", - default_value = DEFAULT_ALICE_MULTIADDR, - help = "The multiaddr of a specific swap partner can be optionally provided" - )] + #[structopt(long = "seller-addr", help = "The seller's multiaddress")] alice_multiaddr: Multiaddr, #[structopt(long = "electrum-rpc", @@ -173,24 +158,3 @@ fn parse_monero_address(s: &str) -> Result { ) }) } - -#[cfg(test)] -mod tests { - use crate::cli::command::{DEFAULT_ALICE_MULTIADDR, DEFAULT_ALICE_PEER_ID}; - use libp2p::core::Multiaddr; - use libp2p::PeerId; - - #[test] - fn parse_default_alice_peer_id_success() { - DEFAULT_ALICE_PEER_ID - .parse::() - .expect("default alice peer id str is a valid PeerId"); - } - - #[test] - fn parse_default_alice_multiaddr_success() { - DEFAULT_ALICE_MULTIADDR - .parse::() - .expect("default alice multiaddr str is a valid Multiaddr>"); - } -}