Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/01_concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Concepts

## RandApp

RandApp is an upgrade to BaseApp that can store DKG-related messages and provides a querying interface for those messages. If you need to track messages sent by DKG participants (e.g. for accountability), you need to store those messages on-chain; this functionality is implemented by RandApp. Saved messages are kept with information about the DKG round that they belong to.
3 changes: 3 additions & 0 deletions docs/02_state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# State

The application just uses standard KVStores to keep its data.
27 changes: 27 additions & 0 deletions docs/03_messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Messages

## MsgSendDKGData

`MsgSendDKGData` message is the only message used by the module. It holds the seed and sender address.

| **Field** | **Type** | **Description** |
|:----------|:---------------------------------------------------------|:-------------------------------------------------------------|
| Owner | `sdk.AccAddress` | The account address of the user sending the message. |
| Data | `github.com/corestario/dkglib/lib/alias.DKGData` | DKG data itself (see below) |

``` go
type MsgSendDKGData struct {
Data *alias.DKGData `json:"data"`
Owner sdk.AccAddress `json:"owner"`
}

type DKGData struct {
Type DKGDataType
Addr []byte
RoundID int
Data []byte // Data is going to keep serialized kyber objects.
ToIndex int // ID of the participant for whom the message is; might be not set
NumEntities int // Number of sub-entities in the Data array, sometimes required for unmarshaling.
Signature []byte //Signature for verifying data
}
```
11 changes: 11 additions & 0 deletions docs/04_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Events

The reseeding module emits the following events:

## Handlers

### MsgSendDKGData

| Type | Attribute Key | Attribute Value |
|-------------------------|----------------------|--------------------|
| EventAdDKGDataFailed | error | {error} |
3 changes: 3 additions & 0 deletions docs/05_future_improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Future Improvements

We might want to implement deleting messages from the application (because those messages can add up pretty fast).
1 change: 1 addition & 0 deletions docs/06_appendix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Appendix
83 changes: 83 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
## Reseeding module

## Contents

1. **[Concepts](./01_concepts.md)**
2. **[State](./02_state.md)**
3. **[Messages](./03_messages.md)**
4. **[Events](./04_events.md)**
5. **[Future Improvements](./05_future_improvements.md)**

# CoreStarIO RandApp

CoreStarIO RandApp is Cosmos-based SDK, designed for easier building blockchain
applications using on-chain DKG algorithm in Golang.


More about [cosmos-sdk](https://github.com/cosmos/cosmos-sdk).


Notable source code files to check out about DKG:

1. https://github.com/corestario/tendermint/blob/dcr-random/types/random.go
2. https://github.com/corestario/tendermint/blob/dcr-random/consensus/dkg.go
3. https://github.com/corestario/tendermint/blob/dcr-random/consensus/dkg_dealer.go


On-chain DKG works the same way as the off-chain version but writes its messages to blocks,
which allows us to slash a validator that refuses to participate in a DKG round.

More about DKG and lib, which implements corresponding algorithm
see [dkglib](https://github.com/corestario/dkglib).

# Requirements:
* [Tendermint (corestario fork)](https://github.com/corestario/tendermint)
* [DKGLib](https://github.com/corestario/dkglib)
* [Cosmos-utils](https://github.com/corestario/cosmos-utils)
* [Cosmos-sdk (corestario fork)](https://github.com/corestario/cosmos-sdk)
* [Cosmos-modules (corestario fork)](https://github.com/corestario/modules)

# Running a local-testnet

#### Ensure that you have docker!
#### Ensure that dkglib, tendermint, cosmos-sdk and cosmos-utils, modules folders are next to your randapp folder!
##### It is necessary for building docker images and starting testnet!

Example:

/ home

**/ projects

****/ randapp

****/ dkglib

****/ tendermint

****/ cosmos-sdk

****/ cosmos-utils

****/ modules

#### Run a local-testnet:
```shell script
sudo rm -rf ./build && sudo make build-docker-randappdnode && make build-linux && sudo make localnet-stop && sudo make localnet-start-without-bls-keys
```

#### How to view logs on a randapp node:
```shell script
docker logs -f randappdnode0
```

### CLI commands

Randapp has only one type of messages which could be sent from cli - seeds (implement in [Modules](https://github.com/corestario/modules))

#### Send seed
```shell script
randappcli reseeding send "SEED_BYTES"
```

Sending native MsgSendDKGData type from a cli or REST is not implemented due to unnecessary