Node-DLC is a an implementation of Bitcoin DLC Protocol in the Node.js runtime, with CET signature generation achieved with cfd-dlc wrapper (written in C++).
- @node-dlc/cli
- @node-dlc/core
- @node-dlc/logger
- @node-dlc/messaging
- @node-dlc/rocksdb
- @node-dlc/transport
Many elements of the project as well as components are inspired by Node-Lightning, an Node.js implementation of the Bitcoin Lightning Network. The project also uses several packages such as:
- @node-lightning/bitcoin
- @node-lightning/bufio
- @node-lightning/core
- @node-lightning/crypto
- @node-lightning/gossip-rocksdb
- @node-lightning/logger
- @node-lightning/wire
@node-dlc/messaging
and @node-dlc/core
packages implement many aspects of the DLC Specification
Note: These packages contains functionality for message generation, serialization and deserialization and contain no logic for wallet functionality For DLC wallet functionality, you can check out Chainify-Finance which uses Node-DLC messaging functionality and Liquality Chainify wallet functionality to enable easy creation of wallets with the capability of entering into DLCs.
Implemented features:
- Dlc Offer, Accept, Sign V0 message support
- Oracle Announcement and Attestation V0 message support
- ContractInfo V0 and V1 message support (multi oracle message support)
- Enum Event Descriptor and Digit Decomposition Event Descriptor V0 message support
- Numeric Outcome message and payout generation support
- Polynomial (linear) payout message and curve support
- Hyperbola (1/x) shaped payout message and curve support
- Dlc Close V0 message support from mutual close proposal
Missing features:
- Backwards compatibility with (messaging and serialization proposal)[discreetlogcontracts/dlcspecs#171]
- V0 Oracle Changes message types proposal
yarn install
yarn bootstrap
yarn test
yarn build
import { OracleAnnouncementV0 } from '@node-dlc/messaging';
const buf = Buffer.from(
'fdd824fd02ab1efe41fa42ea1dcd103a0251929dd2b192d2daece8a4ce4d81f68a183b750d92d6f02d796965dc79adf4e7786e08f861a1ecc897afbba2dab9cff6eb0a81937eb8b005b07acf849ad2cec22107331dedbf5a607654fad4eafe39c278e27dde68fdd822fd02450011f9313f1edd903fab297d5350006b669506eb0ffda0bb58319b4df89ac24e14fd15f9791dc78d1596b06f4969bdb37d9e394dc9fedaa18d694027fa32b5ea2a5e60080c58e13727367c3a4ce1ad65dfb3c7e3ca1ea912b0299f6e383bab2875058aa96a1c74633130af6fbd008788de6ac9db76da4ecc7303383cc1a49f525316413850f7e3ac385019d560e84c5b3a3e9ae6c83f59fe4286ddfd23ea46d7ae04610a175cd28a9bf5f574e245c3dfe230dc4b0adf4daaea96780e594f6464f676505f4b74cfe3ffc33415a23de795bf939ce64c0c02033bbfc6c9ff26fb478943a1ece775f38f5db067ca4b2a9168b40792398def9164bfe5c46838472dc3c162af16c811b7a116e9417d5bccb9e5b8a5d7d26095aba993696188c3f85a02f7ab8d12ada171c352785eb63417228c7e248909fc2d673e1bb453140bf8bf429375819afb5e9556663b76ff09c2a7ba9779855ffddc6d360cb459cf8c42a2b949d0de19fe96163d336fd66a4ce2f1791110e679572a20036ffae50204ef520c01058ff4bef28218d1c0e362ee3694ad8b2ae83a51c86c4bc1630ed6202a158810096726f809fc828fafdcf053496affdf887ae8c54b6ca4323ccecf6a51121c4f0c60e790536dab41b221db1c6b35065dc19a9d31cf75901aa35eefecbb6fefd07296cda13cb34ce3b58eba20a0eb8f9614994ec7fee3cc290e30e6b1e3211ae1f3a85b6de6abdbb77d6d9ed33a1cee3bd5cd93a71f12c9c45e385d744ad0e7286660305100fdd80a11000200076274632f75736400000000001109425443205072696365',
'hex',
);
const instance = OracleAnnouncementV0.deserialize(buf);