Trait snarkvm_dpc::traits::dpc::DPCScheme [−][src]
pub trait DPCScheme<L: LedgerScheme> { type Account: AccountScheme; type LocalData; type NetworkParameters; type Payload; type PrivateProgramInput; type Record: RecordScheme<Owner = <Self::Account as AccountScheme>::Address>; type SystemParameters; type Transaction: TransactionScheme<SerialNumber = <Self::Record as RecordScheme>::SerialNumber>; type TransactionKernel; fn setup<R: Rng + CryptoRng>(
ledger_parameters: &Arc<L::MerkleParameters>,
rng: &mut R
) -> Result<Self::NetworkParameters>; fn create_account<R: Rng + CryptoRng>(
parameters: &Self::SystemParameters,
rng: &mut R
) -> Result<Self::Account>; fn execute_offline_phase<R: Rng + CryptoRng>(
parameters: Self::SystemParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
old_records: Vec<Self::Record>,
new_records: Vec<Self::Record>,
memorandum: <Self::Transaction as TransactionScheme>::Memorandum,
rng: &mut R
) -> Result<Self::TransactionKernel>; fn execute_online_phase<R: Rng + CryptoRng>(
parameters: &Self::NetworkParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
transaction_kernel: Self::TransactionKernel,
program_proofs: Vec<Self::PrivateProgramInput>,
ledger: &L,
rng: &mut R
) -> Result<(Vec<Self::Record>, Self::Transaction)>; fn verify(
parameters: &Self::NetworkParameters,
transaction: &Self::Transaction,
ledger: &L
) -> bool; fn verify_transactions(
parameters: &Self::NetworkParameters,
block: &[Self::Transaction],
ledger: &L
) -> bool; }
Associated Types
type Account: AccountScheme
type Record: RecordScheme<Owner = <Self::Account as AccountScheme>::Address>
type Transaction: TransactionScheme<SerialNumber = <Self::Record as RecordScheme>::SerialNumber>
Required methods
fn setup<R: Rng + CryptoRng>(
ledger_parameters: &Arc<L::MerkleParameters>,
rng: &mut R
) -> Result<Self::NetworkParameters>
fn setup<R: Rng + CryptoRng>(
ledger_parameters: &Arc<L::MerkleParameters>,
rng: &mut R
) -> Result<Self::NetworkParameters>
Returns public parameters for the DPC.
fn create_account<R: Rng + CryptoRng>(
parameters: &Self::SystemParameters,
rng: &mut R
) -> Result<Self::Account>
fn create_account<R: Rng + CryptoRng>(
parameters: &Self::SystemParameters,
rng: &mut R
) -> Result<Self::Account>
Returns an account, given the system parameters, metadata, and an RNG.
fn execute_offline_phase<R: Rng + CryptoRng>(
parameters: Self::SystemParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
old_records: Vec<Self::Record>,
new_records: Vec<Self::Record>,
memorandum: <Self::Transaction as TransactionScheme>::Memorandum,
rng: &mut R
) -> Result<Self::TransactionKernel>
fn execute_offline_phase<R: Rng + CryptoRng>(
parameters: Self::SystemParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
old_records: Vec<Self::Record>,
new_records: Vec<Self::Record>,
memorandum: <Self::Transaction as TransactionScheme>::Memorandum,
rng: &mut R
) -> Result<Self::TransactionKernel>
Returns the execution context required for program snark and DPC transaction generation.
fn execute_online_phase<R: Rng + CryptoRng>(
parameters: &Self::NetworkParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
transaction_kernel: Self::TransactionKernel,
program_proofs: Vec<Self::PrivateProgramInput>,
ledger: &L,
rng: &mut R
) -> Result<(Vec<Self::Record>, Self::Transaction)>
fn execute_online_phase<R: Rng + CryptoRng>(
parameters: &Self::NetworkParameters,
old_private_keys: &Vec<<Self::Account as AccountScheme>::PrivateKey>,
transaction_kernel: Self::TransactionKernel,
program_proofs: Vec<Self::PrivateProgramInput>,
ledger: &L,
rng: &mut R
) -> Result<(Vec<Self::Record>, Self::Transaction)>
Returns new records and a transaction based on the authorized consumption of old records.
fn verify(
parameters: &Self::NetworkParameters,
transaction: &Self::Transaction,
ledger: &L
) -> bool
fn verify(
parameters: &Self::NetworkParameters,
transaction: &Self::Transaction,
ledger: &L
) -> bool
Returns true iff the transaction is valid according to the ledger.
fn verify_transactions(
parameters: &Self::NetworkParameters,
block: &[Self::Transaction],
ledger: &L
) -> bool
fn verify_transactions(
parameters: &Self::NetworkParameters,
block: &[Self::Transaction],
ledger: &L
) -> bool
Returns true iff all the transactions in the block are valid according to the ledger.
Implementors
impl<C: Testnet1Components, L: LedgerScheme> DPCScheme<L> for snarkvm_dpc::testnet1::DPC<C> where
L: LedgerScheme<Commitment = <C::RecordCommitment as CommitmentScheme>::Output, MerkleParameters = C::MerkleParameters, MerklePath = MerklePath<C::MerkleParameters>, MerkleTreeDigest = MerkleTreeDigest<C::MerkleParameters>, SerialNumber = <C::AccountSignature as SignatureScheme>::PublicKey, Transaction = Transaction<C>>,
impl<C: Testnet2Components, L: LedgerScheme> DPCScheme<L> for snarkvm_dpc::testnet2::DPC<C> where
L: LedgerScheme<Commitment = <C::RecordCommitment as CommitmentScheme>::Output, MerkleParameters = C::MerkleParameters, MerklePath = MerklePath<C::MerkleParameters>, MerkleTreeDigest = MerkleTreeDigest<C::MerkleParameters>, SerialNumber = <C::AccountSignature as SignatureScheme>::PublicKey, Transaction = Transaction<C>>,
<C::PolynomialCommitment as PolynomialCommitment<C::InnerScalarField>>::VerifierKey: ToConstraintField<C::OuterScalarField>,
<C::PolynomialCommitment as PolynomialCommitment<C::InnerScalarField>>::Commitment: ToConstraintField<C::OuterScalarField>,