dlc

module
v0.0.0-...-1c741c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2019 License: MIT

README

Discreet Log Contracts (DLC)

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 ./...

License

MIT License

Directories

Path Synopsis
cmd
internal
rpc
Package rpc project rpc.go
Package rpc project rpc.go
wallet
Package wallet provides the the bitcoin wallet features necessary for implementing DLCs.
Package wallet provides the the bitcoin wallet features necessary for implementing DLCs.
pkg
dlc
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL