0.1.11 • Published 5 months ago

@covenance/dlc v0.1.11

Weekly downloads
-
License
MIT
Repository
-
Last release
5 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

5 months ago

0.1.10

5 months ago

0.1.9

5 months ago

0.1.8

5 months ago

0.1.7

5 months ago

0.1.6

5 months ago

0.1.5

5 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago