Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Bet-BTC/go-dlc

Repository files navigation

Discreet Log Contracts (DLC) [GO] ⚡

CircleCI

Discreet Log Contracts (DLC) are smart contracts proposed by Thaddeus Dryja in this paper, which allow you to facilitate conditional payment on Bitcoin. This library is an experimental implementation of DLC, aimed to be used in the Bitcoin mainnet, and not ready for production.

Overview

This contract schema involves three parties, 2 contractors and an oracle. We call the 2-contractors Alice and Bob, and the oracle Olivia.

  • Alice and Bob
    • They want to make a future contract
    • They trust a message fixed and signed by Olivia
  • Olivia
    • Olivia publishes messages and signs of them

You can read more details in this article or the paper.

Examples

Communication between 3 parties

This sample code demonstrates how 3 parties communicate. An oracle Olivia publishes a n-digit number lottery result everyday, and Alice and Bob bet on the lottery.

In the tese, the following scenarios are tested.

  • Alice and Bob make contracts and execute a fixed one.
  • Oracle does't publish a valid message and sign, and contractors refund their funding transactions.

Communication between a contractor and an oracle

This sample code demonstrates how a contractor Alice communicates with an oracle Olivia. Olivia publishes a various weather information, but Alice uses only some of the info. Contractors can choose which messages to use, and oracle doesn't know which messages are used in contracts (conditions of contracts).

Try DLC contract using CLI

You can create DLC contract using CLI. See this tutorial for detailed steps.

Development

Setup

Install dependencies

dep ensure

Run test

go test ./...

Roadmap

  • Recompile Code
  • Tests
  • Mainnet production
  • BOLT11/BOLT2
  • Release Go packages

License

MIT License