Package com.horizen.commitmenttreenative
Class CommitmentTree
- java.lang.Object
-
- com.horizen.commitmenttreenative.CommitmentTree
-
- All Implemented Interfaces:
AutoCloseable
public class CommitmentTree extends Object implements AutoCloseable
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddBtr(byte[] scId, long scFee, byte[] mcDestinationAddress, byte[][] scRequestData, byte[] txHash, int outIdx)booleanaddCert(byte[] scId, int epochNumber, long quality, BackwardTransfer[] btList, Optional<byte[][]> customFieldsOpt, byte[] endCumulativeScTxCommitmentTreeRoot, long btrFee, long ftMinAmount)booleanaddCertLeaf(byte[] scId, byte[] leaf)booleanaddCsw(byte[] scId, long amount, byte[] nullifier, byte[] mcPubKeyHash)booleanaddFwt(byte[] scId, long amount, byte[] pubKey, byte[] mcReturnAddress, byte[] txHash, int outIdx)booleanaddScCr(byte[] scId, long amount, byte[] pubKey, byte[] txHash, int outIdx, int withdrawalEpochLength, byte mcBtrRequestDataLength, CustomFieldElementsConfig[] customFieldElementsConfigs, CustomBitvectorElementsConfig[] customBitvectorElementsConfigs, long btrFee, long ftMinAmount, byte[] customCreationData, Optional<byte[]> constantOpt, byte[] certVerificationKey, Optional<byte[]> cswVerificationKeyOpt)voidclose()voidfreeCommitmentTree()Optional<FieldElement>getBtrCommitment(byte[] scId)Optional<List<FieldElement>>getBtrLeaves(byte[] scId)Optional<MerklePath>getBtrMerklePath(byte[] scId, int leafIndex)Optional<FieldElement>getCertCommitment(byte[] scId)Optional<MerklePath>getCertMerklePath(byte[] scId, int leafIndex)Optional<FieldElement>getCommitment()Optional<List<FieldElement>>getCrtLeaves(byte[] scId)Optional<FieldElement>getCswCommitment(byte[] scId)Optional<FieldElement>getFwtCommitment(byte[] scId)Optional<List<FieldElement>>getFwtLeaves(byte[] scId)Optional<MerklePath>getFwtMerklePath(byte[] scId, int leafIndex)Optional<ScAbsenceProof>getScAbsenceProof(byte[] scId)Optional<FieldElement>getScCommitment(byte[] scId)Optional<MerklePath>getScCommitmentMerklePath(byte[] scId)Optional<FieldElement>getScCrCommitment(byte[] scId)Optional<ScExistenceProof>getScExistenceProof(byte[] scId)static CommitmentTreeinit()booleannativeAddCertLeaf(byte[] scId, byte[] leaf)static booleanverifyScAbsence(byte[] scId, ScAbsenceProof absenceProof, FieldElement commitment)static booleanverifyScCommitment(FieldElement scCommitment, ScExistenceProof existenceProof, FieldElement commitment)
-
-
-
Method Detail
-
init
public static CommitmentTree init()
-
freeCommitmentTree
public void freeCommitmentTree()
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
addScCr
public boolean addScCr(byte[] scId, long amount, byte[] pubKey, byte[] txHash, int outIdx, int withdrawalEpochLength, byte mcBtrRequestDataLength, CustomFieldElementsConfig[] customFieldElementsConfigs, CustomBitvectorElementsConfig[] customBitvectorElementsConfigs, long btrFee, long ftMinAmount, byte[] customCreationData, Optional<byte[]> constantOpt, byte[] certVerificationKey, Optional<byte[]> cswVerificationKeyOpt)
-
addFwt
public boolean addFwt(byte[] scId, long amount, byte[] pubKey, byte[] mcReturnAddress, byte[] txHash, int outIdx)
-
addBtr
public boolean addBtr(byte[] scId, long scFee, byte[] mcDestinationAddress, byte[][] scRequestData, byte[] txHash, int outIdx)
-
addCert
public boolean addCert(byte[] scId, int epochNumber, long quality, BackwardTransfer[] btList, Optional<byte[][]> customFieldsOpt, byte[] endCumulativeScTxCommitmentTreeRoot, long btrFee, long ftMinAmount)
-
nativeAddCertLeaf
public boolean nativeAddCertLeaf(byte[] scId, byte[] leaf)
-
addCertLeaf
public boolean addCertLeaf(byte[] scId, byte[] leaf)
-
addCsw
public boolean addCsw(byte[] scId, long amount, byte[] nullifier, byte[] mcPubKeyHash)
-
getFwtLeaves
public Optional<List<FieldElement>> getFwtLeaves(byte[] scId)
-
getBtrLeaves
public Optional<List<FieldElement>> getBtrLeaves(byte[] scId)
-
getCrtLeaves
public Optional<List<FieldElement>> getCrtLeaves(byte[] scId)
-
getScCrCommitment
public Optional<FieldElement> getScCrCommitment(byte[] scId)
-
getFwtCommitment
public Optional<FieldElement> getFwtCommitment(byte[] scId)
-
getBtrCommitment
public Optional<FieldElement> getBtrCommitment(byte[] scId)
-
getCertCommitment
public Optional<FieldElement> getCertCommitment(byte[] scId)
-
getCswCommitment
public Optional<FieldElement> getCswCommitment(byte[] scId)
-
getScCommitment
public Optional<FieldElement> getScCommitment(byte[] scId)
-
getCommitment
public Optional<FieldElement> getCommitment()
-
getScExistenceProof
public Optional<ScExistenceProof> getScExistenceProof(byte[] scId)
-
verifyScCommitment
public static boolean verifyScCommitment(FieldElement scCommitment, ScExistenceProof existenceProof, FieldElement commitment)
-
getScAbsenceProof
public Optional<ScAbsenceProof> getScAbsenceProof(byte[] scId)
-
verifyScAbsence
public static boolean verifyScAbsence(byte[] scId, ScAbsenceProof absenceProof, FieldElement commitment)
-
getScCommitmentMerklePath
public Optional<MerklePath> getScCommitmentMerklePath(byte[] scId)
-
getFwtMerklePath
public Optional<MerklePath> getFwtMerklePath(byte[] scId, int leafIndex)
-
getBtrMerklePath
public Optional<MerklePath> getBtrMerklePath(byte[] scId, int leafIndex)
-
getCertMerklePath
public Optional<MerklePath> getCertMerklePath(byte[] scId, int leafIndex)
-
-