Trait

sigmastate.interpreter

ProverUtils

Related Doc: package interpreter

Permalink

trait ProverUtils extends Interpreter

Linear Supertypes
Interpreter, ScorexLogging, StrictLogging, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ProverUtils
  2. Interpreter
  3. ScorexLogging
  4. StrictLogging
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type CTX <: InterpreterContext

    Permalink
    Definition Classes
    Interpreter
  2. type ProofT = UncheckedTree

    Permalink
    Definition Classes
    Interpreter

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val CostPerByteDeserialized: Int

    Permalink

    The cost of Value[T] deserialization is O(n), where n is the length of its bytes array.

    The cost of Value[T] deserialization is O(n), where n is the length of its bytes array. To evaluate DeserializeContext and sigmastate.utxo.DeserializeRegister we add the following cost of deserialization for each byte.

    Definition Classes
    Interpreter
  5. val CostPerTreeByte: Int

    Permalink

    The cost of substituting DeserializeContext and sigmastate.utxo.DeserializeRegister nodes with the deserialized expression is O(n), where n is the number of bytes in ErgoTree.

    The cost of substituting DeserializeContext and sigmastate.utxo.DeserializeRegister nodes with the deserialized expression is O(n), where n is the number of bytes in ErgoTree. The following is the cost added for each ErgoTree.bytes.

    Definition Classes
    Interpreter
  6. def addCryptoCost(jitRes: JitReductionResult, costLimit: Long): Long

    Permalink

    Adds the cost to verify sigma protocol proposition.

    Adds the cost to verify sigma protocol proposition. This is AOT part of JITC-based interpreter, it predicts the cost of crypto verification, which is asymptotically much faster and protects from spam scripts.

    jitRes

    result of JIT-based reduction

    costLimit

    total cost limit to check and raise exception if exceeded

    returns

    computed jitRes.cost + crypto verification cost

    Attributes
    protected
    Definition Classes
    Interpreter
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def bagForMultisig(context: CTX, sigmaTree: SigmaBoolean, proof: Array[Byte], realSecretsToExtract: Seq[SigmaBoolean], simulatedSecretsToExtract: Seq[SigmaBoolean]): HintsBag

    Permalink

    A method which is extracting partial proofs of secret knowledge for particular secrets with their respective public images given.

    A method which is extracting partial proofs of secret knowledge for particular secrets with their respective public images given. Useful for distributed signature applications.

    See DistributedSigSpecification for examples of usage.

    context

    - context used to reduce the proposition

    sigmaTree

    - public key (in form of a sigma-tree)

    proof

    - signature for the key

    realSecretsToExtract

    - public keys of secrets with real proofs

    simulatedSecretsToExtract

    - public keys of secrets with simulated proofs

    returns

    - bag of OtherSecretProven and OtherCommitment hints

  9. def bagForMultisig(context: CTX, ergoTree: ErgoTree, proof: Array[Byte], realSecretsToExtract: Seq[SigmaBoolean], simulatedSecretsToExtract: Seq[SigmaBoolean] = Seq.empty): HintsBag

    Permalink

    A method which is extracting partial proofs of secret knowledge for particular secrets with their respective public images given.

    A method which is extracting partial proofs of secret knowledge for particular secrets with their respective public images given. Useful for distributed signature applications.

    See DistributedSigSpecification for examples of usage.

    context

    - context used to reduce the proposition

    ergoTree

    - proposition to reduce

    proof

    - proof for reduced proposition

    realSecretsToExtract

    - public keys of secrets with real proofs

    simulatedSecretsToExtract

    - public keys of secrets with simulated proofs

    returns

    - bag of OtherSecretProven and OtherCommitment hints

  10. def checkSoftForkCondition(ergoTree: ErgoTree, context: CTX): Option[VerificationResult]

    Permalink

    Checks the possible soft-fork condition.

    Checks the possible soft-fork condition.

    ergoTree

    contract which needs to be executed

    context

    evaluation context to use for detecting soft-fork condition

    returns

    None, if no soft-fork has been detected and ErgoTree execution can proceed normally Some(true -> context.initCost), if soft-fork has been detected, but we cannot proceed with ErgoTree, however can accept relying on 90% of upgraded nodes (due to activation has already been done).

    Attributes
    protected
    Definition Classes
    Interpreter
    Exceptions thrown

    InterpreterException when cannot proceed and no activation yet.

  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def deserializeMeasured(context: CTX, scriptBytes: Array[Byte]): (CTX, Value[SType])

    Permalink

    Deserializes given script bytes using ValueSerializer (i.e.

    Deserializes given script bytes using ValueSerializer (i.e. assuming expression tree format). It also measures tree complexity adding to the total estimated cost of script execution. The new returned context contains increased initCost and should be used for further processing.

    The method SHOULD be called only inside trySoftForkable scope, to make deserialization soft-forkable.

    NOTE: While ErgoTree is always of type SigmaProp, ValueSerializer can serialize expression of any type. So it cannot be replaced with ErgoTreeSerializer here.

    Attributes
    protected
    Definition Classes
    Interpreter
  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def evalSettings: EvalSettings

    Permalink

    Evaluation settings used by ErgoTreeEvaluator which is used by this interpreter to perform fullReduction.

    Evaluation settings used by ErgoTreeEvaluator which is used by this interpreter to perform fullReduction.

    Attributes
    protected
    Definition Classes
    Interpreter
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def fullReduction(ergoTree: ErgoTree, ctx: CTX): FullReductionResult

    Permalink

    Full reduction of contract proposition given in the ErgoTree form to a SigmaBoolean value which encodes either a sigma-protocol proposition or a boolean (true or false) value.

    Full reduction of contract proposition given in the ErgoTree form to a SigmaBoolean value which encodes either a sigma-protocol proposition or a boolean (true or false) value. See other overload for details.

    Definition Classes
    Interpreter
  18. def fullReduction(ergoTree: ErgoTree, ctx: CTX, env: ScriptEnv): FullReductionResult

    Permalink

    Full reduction of contract proposition given in the ErgoTree form to a SigmaBoolean value which encodes either a sigma-protocol proposition or a boolean (true or false) value.

    Full reduction of contract proposition given in the ErgoTree form to a SigmaBoolean value which encodes either a sigma-protocol proposition or a boolean (true or false) value.

    Works as follows: 1) parse ErgoTree instance into a typed AST 2) go bottom-up the tree to replace DeserializeContext nodes only 3) estimate cost and reduce the AST to a SigmaBoolean instance (either sigma-tree or trivial boolean value)

    ergoTree

    input ErgoTree expression to reduce

    ctx

    context used in reduction

    env

    script environment

    returns

    reduction result as a pair of sigma boolean and the accumulated cost counter after reduction

    Definition Classes
    Interpreter
  19. def generateCommitmentsFor(sigmaTree: SigmaBoolean, generateFor: Seq[SigmaBoolean]): HintsBag

    Permalink

    A method which is is generating commitments for all the public keys provided.

    A method which is is generating commitments for all the public keys provided.

    Currently only keys in form of ProveDlog and ProveDiffieHellman are supported, not more complex subtrees.

    sigmaTree

    - crypto-tree

    generateFor

    - public keys for which commitments should be generated

    returns

    generated commitments (private, containing secret randomness, and public, containing only commitments)

  20. def generateCommitmentsFor(ergoTree: ErgoTree, context: CTX, generateFor: Seq[SigmaBoolean]): HintsBag

    Permalink

    Generate commitments for a given ergoTree (mixed-tree) and public keys.

    Generate commitments for a given ergoTree (mixed-tree) and public keys.

    First, the given tree is to be reduced to crypto-tree (sigma-tree) by using context provided.

  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    ScorexLogging
    Annotations
    @inline()
  25. def logMessage(msg: String): Unit

    Permalink

    Logs the given message string.

    Logs the given message string. Can be overridden in the derived interpreter classes to redefine the default behavior.

    Attributes
    protected
    Definition Classes
    Interpreter
  26. val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    StrictLogging
  27. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. def propositionFromErgoTree(ergoTree: ErgoTree, context: CTX): SigmaPropValue

    Permalink

    Extracts proposition for ErgoTree handing soft-fork condition.

    Extracts proposition for ErgoTree handing soft-fork condition.

    Attributes
    protected
    Definition Classes
    Interpreter
    Note

    soft-fork handler

  31. def reduceToCryptoJITC(context: CTX, env: ScriptEnv, exp: SigmaPropValue): Try[JitReductionResult]

    Permalink

    This method uses the new JIT costing with direct ErgoTree execution.

    This method uses the new JIT costing with direct ErgoTree execution. It is used in both prover and verifier to compute SigmaProp value. As the first step the cost of computing the exp expression in the given context is estimated. If cost is above limit then exception is returned and exp is not executed else exp is computed in the given context and the resulting SigmaBoolean returned.

    context

    the context in which exp should be executed

    env

    environment of system variables used by the interpreter internally

    exp

    expression to be executed in the given context

    returns

    result of script reduction

    Attributes
    protected
    Definition Classes
    Interpreter
    See also

    ReductionResult

  32. def substDeserialize(context: CTX, updateContext: (CTX) ⇒ Unit, node: SValue): Option[SValue]

    Permalink

    updateContext

    call back to setup new context (with updated cost limit) to be passed next time

    Attributes
    protected
    Definition Classes
    Interpreter
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  35. def verify(ergoTree: ErgoTree, context: CTX, proof: ProofT, message: Array[Byte]): Try[VerificationResult]

    Permalink
    Definition Classes
    Interpreter
  36. def verify(env: ScriptEnv, ergoTree: ErgoTree, context: CTX, proverResult: ProverResult, message: Array[Byte]): Try[VerificationResult]

    Permalink
    Definition Classes
    Interpreter
  37. def verify(ergoTree: ErgoTree, context: CTX, proverResult: ProverResult, message: Array[Byte]): Try[VerificationResult]

    Permalink
    Definition Classes
    Interpreter
  38. def verify(env: ScriptEnv, ergoTree: ErgoTree, context: CTX, proof: Array[Byte], message: Array[Byte]): Try[VerificationResult]

    Permalink

    Executes the script in a given context.

    Executes the script in a given context. Step 1: Deserialize context variables Step 2: Evaluate expression and produce SigmaProp value, which is zero-knowledge statement (see also SigmaBoolean). Step 3: Verify that the proof is presented to satisfy SigmaProp conditions.

    NOTE, ergoTree.complexity is not added to the cost when v5.0 is activated

    env

    environment of system variables used by the interpreter internally

    ergoTree

    ErgoTree expression to execute in the given context and verify its result

    context

    the context in which exp should be executed

    proof

    The proof of knowledge of the secrets which is expected by the resulting SigmaProp

    message

    message bytes, which are used in verification of the proof

    returns

    verification result or Exception. If if the estimated cost of execution of the exp exceeds the limit (given in context), then exception if thrown and packed in Try. If the first component is false, then: 1) script executed to false or 2) the given proof failed to validate resulting SigmaProp conditions.

    Definition Classes
    Interpreter
    See also

    reduceToCrypto

  39. def verifySignature(sigmaTree: SigmaBoolean, message: Array[Byte], signature: Array[Byte])(implicit E: ErgoTreeEvaluator): Boolean

    Permalink

    Verify a signature on given (arbitrary) message for a given public key.

    Verify a signature on given (arbitrary) message for a given public key.

    sigmaTree

    public key (represented as a tree)

    message

    message

    signature

    signature for the message

    E

    optional evaluator (can be null) which is used for profiling of operations. When E is null, then profiling is turned-off and has no effect on the execution.

    returns

    whether signature is valid or not

    Definition Classes
    Interpreter
  40. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Interpreter

Inherited from ScorexLogging

Inherited from StrictLogging

Inherited from AnyRef

Inherited from Any

Ungrouped