0.1.11 • Published 9 months ago

@covenance/dlc v0.1.11

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Covenance DLC

CI

A TypeScript library implementing cryptographic primitives for Discreet Log Contracts (DLCs) in the Covenance project.

Installation

TODO: Configure private NPM repo on GitHub.

Usage

Oracle Functions

import { commitToEvent, attestEventOutcome } from 'covenance-dlc';

// Oracle commits to an event
const { signaturePoints, nonce } = commitToEvent(
  eventOutcomeHashes,
  oraclePubKey
);

// Oracle attests to an event outcome
const oracleSig = attestEventOutcome(
  oraclePrivKey,
  nonce,
  eventOutcomeHash
);

Counterparty Functions

import { createAdaptorSig, adaptSig, verifyAdaptorSig } from 'covenance-dlc';

// Create an adaptor signature
const adaptorSig = createAdaptorSig(
  counterpartyPrivKey,
  oracleSigPoint,
  cetSighash
);

// Verify an adaptor signature
const isValid = verifyAdaptorSig(
  adaptorSig,
  counterpartyPubKey,
  cetSighash,
  oracleSigPoint
);

// Adapt a signature
const finalSig = adaptSig(adaptorSig, oracleSig);

Development

Setup

npm install

Building

npm run build

Testing

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

Linting

npm run lint
0.1.11

9 months ago

0.1.10

9 months ago

0.1.9

10 months ago

0.1.8

10 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago