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 Javascript software development kit (SDK) that wraps the communication with the comit-network daemon.
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!
The COMIT Javascript SDK enables the integration of the comit-network daemon into Javascript applications. You'll find the latest comit-sdk version on npmjs.
Below you find a short introduction into the SDK. For more detailed information please refer to the API-documentation in our documentation.
The fastest way to get started with the SDK is to take a look at examples using the SDK.
Create a project using create-comit-app and take a look at the generated examples
folder!
The SDK enables you to create Javascript applications on top of COMIT. This can for example be a trustless decentralized exchange (DEX) or a multi-currency wallet.
The SDK offers functionality to negotiate a trade and to execute the trade after the negotiation is finished.
The SDK integrates a simple negotiation protocol that serves as a starting point for makers and takers to create and take orders.
It is recommended to take a look at the TakerNegotiator
and MakerNegotiator
classes to get started.
The negotiation is currently only integrated into the SDK and does not concern the comit-network daemon (cnd
).
cnd
is only used for executing the trade, i.e. preparing transactions necessary for executing the atomic swap and monitoring the respective ledgers of the swap.
For the execution you can use the SDK for communicating with cnd
.
Take a look at the ComitClient
class to get started.
The ComitClient enables you to:
cnd
when available.cnd
when available.(For a refund scenario you would of course be able to receive and send the refund transaction as well.)
The SDK includes two Javascript wallets:
These wallets are used to actually send the transactions necessary for the atomic swap to the respective ledger.
COMIT is designed in a non-custodial way, thus cnd
never holds your private key at any time.
The wallets integrated in the SDK show how the transaction information received from cnd
can be sent to the respective ledger.
Note that you can, of course, use different wallets than the above default wallets in your application.