(deprecated) Cross-shard transfers

(deprecated) Cross-shard transfers

 

NOTE: This document is DEPRECATED. A new version will be published at some point.

Motivation

The purpose of the protocol is to transfer value between independent shards.

The shards could be either RChain networks or any other network that implements the protocol.

Each client trusts his own shard and it's ancestors all the way up to the root shard. Clients living in two different shards will not both trust the other party's shard. 

For this reasons, when two parties are transferring value between two arbitrary shards, they should meet at the least common ancestor, where the value exchange between the two parties becomes a normal blockchain transaction.

The cross-shard value transfer protocol provides a way for each of the clients to move value from their own wallets to a parent shard or back.

Outstanding issues

  1. how to do weighted multi-signature 

  2. notification on block finalization (check with @Michael Birch (Unlicensed) & @Former user (Deleted))

  3. Should we have a shard DAG in a future version?

  4. how to roll-back cross-shard transfers when something goes wrong during the transfer?

  5. how to mount an existing shard?

  6. How to unmount a shard without destroying it?

  7. Why not register all the wallets in a public WalletRegistry?

  8. Do we sign the "approved" contracts used for REV?

  9. How to avoid the situation when the validators move their stakes out of the child shard while still holding their validator status?

  10. How does interaction with PoS contract happens at bonding/unbonding

  11. how to update K in order to keep the K/N ratio the same as validators bond/unbond. Should we keep the ratio in the config and re-compute K each time?

Architecture

The shards are organised in a tree structure. 

The dependencies are from child shards to parent shards. 

The validators of the child chard act as clients of the parent shard.

The parent shard validators are not involved in the child shards.

Components

Common data structures

KonsensusConfig

  • genesis_hash

  • validators : [ ValidatorConfig ]

  • k : Int

ValidatorConfig

  • ip_address

  • public_key

  • expected_bond : Int

K-of-N consensus

KonsensusFactory

Creates the Konsensus contract. This extra layer is needed because the create call has to be confirmed by all the validators.

KonsensusFactory API

KonsensusFactory API

create

KonsensusConfig→ KonsensusFactory

Instantiates the K-of-N contract given the public keys of the validators and a given K value

createKonsensus

Signature → Konsensus

Creates the consensus after all the signatures are accumulated. The expected signature is the name of Konsensus process, signed with the caller's private key. The call returns only when all the required signatures are accumulated.

KonsensusProxy

This is used to control messages sent to a name. The notation KonsensusProxy[X] used further means that, after a message with K signatures is received the call will be forwarded to X. 

The KonsensusProxy is instantiated by Konsensus:makeProxy. The K used is the one which Konsensus was created with, See KonsensusFactory:create

KonsensusProxy

KonsensusProxy

send

Message → Signature → Unit

Accumulates K signatures on a message. After all the K messages are received the message is forwarded to the underlying address. The expected signature is the message signed with the callers' private key.

KoNsensus

A smart contract running in the parent shard which supervises the consensus in the child shard by running a K-of-N algorithm.

This mechanism is required because the parent shard validators don't want to be aware of any child shards.

Processes that require k-of-n consensus are wrapped in a KonsensusProxy by calling makeProxy

Konsensus API

Konsensus API

getConfig

Unit → KonsensusConfig

returns the configuration of the Konsensus contract

getUpdater

Unit → KonsensusProxy[KonsensusUpdater]

Creates an updater for this Konsensus instance, wrapped in a KonsensusProxy that requires signatures equal to the number of public-keys 

makeProxy

Name → KonsensusProxy[_]

Creates a proxy on top of an existing name