This repository contains the reference implementation of the protocol written in Rust.
The Rust reference implementation of the COMIT protocol (comit-rs) implements atomic swaps using constructs like Hash Time-Locked Contracts (HTLCs) to keep your funds safe at any time.
This repository is a cargo workspace:
cnd: a non-custodial COMIT network daemon, designed to be driven by a client with wallets (f.e. Ambrosia)
nectar: a custodial COMIT network daemon, designed for automated trades
comit: a library implementing primitives of the COMIT protocol like libp2p-protocols, the decentralized orderbook and locking- as well as swap-protocols
nectar are released as binaries.
comit library will be released to crates.io once its interface stabilizes.
Setup build environment
All you need is
curl https://sh.rustup.rs -sSf | sh
cargo build --release --package cnd
cargo build --release --package nectar
nectar require a connection to a Bitcoin and an Ethereum full node.
All config file options have sensible defaults but can also be overridden.
cnd dump-config or
nectar dump-config for more information.
Setup testing/dev environment
node(check the version required in tests/package.json) &
makein the root folder of the repository, this will install various crates & tools such as clippy.
make testis just a wrapper around
cargo test --all
make e2ewill run all the end-to-end tests
To run individual end-to-end tests, use
yarn inside the
yarn run test: run all tests
yarn run test <directory>: run all tests in the directory
yarn run test <path to test file>: run all tests in this test file, supports shell glob on the path
yarn run fix: run prettier and linter to fix format
yarn run check: run tsc (to check validity of TypeScript code) and verify format
Cnd over Tor
If you would like to maintain anonymity while using
cnd for atomic swaps we support running
cnd over Tor.
You will need to configure an onion service (previously hidden service), virtual port can be anything but
cnd expects the local port to be 9939.
HiddenServiceDir /var/lib/tor/hidden_service/ HiddenServicePort 9939 127.0.0.1:9939
After starting Tor for the first time get the onion service address from your local file system (e.g.
/var/lib/tor/hidden_service/hostname) and add it to your cnd config file.
[network] listen = ["/onion3/vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd:9939"]
cnd traffic will now be routed over the Tor network.
Contributions are welcome, please visit CONTRIBUTING for more details.
If you have any question please reach out to the team in our Gitter chat!
This project is licensed under the terms of the GNU GENERAL PUBLIC LICENSE v3.