DCRM SDK

DCRM SDK BETA

Note : dcrm-sdk is considered beta software. We make no warranties or guarantees of its security or stability.*

Github repo: https://github.com/fsn-dev/dcrm-sdk

Introduction

DCRM SDK is a distributed key generation and distributed signature module that forms the cornerstone of decentralized value exchange. This technology was developed for over a year, with the feedback of 4 leading cryptographers: Rosario Gennaro, Steven Goldfeder, Pascal Paillier, Louis Goubin.

When used in context of blockchain, this module can serve as a non-custodial solution, a keyless wallet, a component to an interoperable solution, and more. Please read the Wiki for more information.

This SDK allows you to connect to DCRM's network directly in either:

  1. a 2+1 configuration where you form a private group with 2 fusion nodes and your own node.

  2. a local configuration where you can set any ownership of nodes in your group.

This library contains 2 functions:

  1. Distributed key generation which returns the public key (dcrm_genPubkey)

  2. Distributed signing of transactions (dcrm_sign)

Prerequisites

  1. Linux terminal

  2. Golang ^1.12

Setting Up

Clone The Repository

To get started, launch your terminal and download the latest version of the SDK.

Build

Next compile the code. Make sure you are in /dcrm-sdk directory.

config file

cmd/conf.toml (bin/cmd/conf.toml)

Run

Open access to the APIs by running the compiled code.

The gdcrm will provide two RPC APIs:

  1. dcrm_genPubkey

  2. dcrm_sign

The default RPC port is port 5559.

Note:

  1. If you want to call RPC API, please wait at least 2 minutes after running the node.

  2. If you want to call RPC API quickly more than once,please wait longer.

JSON RPC API

dcrm_genPubkey

This API return a public key which distributed generated by the P2P network's nodes.

Parameters

None

Return

error - Error info.

pubkey - DCRM public key generated by the P2P network's nodes.

Example

dcrm_sign

This API return a signature which distributed signed by the P2P network's nodes.

Parameters

  1. DATA,pubkey - the pubkey from dcrm_genPubkey returned.

  2. String,HexNumber - the message hash to be signed. The format is 32-bit hexadecimal string appended with prifex "0x". For example: 0x19b6236d2e7eb3e925d0c6e8850502c1f04822eb9aa67cb92e5004f7017e5e41.

Return

error - Error info.

rsv - The signature string which distributed signed by the P2P network's nodes.

Example

Run Local

The SDK can also be configured to run locally, where the user can control ownership of all nodes in the P2P network.

Run bootnode

will print bootnode which use for run node with args --bootnodes bootnode key such as enode://16ab118525ec559dde2640b513676b8df7368aac3a80cc5c9d9e8b9c71781c09103fe3e8b5dd17bf245f0c71b891ec4848b142852763ab2146a1e288df15da40@127.0.0.1:5550

The default bootnode parameters are:

  1. addr: 5550

  2. group: 0 (group mode)

  3. nodes: 3 (group's nodes number)

Run nodes (3 nodes at least)

The Default setup parameters are:

  1. nodekey: node.key

  2. rpcport: 5559

  3. port: 5551

  4. bootnodes: "enode://16ab118525ec559dde2640b513676b8df7368aac3a80cc5c9d9e8b9c71781c09103fe3e8b5dd17bf245f0c71b891ec4848b142852763ab2146a1e288df15da40@127.0.0.1:5550"

Note: If you want to reboot a node, please wait 1 minute after closing node before restarting the node.

Setup the node's key:

Start three nodes with custom parameters:

After bootnode and three nodes started, use curl connect to the node's rpc port, test dcrm_genPubkey and dcrm_sign APIs.

Last updated

Was this helpful?