da-kami / comit-rs

Reference implementation of COMIT, an open protocol facilitating trustless cross-blockchain applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

COMIT logo

COMIT is an open protocol facilitating cross-blockchain applications. For example, with COMIT you can exchange Bitcoin for Ether or any ERC20 token directly with another person.

This repository contains the implementation of the comit-network daemon (cnd), which is the reference implementation of the protocol written in Rust.

If you wish to do an atomic swap on your machine or to integrate COMIT into an application (e.g. a DEX) please take a look at the Getting Started section of the COMIT documentation. If you have any questions, feel free to reach out to the team in our Gitter chat!

GitHub Action CI on dev Safety Dance Bors enabled License: GPL v3 Gitter chat

comit-rs

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.

Structure

This repository is a cargo workspace:

  • cnd: implementation of the comit-network daemon
  • libp2p-comit: implementation of the comit messaging protocol on top of libp2p

cnd is released as binary including libp2p-comit.

Setup build environment

All you need is love rust: curl https://sh.rustup.rs -sSf | sh

Build & Run

  1. make install
  2. startup bitcoin node with -regtest and -rest
  3. startup ethereum node with JSON-RPC interface exposed at localhost:8545
  4. startup cnd: cnd (or ./target/release/cnd if you do not have the ~/.cargo/bin folder in your $PATH)

Keep in mind that in order to do a swap locally you will need to start two instances of cnd. Please see cnd --help for help with command line options.

Setup testing/dev environment

  1. Install docker,
  2. Install node (check the version required in api_tests/package.json) & yarn,
  3. Run make in the root folder of the repository, this will install various crates & tools such as clippy.

Testing

  • make test is just a wrapper around cargo test --all
  • make e2e will run all the end-to-end tests

To run individual end-to-end tests, use yarn inside the api_tests folder:

  • 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

Contributing

Contributions are welcome, please visit CONTRIBUTING for more details.

If you have any question please reach out to the team in our Gitter chat!

License

This project is licensed under the terms of the GNU GENERAL PUBLIC LICENSE v3.

About

Reference implementation of COMIT, an open protocol facilitating trustless cross-blockchain applications.

License:GNU General Public License v3.0


Languages

Language:Rust 79.7%Language:TypeScript 18.7%Language:Shell 0.8%Language:Makefile 0.4%Language:TSQL 0.3%Language:JavaScript 0.1%Language:Dockerfile 0.0%