signer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

Signer Node

The signer runs a threshold Boneh-Lynn-Shacham (BLS) signatures DKG, which generates a collective public key and a secret share for each node respectively. For n total signers, the threshold t = n * 2 / 3 + 1.

Each signer node runs independently and doesn't have direct network connection with other nodes. They broadcast messages to a Mixin Messenger group chat which includes all the signers to exchange key generation information.

Setup Key

After all entities have reach a consensus, each entity should prepare a signer key and then forms a list of signer keys. To generate a key pair, run the command:

$ tip key
2bd462c1f02fa96234...3b6560fe308d5c6e74
5JhLbaTYCXbqFxibfX19GW...cTBg1UDpQ9xfMxXxtnzQS1

Then put the private key to [node].key section of config/example.toml, and share the public key with all other entities. After all entities make their public keys exchanged, they should sort the keys list in the same order and put them to [node].signers.

Setup Messenger

Go to the Mixin Messenger developers dashboard and create a bot for the signer, then in the secret section generate an Ed25519 session. Edit config/example.toml, and put client_id to [messenger].user, session_id to [messenger].session, and private_key to [messenger].key.

Then all the entities should add all their bots to a Mixin Messenger group chat, then send the link https://mixin.one/context to the group chat and open it to obtain a UUID, which is the [messenger].conversation value.

Run Signer DKG

Change [store].dir to a secure and permanent directory, this is where the signer database resides. Then the config/example.toml is finished, put it to a proper path, e.g. ~/.tip/config.toml.

$ tip -c ~/.tip/config.toml signer

All entities should run the command above to prepare for the DKG process, and after all entities have started the node, all of them should run the command below.

$ tip -c ~/.tip/config.toml setup -nonce 887378

This command sends out the DKG setup signal to the Mixin Messenger group chat, and after enough signals received, the DKG starts. The nonce value must be a large number and all entities should use the same one.

If the DKG finishes successfully, the node will exit with the output similar to below message.

runDKG 5cc8735afb....b34b4 000000035...f43fd402

The first and long hex is the commitments for the collective public key, and all entities should share it with others to ensure their nodes produce identical public key. The second and short hex is the private share, which should not be shared to anyone else, and must have a secure backup.

If some node fails to produce the same public key, all the entities should remove the failed database and restart the DKG setup process until success.

Run Signer API

After the DKG process successfully, all nodes should start the signer API to accept signing requests from users.

$ tip -c ~/.tip/config.toml api

It's highly recommended to make a firewall and reverse proxy to hide the actual API server from public.

Documentation

Index

Constants

View Source
const (
	MessageActionSetup       = 7000
	MessageActionDKGDeal     = 7001
	MessageActionDKGResponse = 7002
	MessageActionDKGJustify  = 7003

	MessageSetupPeriodSeconds = 300
)

Variables

This section is empty.

Functions

func MakeSetupMessage

func MakeSetupMessage(ctx context.Context, key kyber.Scalar, nonce uint64) []byte

Types

type Board

type Board struct {
	// contains filtered or unexported fields
}

func (*Board) IncomingDeal

func (t *Board) IncomingDeal() <-chan dkg.DealBundle

func (*Board) IncomingJustification

func (t *Board) IncomingJustification() <-chan dkg.JustificationBundle

func (*Board) IncomingResponse

func (t *Board) IncomingResponse() <-chan dkg.ResponseBundle

func (*Board) PushDeals

func (t *Board) PushDeals(db *dkg.DealBundle)

func (*Board) PushJustifications

func (t *Board) PushJustifications(jb *dkg.JustificationBundle)

func (*Board) PushResponses

func (t *Board) PushResponses(rb *dkg.ResponseBundle)

type Configuration

type Configuration struct {
	Key     string   `toml:"key"`
	Signers []string `toml:"signers"`
}

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(b []byte) *Decoder

func (*Decoder) Read

func (dec *Decoder) Read(b []byte) error

func (*Decoder) ReadBool

func (dec *Decoder) ReadBool() (bool, error)

func (*Decoder) ReadBytes

func (dec *Decoder) ReadBytes() ([]byte, error)

func (*Decoder) ReadInt

func (dec *Decoder) ReadInt() (int, error)

func (*Decoder) ReadUint32

func (dec *Decoder) ReadUint32() (uint32, error)

func (*Decoder) ReadUint64

func (dec *Decoder) ReadUint64() (uint64, error)

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) Write

func (enc *Encoder) Write(b []byte)

func (*Encoder) WriteBool

func (enc *Encoder) WriteBool(b bool)

func (*Encoder) WriteFixedBytes

func (enc *Encoder) WriteFixedBytes(b []byte)

func (*Encoder) WriteInt

func (enc *Encoder) WriteInt(d int)

func (*Encoder) WriteUint32

func (enc *Encoder) WriteUint32(d uint32)

func (*Encoder) WriteUint64

func (enc *Encoder) WriteUint64(d uint64)

type Message

type Message struct {
	Action    int
	Sender    string
	Data      []byte
	Signature []byte
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(ctx context.Context, cancel context.CancelFunc, store store.Storage, messenger messenger.Messenger, conf *Configuration) *Node

func (*Node) GetKey

func (node *Node) GetKey() kyber.Scalar

func (*Node) GetPoly

func (node *Node) GetPoly() []kyber.Point

func (*Node) GetShare

func (node *Node) GetShare() *share.PriShare

func (*Node) GetSigners

func (node *Node) GetSigners() []dkg.Node

func (*Node) NewBoard

func (node *Node) NewBoard(ctx context.Context, nonce uint64) *Board

func (*Node) NextPhase

func (node *Node) NextPhase() chan dkg.Phase

func (*Node) Run

func (node *Node) Run(ctx context.Context) error

func (*Node) Threshold

func (node *Node) Threshold() int

type SetupBundle

type SetupBundle struct {
	Nonce     uint64
	Timestamp time.Time
}

Jump to

Keyboard shortcuts

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