All Projects → dusk-network → dusk-blindbid

dusk-network / dusk-blindbid

Licence: MPL-2.0 license
Implementation of the blindbid logic within Zero Knowledge Proofs

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to dusk-blindbid

plonk
A pure Rust PLONK implementation using arkworks as a backend.
Stars: ✭ 128 (+611.11%)
Mutual labels:  zero-knowledge, plonk
blockchain-consensus
This is my attempt to list all possible blockchain consensus out there, i welcome pull request of the blockchain community! lets make it the main reference for blockchain consensus
Stars: ✭ 79 (+338.89%)
Mutual labels:  blockchain-technology, consensus-algorithm
Blockchaintechnology
Blockchain Frontier Technology Tracking
Stars: ✭ 88 (+388.89%)
Mutual labels:  blockchain-technology, consensus-algorithm
berlinblockchainweek
Website for Berlin Blockchain Week 2018
Stars: ✭ 15 (-16.67%)
Mutual labels:  blockchain-technology
deep ethereum
电子书:以太坊技术与实现
Stars: ✭ 304 (+1588.89%)
Mutual labels:  blockchain-technology
fingernft
FingerNFT是一款开源NFT市场,兼容Opensea、Rarible。
Stars: ✭ 1,827 (+10050%)
Mutual labels:  blockchain-technology
chainDB
A noSQL database based on blockchain technology
Stars: ✭ 13 (-27.78%)
Mutual labels:  blockchain-technology
react-native-defi-app
React Native Defi Decentralized Applications(dApps)
Stars: ✭ 31 (+72.22%)
Mutual labels:  blockchain-technology
libra-go
Go Client for interacting with Libra Blockchain
Stars: ✭ 50 (+177.78%)
Mutual labels:  blockchain-technology
Simple-Game-ERC-721-Token-Template
🔮 Very Simple ERC-721 Smart Contract Template to create your own ERC-721 Tokens on the Ethereum Blockchain, with many customizable Options 🔮
Stars: ✭ 83 (+361.11%)
Mutual labels:  blockchain-technology
MadMax
Ethereum Static Vulnerability Detector for Gas-Focussed Vulnerabilities
Stars: ✭ 96 (+433.33%)
Mutual labels:  blockchain-technology
blockgeeks-build-blockchain-advanced
Code that shows how to build your own Bitcoin-like blockchain with JavaScript.
Stars: ✭ 24 (+33.33%)
Mutual labels:  blockchain-technology
aeonflux
Infinitely presentable (aeon) rerandomisable (flux) anonymous credentials.
Stars: ✭ 25 (+38.89%)
Mutual labels:  zero-knowledge
HealthLedger
Application for tracking Organs donations in hospitals and minimizing the scope of Organ trafficking using Blockchain (Hyperledger) technology.
Stars: ✭ 29 (+61.11%)
Mutual labels:  blockchain-technology
plonk-by-fingers
Implementation of Plonk by Hand in rust
Stars: ✭ 32 (+77.78%)
Mutual labels:  plonk
readme
The Blockchain Bible,a collections for blockchain tech,bitcoin,ethereum,crypto currencies,cryptography,decentralized solutions,business scenarios,hyperledger tech,meetups,区块链,数字货币,加密货币,比特币,以太坊,密码学,去中心化,超级账本
Stars: ✭ 46 (+155.56%)
Mutual labels:  blockchain-technology
nis-python-client
Python client for NEM NIS API (https://nemproject.github.io). XEM\NEM\Crypto
Stars: ✭ 16 (-11.11%)
Mutual labels:  blockchain-technology
rippled-php
A PHP library for rippled (XRP Ledger) communication.
Stars: ✭ 33 (+83.33%)
Mutual labels:  blockchain-technology
rivine
Blockchain technology for creating custom chains.
Stars: ✭ 23 (+27.78%)
Mutual labels:  blockchain-technology
wordlines
Mobile ZK Puzzle Game with NFT rewards
Stars: ✭ 180 (+900%)
Mutual labels:  zero-knowledge

dusk-blindbid

Build Status Repository Documentation

Contents

This library provides the structures and the logic that the blind bid protocol requires in order to work. Contains the most important structures: Bid and Score.

This means we can do things like:

use dusk_blindbid::{Bid, Score, V_RAW_MIN, V_RAW_MAX};
use dusk_bls12_381::BlsScalar;
use dusk_pki::{PublicSpendKey, SecretSpendKey};
use dusk_jubjub::{JubJubScalar, JubJubAffine, GENERATOR_EXTENDED};
use rand::{Rng, thread_rng};

// Generate a Bid from some fields we have.
let mut rng = thread_rng();
let secret = JubJubScalar::random(&mut rand::thread_rng());
let secret_k = BlsScalar::random(&mut rand::thread_rng());
let pk_r = PublicSpendKey::from(SecretSpendKey::new(
    JubJubScalar::one(),
    -JubJubScalar::one(),
));
let stealth_addr = pk_r.gen_stealth_address(&secret);
let secret = GENERATOR_EXTENDED * secret;
let value: u64 = (&mut thread_rng()).gen_range(V_RAW_MIN..V_RAW_MAX);
let value = JubJubScalar::from(value);
let elegibility_ts = u64::MAX;
let expiration_ts = u64::MAX;
let poseidon_tree_root = BlsScalar::random(&mut thread_rng());

let bid = Bid::new(
     &mut rng,
     &stealth_addr,
     &value,
     &secret.into(),
     secret_k,
     elegibility_ts,
     expiration_ts,
 )
 .expect("Bid creation error");

// Generate fields for the Bid & required by the compute_score
let consensus_round_seed = BlsScalar::random(&mut thread_rng());
let latest_consensus_round = 50u64;
let latest_consensus_step = 50u64;

// Generate a ProverID attached to the `Bid`.
let prover_id = bid.generate_prover_id(
    secret_k,
    BlsScalar::from(consensus_round_seed),
    BlsScalar::from(latest_consensus_round),
    BlsScalar::from(latest_consensus_step),
);

// The next step is only doable if `std` feature is enabled.

// Generate a `Score` for our Bid with the consensus parameters
 let score = Score::compute(
     &bid,
     &secret.into(),
     secret_k,
     poseidon_tree_root,
     consensus_round_seed,
     latest_consensus_round,
     latest_consensus_step,
 ).expect("Score generation error");

Rationale & Theory

In order to participate in the SBA consensus, Block generators have to submit a bid in DUSK. As long as their bid is active - and their full-node is connected with the internet and running- they are participating in the consensus rounds. Essentially, every time a consensus round is run, the Block Generator software generates a comprehensive zero-knowledge proof, and executes various steps in order to generate a valid candidate block, and compete with the other Block Generators for a chance to become the winner of the consensus round.

Below we describe the three main processes that happen every consensus round. Please note that 1 and 2 are run as part of the same algorithm.

1: Score generation.

Block Generators obtain a score from a lottery by executing the Score Generation Function. The score is positively influenced by the amount of DUSK that the Block Generator bids. In other words, the higher the bid, the better the chance to generate a high score. This is important to guarantee Sybil attack protection.

Without this link a bad actor could subvert the reputation system by creating multiple identities. Also note: there are minimum and maximum thresholds that determine the minimum and maximum size of the bid.

2. Proof of Blind-Bid Generation.

In general computing science, a circuit is a computational model through which input values proceed through a sequence of gates, each of which computes a specific function. In our case, the circuits perform the logical checks with public and private inputs to make sure that the generated Blind Bid proofs are generated by the rules of the game. For explanatory reasons, we define two circuits although in practice, these two are a collection of gadgets added up together in order to compose the BlindBidCircuit.

For further information regarding the circuits, please check the blindbid-circuits crate

3. Propagation.

During each consensus round, the Block Generator checks the score that he produced, and verifies whether it is greater than the minimum score threshold. If it is indeed greater, then the Block Generator generates the aforementioned proofs and propagates the score obtained, the zero-knowledge proof computed and various other elements alongside the Block Candidate to his peers in the network. The Block Generator that computed the highest score is considered to be the leader of the current iteration of the consensus.

Documentation

The best usage example of this library can actually be found in the Bid contract. This is the place where this lib provides all it's functionallities together with PoseidonTrees and Zero Knowledge Proofs. See: <https://github.com/dusk-network/rusk/tree/master/contracts/bid for more info and detail.>

You can also check the documentation of this crate here.

Licensing

This code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see LICENSE for further info.

About

Protocol & Implementation designed by the dusk team.

Contributing

  • If you want to contribute to this repository/project please, check CONTRIBUTING.md
  • If you want to report a bug or request a new feature addition, please open an issue on this repository.

License: MPL-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].