| Crates.io | round-based |
| lib.rs | round-based |
| version | 0.5.0-alpha.1 |
| created_at | 2021-01-24 09:16:35.45202+00 |
| updated_at | 2025-09-26 11:27:59.65247+00 |
| description | Driver for MPC protocols |
| homepage | |
| repository | https://github.com/LFDT-Lockness/round-based |
| max_upload_size | |
| id | 345950 |
| size | 203,150 |
An MPC framework that unifies and simplifies the way of developing and working with multiparty protocols (e.g. threshold signing, random beacons, etc.).
MPC protocol execution typically looks like this:
// protocol to be executed, takes MPC engine `M`, index of party `i`,
// and number of participants `n`
async fn keygen<M>(mpc: M, i: u16, n: u16) -> Result<KeyShare>
where
M: round_based::Mpc<Msg = KeygenMsg>
{
// ...
}
// establishes network connection(s) to other parties so they may communicate
async fn connect() ->
impl futures::Stream<Item = Result<round_based::Incoming<KeygenMsg>>>
+ futures::Sink<round_based::Outgoing<KeygenMsg>, Error = Error>
+ Unpin
{
// ...
}
let delivery = connect().await;
// constructs an MPC engine, which, primarily, is used to communicate with
// other parties
let mpc = round_based::mpc::connected(delivery);
// execute the protocol
let keyshare = keygen(mpc, i, n).await?;
In order to run an MPC protocol, transport layer needs to be defined. All you have to do is to provide a channel which implements a stream and a sink for receiving and sending messages.
async fn connect() ->
impl futures::Stream<Item = Result<round_based::Incoming<Msg>>>
+ futures::Sink<round_based::Outgoing<Msg>, Error = Error>
+ Unpin
{
// ...
}
let delivery = connect().await;
let party = round_based::mpc::connected(delivery);
// run the protocol
In order to guarantee the protocol security, it may require:
echo_broadcast support out-of-box that enforces broadcast
reliability by adding an extra communication round per each round that requires
reliable broadcast. round_basedWe plan to write a book guiding through MPC protocol development process, but while it's not done, you may refer to random beacon example and our well-documented API.
sim enables protocol execution simulation, see sim module
sim-async enables protocol execution simulation with tokio runtime, see sim::async_env
modulestate-machine provides ability to carry out the protocol, defined as async function, via Sync
API, see state_machine moduleecho-broadcast adds echo_broadcast supportderive is needed to use ProtocolMsg proc macroruntime-tokio enables tokio-specific implementation of async runtimeFeel free to reach out to us in Discord!