org.ergoplatform.wallet.interpreter
ErgoProvingInterpreter
Companion object ErgoProvingInterpreter
class ErgoProvingInterpreter extends ErgoInterpreter with ProverInterpreter
A class which is holding secrets and signing transactions. Signing a transaction means producing spending proofs for all of the input boxes of the transaction.
This interpreter also acts as a wallet, in the sense that it is a vault holding user's secrets.
There are two basic types of secrets, hierarchical deterministic keys corresponding to BIP-32 implementation, and also "primitive" keys, such as just secret exponent for a Schnorr signature scheme done in Ergo.
It is considered that there could be very many hierarchical deterministic keys (for example, if we are talking about an exchange there could be thousands of them), and not so many primitive keys. Optimizations are centered around this assumption.
- Alphabetic
- By Inheritance
- ErgoProvingInterpreter
- ProverInterpreter
- ProverUtils
- ErgoInterpreter
- ScorexLogging
- StrictLogging
- ErgoLikeInterpreter
- Interpreter
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ErgoProvingInterpreter(secretKeys: IndexedSeq[SecretKey], params: ErgoLikeParameters, cachedHdPubKeysOpt: Option[IndexedSeq[ExtendedPublicKey]] = None)
- secretKeys
- secrets used by the prover
- params
- ergo network parameters at the moment of proving
- cachedHdPubKeysOpt
- optionally, public keys corresponding to the BIP32-related secrets (to not to recompute them)
Type Members
-
type
CTX = ErgoLikeContext
- Definition Classes
- ErgoInterpreter → ErgoLikeInterpreter → Interpreter
-
type
ProofT = UncheckedTree
- Definition Classes
- ProverInterpreter → Interpreter
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
CostPerByteDeserialized: Int
- Definition Classes
- Interpreter
-
val
CostPerTreeByte: Int
- Definition Classes
- Interpreter
-
val
activatedScriptVersion: Byte
Activated script version, 0 is for Ergo mainnet since block #1 until 417,792, 1 for Ergo mainnet since 417,792, etc.
Activated script version, 0 is for Ergo mainnet since block #1 until 417,792, 1 for Ergo mainnet since 417,792, etc. Note: version N of ErgoProtocol corresponds to version N-1 of ErgoTree (aka script version)
-
def
addCryptoCost(jitRes: ReductionResult, costLimit: Long): Long
- Attributes
- protected
- Definition Classes
- Interpreter
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bagForMultisig(context: CTX, sigmaTree: SigmaBoolean, proof: Array[Byte], realSecretsToExtract: Seq[SigmaBoolean], simulatedSecretsToExtract: Seq[SigmaBoolean]): HintsBag
- Definition Classes
- ProverUtils
-
def
bagForMultisig(context: CTX, ergoTree: ErgoTree, proof: Array[Byte], realSecretsToExtract: Seq[SigmaBoolean], simulatedSecretsToExtract: Seq[SigmaBoolean]): HintsBag
- Definition Classes
- ProverUtils
-
def
bagForTransaction(tx: ErgoLikeTransaction, boxesToSpend: IndexedSeq[ErgoBox], dataBoxes: IndexedSeq[ErgoBox], stateContext: ErgoLikeStateContext, realSecretsToExtract: Seq[SigmaBoolean], simulatedSecretsToExtract: Seq[SigmaBoolean]): TransactionHintsBag
Extract hints from (supposedly, partially) signed transaction.
Extract hints from (supposedly, partially) signed transaction. Useful for distributed signing.
- tx
- signed transaction
- boxesToSpend
- input boxes the transaction are spending
- dataBoxes
- read-only inputs of the transaction
- stateContext
- context used for signing
- realSecretsToExtract
- public images of secrets used in signing
- simulatedSecretsToExtract
- public images of simulated secrets
- returns
hints for (further) transaction signing
- val cachedHdPubKeysOpt: Option[IndexedSeq[ExtendedPublicKey]]
-
def
checkExpiredBox(box: ErgoBox, output: ErgoBoxCandidate, currentHeight: ErgoLikeContext.Height): Boolean
Checks that expired box is spent in a proper way
Checks that expired box is spent in a proper way
- box
- box being spent
- output
- newly created box when storage fee covered, otherwise any output box
- currentHeight
- current height of the blockchain (at the moment of spending)
- returns
whether the box is spent properly according to the storage fee rule
- Attributes
- protected
- Definition Classes
- ErgoInterpreter
-
def
checkSoftForkCondition(ergoTree: ErgoTree, context: CTX): Option[VerificationResult]
- Attributes
- protected
- Definition Classes
- Interpreter
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
convertToUnchecked(proofTree: ProofTree): UncheckedSigmaTree
- Definition Classes
- ProverInterpreter
-
def
convertToUnproven(sigmaTree: SigmaBoolean): UnprovenTree
- Definition Classes
- ProverInterpreter
-
def
deserializeMeasured(context: CTX, scriptBytes: Array[Byte]): (CTX, Value[SType])
- Attributes
- protected
- Definition Classes
- Interpreter
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
evalSettings: EvalSettings
- Attributes
- protected
- Definition Classes
- Interpreter
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fullReduction(ergoTree: ErgoTree, ctx: CTX): ReductionResult
- Definition Classes
- Interpreter
-
def
fullReduction(ergoTree: ErgoTree, ctx: CTX, env: ScriptEnv): ReductionResult
- Definition Classes
- Interpreter
-
def
generateCommitments(sigmaTree: SigmaBoolean): HintsBag
- Definition Classes
- ProverInterpreter
-
def
generateCommitments(ergoTree: ErgoTree, ctx: CTX): HintsBag
- Definition Classes
- ProverInterpreter
-
def
generateCommitmentsFor(unsignedTx: UnsignedErgoLikeTransaction, boxesToSpend: IndexedSeq[ErgoBox], dataBoxes: IndexedSeq[ErgoBox], stateContext: ErgoLikeStateContext): Try[TransactionHintsBag]
A method which is generating commitments to randomness.
A method which is generating commitments to randomness. A commitment is about a first step of a zero-knowledge proof-of-knowledge knowledge protocol.
Method checks whether secret is known to the prover, and returns None if the secret is not known.
- unsignedTx
- transaction to be signed with commitments to be generated first
- boxesToSpend
- boxes the transaction is spending
- dataBoxes
- read-only inputs of the transaction
- stateContext
- context used for signing
- returns
- hints for signing transaction
-
def
generateCommitmentsFor(sigmaTree: SigmaBoolean, generateFor: Seq[SigmaBoolean]): HintsBag
- Definition Classes
- ProverUtils
-
def
generateCommitmentsFor(ergoTree: ErgoTree, context: CTX, generateFor: Seq[SigmaBoolean]): HintsBag
- Definition Classes
- ProverUtils
-
def
generateProof(sb: SigmaBoolean, message: Array[Byte], hintsBag: HintsBag): Array[Byte]
- Definition Classes
- ProverInterpreter
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
val
hdKeys: IndexedSeq[ExtendedSecretKey]
Only secrets corresponding to hierarchical deterministic scheme (BIP-32 impl)
-
val
hdPubKeys: IndexedSeq[ExtendedPublicKey]
Only public keys corresponding to hierarchical deterministic scheme (BIP-32 impl)
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
log: Logger
- Attributes
- protected
- Definition Classes
- ScorexLogging
- Annotations
- @inline()
-
def
logMessage(msg: String, t: Throwable): Unit
- Attributes
- protected
- Definition Classes
- ErgoInterpreter → Interpreter
-
def
logMessage(msg: String): Unit
Override default logging for all Ergo interpreters.
Override default logging for all Ergo interpreters.
- Attributes
- protected
- Definition Classes
- ErgoInterpreter → Interpreter
-
val
logger: Logger
- Attributes
- protected
- Definition Classes
- StrictLogging
-
def
markReal(hintsBag: HintsBag): Strategy
- Definition Classes
- ProverInterpreter
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
polishSimulated: Strategy
- Definition Classes
- ProverInterpreter
-
def
propositionFromErgoTree(ergoTree: ErgoTree, context: CTX): SigmaPropValue
- Attributes
- protected
- Definition Classes
- Interpreter
-
def
prove(env: ScriptEnv, ergoTree: ErgoTree, context: CTX, message: Array[Byte], hintsBag: HintsBag): Try[CostedProverResult]
- Definition Classes
- ProverInterpreter
-
def
prove(ergoTree: ErgoTree, context: CTX, message: Array[Byte]): Try[CostedProverResult]
- Definition Classes
- ProverInterpreter
-
def
prove(ergoTree: ErgoTree, context: CTX, message: Array[Byte], hintsBag: HintsBag): Try[CostedProverResult]
- Definition Classes
- ProverInterpreter
-
def
prove(unprovenTree: UnprovenTree, message: Array[Byte], hintsBag: HintsBag): ProofT
- Attributes
- protected
- Definition Classes
- ProverInterpreter
-
def
proving(hintsBag: HintsBag): Strategy
- Definition Classes
- ProverInterpreter
-
def
publicKeys: Seq[SigmaBoolean]
- Definition Classes
- ProverInterpreter
-
def
reduceToCryptoJITC(context: CTX, env: ScriptEnv, exp: SigmaPropValue): Try[ReductionResult]
- Attributes
- protected
- Definition Classes
- Interpreter
- val secretKeys: IndexedSeq[SecretKey]
-
val
secrets: IndexedSeq[SigmaProtocolPrivateInput[_, _]]
Interpreter's secrets, in form of sigma protocols private inputs
Interpreter's secrets, in form of sigma protocols private inputs
- Definition Classes
- ErgoProvingInterpreter → ProverInterpreter
-
def
setPositions(uc: UnprovenConjecture): UnprovenConjecture
- Attributes
- protected
- Definition Classes
- ProverInterpreter
-
def
sign(unsignedTx: UnsignedErgoLikeTransaction, boxesToSpend: IndexedSeq[ErgoBox], dataBoxes: IndexedSeq[ErgoBox], stateContext: ErgoLikeStateContext, txHints: TransactionHintsBag = TransactionHintsBag.empty): Try[ErgoLikeTransaction]
- Note
requires
unsignedTxandboxesToSpendhave the same boxIds in the same order.
- def signInputs(unsignedTx: UnsignedErgoLikeTransaction, boxesToSpend: IndexedSeq[ErgoBox], dataBoxes: IndexedSeq[ErgoBox], stateContext: ErgoLikeStateContext, txHints: TransactionHintsBag): Try[(IndexedSeq[Input], Long)]
-
def
signMessage(sigmaTree: SigmaBoolean, message: Array[Byte], hintsBag: HintsBag): Try[Array[Byte]]
- Definition Classes
- ProverInterpreter
-
def
simulateAndCommit(hintsBag: HintsBag): Strategy
- Definition Classes
- ProverInterpreter
-
def
substDeserialize(context: CTX, updateContext: (CTX) ⇒ Unit, node: SValue): Option[SValue]
- Definition Classes
- ErgoLikeInterpreter → Interpreter
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
verify(env: ScriptEnv, exp: ErgoTree, context: CTX, proof: Array[Byte], message: Array[Byte]): Try[VerificationResult]
Checks that given exp evaluates to
true.Checks that given exp evaluates to
true.- env
- environment to use during expression evaluation
- exp
- expression to check
- context
- expression evaluation context
- proof
- cryptographic proof
- message
- message
- Definition Classes
- ErgoInterpreter → Interpreter
-
def
verify(ergoTree: ErgoTree, context: CTX, proof: ErgoProvingInterpreter.ProofT, message: Array[Byte]): Try[VerificationResult]
- Definition Classes
- Interpreter
-
def
verify(env: ScriptEnv, ergoTree: ErgoTree, context: CTX, proverResult: ProverResult, message: Array[Byte]): Try[VerificationResult]
- Definition Classes
- Interpreter
-
def
verify(ergoTree: ErgoTree, context: CTX, proverResult: ProverResult, message: Array[Byte]): Try[VerificationResult]
- Definition Classes
- Interpreter
-
def
verifySignature(sigmaTree: SigmaBoolean, message: Array[Byte], signature: Array[Byte])(implicit E: ErgoTreeEvaluator): Boolean
- Definition Classes
- Interpreter
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
withNewExtendedSecret(secret: ExtendedSecretKey): ErgoProvingInterpreter
Produces updated instance of ErgoProvingInterpreter with a new secret included
Produces updated instance of ErgoProvingInterpreter with a new secret included
- secret
- new secret to add
- returns
modified prover
-
def
withNewParameters(newParams: ErgoLikeParameters): ErgoProvingInterpreter
Produces updated instance of ErgoProvingInterpreter with updated parameters
Produces updated instance of ErgoProvingInterpreter with updated parameters
- newParams
- updated parameters
- returns
modified prover