https://github.com/p2pderivatives/dlc
Discreet Log Contracts library
https://github.com/p2pderivatives/dlc
bitcoin smartcontract
Last synced: 6 months ago
JSON representation
Discreet Log Contracts library
- Host: GitHub
- URL: https://github.com/p2pderivatives/dlc
- Owner: p2pderivatives
- License: mit
- Created: 2018-10-17T07:44:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-08T07:43:26.000Z (over 4 years ago)
- Last Synced: 2023-07-10T20:36:37.193Z (almost 3 years ago)
- Topics: bitcoin, smartcontract
- Language: Go
- Size: 354 KB
- Stars: 30
- Watchers: 10
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discreet Log Contracts (DLC)
[](https://circleci.com/gh/p2pderivatives/dlc)
Discreet Log Contracts (DLC) are smart contracts proposed by Thaddeus Dryja in [this paper](https://adiabat.github.io/dlc.pdf), 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](https://medium.com/@gertjaap/discreet-log-contracts-invisible-smart-contracts-on-the-bitcoin-blockchain-cc8afbdbf0db) or [the paper](https://adiabat.github.io/dlc.pdf).
## Examples
### Communication between 3 parties
[This sample code](https://github.com/p2pderivatives/dlc/blob/master/test/integration/dlc_test.go) 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](https://github.com/p2pderivatives/dlc/blob/master/test/integration/oracle_test.go) 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](./docs/How-to-create-DLC.md) for detailed steps.
## Development
### Setup
### Install dependencies
```
dep ensure
```
### Run test
```
go test ./...
```
## License
[MIT License](https://github.com/p2pderivatives/dlc/blob/master/LICENSE)