Documentation ¶
Index ¶
- Constants
- Variables
- func AppendPoint(label string, p *ristretto.Point, t *merlin.Transcript)
- func AppendScalar(label string, s *ristretto.Scalar, t *merlin.Transcript)
- func ChallengeScalar(label string, t *merlin.Transcript) *ristretto.Scalar
- func ComputeAmountSharedSecretV2(secret *ristretto.Point) []byte
- func ComputeCommitmentV2(masked_value uint64, secret []byte) (uint64, error)
- func ConfirmationNumberFromSecret(buf []byte) []byte
- func DecryptEMemoPayload(encryptedMemoStr, txOutPublicKey, viewPrivateKeyStr, spendPrivateKeyStr string) (string, error)
- func DecryptMemo(text string, public, private string) ([]byte, error)
- func EncryptMemo(plain string, public, private string) ([]byte, error)
- func GetBlinding(secret *ristretto.Point) *ristretto.Scalar
- func GetBlindingFactorsV2(secret []byte) (uint64, error)
- func GetConsensusEnclave(path string) ([]byte, error)
- func GetFogReportResponse(address string) (*types.ReportResponse, error)
- func GetProductionData() ([]byte, error)
- func GetValue(output *TxOut, viewPrivate string) (uint64, error)
- func GetValueFromAmountSharedSecretV2(maskedValue uint64, secret *ristretto.Point) (uint64, error)
- func GetValueMask(secret *ristretto.Point) uint64
- func GetValueV2(amount *Amount, viewPrivate, publicKey string) (uint64, error)
- func GetValueWithBlinding(output *TxOut, viewPrivate *ristretto.Scalar) (uint64, *ristretto.Scalar)
- func GetValueWithBlindingNew(viewPrivate, publicKey string, maskedValue uint64) (uint64, *ristretto.Scalar)
- func HashOfTxPrefix(tx *TxPrefix) []byte
- func InnerproductDomainSep(n uint64, t *merlin.Transcript)
- func KeyImageFromPrivate(private *ristretto.Scalar) *ristretto.Point
- func MCAccountKeyGetSubAddressPrivateKeys(viewPrivateKeyStr, spendPrivateKeyStr string, index uint) (string, string, error)
- func MCTxOutMatchesSubaddress(txOutTargetKeyStr, txOutPublicKeyStr, viewPrivateKeyStr, ... string) (bool, error)
- func MCTxOutReconstructCommitment(maskedAmountStr, maskedTokenIDStr string, version int64, ...) (string, error)
- func MarshalTxOut(input *TxOut) *types.TxOut
- func MarshalTxOutMembershipProof(proof *TxOutMembershipProof) *types.TxOutMembershipProof
- func McTxOutGetSharedSecret(publicKeyStr, viewPrivateKeyStr string) (string, error)
- func NewCommitment(value uint64, blinding *ristretto.Scalar) *ristretto.Point
- func PublicAddressToProtobuf(addr *account.PublicAddress) (*types.PublicAddress, error)
- func RecoverPublicSubaddressSpendKey(viewPrivate, onetimePublicKey, publicKey string) (*ristretto.Point, error)
- func ValidateAddress(recipient string) error
- func ValidateFogAddressWithEnclave(recipient *account.PublicAddress, enclave string) error
- type AggregatedGensIter
- type Amount
- type BulletproofGens
- type BulletproofGensShare
- type FeeValue
- type FogFullyValidatedPubkey
- type GeneratorsChain
- type InputC
- type MaskedValue
- type Outlay
- type Output
- type PedersenGens
- type Proofs
- type Range
- type RingMLSAG
- type Signature
- type SignatureRctBulletproofs
- type TombstoneValue
- type Tx
- type TxC
- type TxIn
- type TxOut
- type TxOutAmount
- type TxOutMembershipElement
- type TxOutMembershipProof
- type TxOutWithProof
- type TxOutWithProofC
- type TxPrefix
- type TxProposal
- type UTXO
- type UnspentTxOut
Constants ¶
View Source
const ( /// The length of the header1 field, in bytes HEADER_LEN = 16 /// The length of the header2 field, in bytes HEADER2_LEN = 16 /// The length of the SWDEFINED field, in bytes SWDEFINED_LEN = 4 /// The length of the MODULUS field, in bytes PUBKEY_LEN = 384 /// The length of the SIGNATURE field, in bytes SIGNATURE_LEN = PUBKEY_LEN /// The length of the ENCLAVEHASH field, in bytes MRENCLAVE_LEN = 32 /// The length of the hash of the signer values, in bytes MRSIGNER_LEN = 32 /// The length of the "Q1" signature verification value Q1_LEN = PUBKEY_LEN /// The length of the "Q2" signature verification value Q2_LEN = PUBKEY_LEN RESERVED1_LEN = 84 RESERVED2_LEN = 20 RESERVED3_LEN = 32 RESERVED4_LEN = 12 )
View Source
const ( BULLETPROOF_DOMAIN_TAG = "mc_bulletproof_transcript" AMOUNT_VALUE_DOMAIN_TAG = "mc_amount_value" AMOUNT_TOKEN_ID_DOMAIN_TAG = "mc_amount_token_id" AMOUNT_BLINDING_DOMAIN_TAG = "mc_amount_blinding" HASH_TO_POINT_DOMAIN_TAG = "mc_onetime_key_hash_to_point" HASH_TO_SCALAR_DOMAIN_TAG = "mc_onetime_key_hash_to_scalar" RING_MLSAG_CHALLENGE_DOMAIN_TAG = "mc_ring_mlsag_challenge" TXOUT_CONFIRMATION_NUMBER_DOMAIN_TAG = "mc_tx_out_confirmation_number" AMOUNT_SHARED_SECRET_DOMAIN_TAG = "mc_amount_shared_secret" AMOUNT_BLINDING_FACTORS_DOMAIN_TAG = "mc_amount_blinding_factors" MILLIMOB_TO_PICOMOB = 1_000_000_000 PICOMOB = 1_000_000_000_000 // precision = 12 MOB_MINIMUM_FEE = 400_000_000 MINIMUM_EUSD = 1_000_000 MAX_TOMBSTONE_BLOCKS = 20160 MAX_INPUTS = 16 RING_SIZE = 11 // Each input ring must contain this many elements. )
View Source
const ( PRIMITIVE = "prim" SEQUENCE = "seq" AGGREGATE = "agg" AGGREGATE_END = "agg-end" VARIANT = "var" NONE = "" )
Variables ¶
View Source
var ( ZEROV [84]byte HEADER1 = [16]byte{0x06, 0x00, 0x00, 0x00, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00} HEADER2 = [16]byte{0x01, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00} VENDOR_INTEL = [4]byte{0x00, 0x00, 0x80, 0x86} VENDOR_OTHER [4]byte )
Functions ¶
func AppendPoint ¶
func AppendPoint(label string, p *ristretto.Point, t *merlin.Transcript)
func AppendScalar ¶
func AppendScalar(label string, s *ristretto.Scalar, t *merlin.Transcript)
func ChallengeScalar ¶
func ChallengeScalar(label string, t *merlin.Transcript) *ristretto.Scalar
func ComputeAmountSharedSecretV2 ¶ added in v1.2.2
func ComputeAmountSharedSecretV2(secret *ristretto.Point) []byte
compute_amount_shared_secret
func ComputeCommitmentV2 ¶ added in v1.2.2
compute_commitment
func DecryptEMemoPayload ¶ added in v1.1.1
func DecryptEMemoPayload(encryptedMemoStr, txOutPublicKey, viewPrivateKeyStr, spendPrivateKeyStr string) (string, error)
mc_memo_decrypt_e_memo_payload
func DecryptMemo ¶ added in v1.1.0
func EncryptMemo ¶ added in v1.1.0
func GetBlinding ¶
func GetBlinding(secret *ristretto.Point) *ristretto.Scalar
func GetBlindingFactorsV2 ¶ added in v1.2.2
get_blinding_factors
func GetConsensusEnclave ¶
func GetFogReportResponse ¶
func GetFogReportResponse(address string) (*types.ReportResponse, error)
func GetProductionData ¶
func GetValueFromAmountSharedSecretV2 ¶ added in v1.2.2
get_value_from_amount_shared_secret
func GetValueMask ¶
func GetValueMask(secret *ristretto.Point) uint64
func GetValueV2 ¶ added in v1.2.2
func GetValueWithBlinding ¶
func GetValueWithBlindingNew ¶
func HashOfTxPrefix ¶
Convert tx_prefix to merlin transcript
func InnerproductDomainSep ¶
func InnerproductDomainSep(n uint64, t *merlin.Transcript)
func KeyImageFromPrivate ¶
func KeyImageFromPrivate(private *ristretto.Scalar) *ristretto.Point
func MCAccountKeyGetSubAddressPrivateKeys ¶ added in v1.1.1
func MCTxOutMatchesSubaddress ¶ added in v1.1.1
func MCTxOutReconstructCommitment ¶ added in v1.1.1
func MarshalTxOut ¶ added in v1.1.1
func MarshalTxOutMembershipProof ¶ added in v1.1.1
func MarshalTxOutMembershipProof(proof *TxOutMembershipProof) *types.TxOutMembershipProof
func McTxOutGetSharedSecret ¶ added in v1.1.1
func NewCommitment ¶
func NewCommitment(value uint64, blinding *ristretto.Scalar) *ristretto.Point
func PublicAddressToProtobuf ¶
func PublicAddressToProtobuf(addr *account.PublicAddress) (*types.PublicAddress, error)
Utility method to convert the internal Go PublicAddress to the external GRPC object
func ValidateAddress ¶ added in v1.1.10
func ValidateFogAddressWithEnclave ¶ added in v1.1.10
func ValidateFogAddressWithEnclave(recipient *account.PublicAddress, enclave string) error
Types ¶
type AggregatedGensIter ¶
type AggregatedGensIter struct { Array [][]*ristretto.Point N, M int64 PartyIdX int64 GenIdX int64 }
func (*AggregatedGensIter) Next ¶
func (a *AggregatedGensIter) Next() *ristretto.Point
type Amount ¶
type Amount struct { Commitment string `json:"commitment"` MaskedValue MaskedValue `json:"masked_value"` MaskedTokenID string `json:"masked_token_id"` Version int64 `json:"version"` }
type BulletproofGens ¶
type BulletproofGens struct { GensCapacity int64 PartyCapacity int64 GVec [][]*ristretto.Point HVec [][]*ristretto.Point }
func NewBulletproofGens ¶
func NewBulletproofGens(gensCapacity, partyCapacity int64) *BulletproofGens
func (*BulletproofGens) G ¶
func (b *BulletproofGens) G(n, m int64) *AggregatedGensIter
func (*BulletproofGens) H ¶
func (b *BulletproofGens) H(n, m int64) *AggregatedGensIter
func (*BulletproofGens) IncreaseCapacity ¶
func (b *BulletproofGens) IncreaseCapacity(capacity int64)
func (*BulletproofGens) Share ¶
func (g *BulletproofGens) Share(j int) *BulletproofGensShare
type BulletproofGensShare ¶
type BulletproofGensShare struct {}
func (*BulletproofGensShare) G ¶
func (g *BulletproofGensShare) G(n int64) []*ristretto.Point
func (*BulletproofGensShare) H ¶
func (g *BulletproofGensShare) H(n int64) []*ristretto.Point
type FogFullyValidatedPubkey ¶
type FogFullyValidatedPubkey struct {
// contains filtered or unexported fields
}
type GeneratorsChain ¶
func NewGeneratorsChain ¶
func NewGeneratorsChain(label []byte) *GeneratorsChain
func (*GeneratorsChain) FastForward ¶
func (c *GeneratorsChain) FastForward(n int64)
func (*GeneratorsChain) Next ¶
func (c *GeneratorsChain) Next() *ristretto.Point
type InputC ¶ added in v1.1.1
type InputC struct { ViewPrivate *ristretto.Scalar SpendPrivate *ristretto.Scalar SubAddressSpendPrivate *ristretto.Scalar RealIndex int TxOutWithProofCs []*TxOutWithProofC }
type MaskedValue ¶
type MaskedValue uint64
func (MaskedValue) MarshalJSON ¶
func (mv MaskedValue) MarshalJSON() ([]byte, error)
func (*MaskedValue) UnmarshalJSON ¶
func (mv *MaskedValue) UnmarshalJSON(data []byte) error
type Outlay ¶
type Outlay struct { Value string `json:"value"` Receiver *account.PublicAddress `json:"receiver"` }
type Output ¶ added in v1.1.1
type PedersenGens ¶
type PedersenGens struct { B *ristretto.Point BBlinding *ristretto.Point }
func DefaultPedersenGens ¶
func DefaultPedersenGens() *PedersenGens
func NewPedersenGens ¶
func NewPedersenGens() *PedersenGens
func (*PedersenGens) Commit ¶
func (pg *PedersenGens) Commit(value, blinding *ristretto.Scalar) *ristretto.Point
CommitPedersenGens includes multiscalar_mul
type Proofs ¶
type Proofs struct { Ring []*TxOutWithProof `json:"ring"` Rings [][]*TxOutWithProof `json:"rings"` }
type RingMLSAG ¶
type RingMLSAG struct { CZero string `json:"c_zero"` Responses []string `json:"responses"` KeyImage string `json:"key_image"` }
func UnmarshalRingMLSAG ¶ added in v1.1.1
type Signature ¶
type Signature struct { Header [16]byte Vendor [4]byte Date [4]byte Header2 [16]byte Swdefined [4]byte Reserved1 [RESERVED1_LEN]byte Modulus [384]byte Exponent [4]byte Signature [384]byte Miscselect [4]byte Miscmask [4]byte Reserved2 [RESERVED2_LEN]byte Attributes [16]byte Attributemask [16]byte Enclavehash [32]byte Reserved3 [RESERVED3_LEN]byte Isvprodid [2]byte Isvsvn [2]byte Reserved4 [RESERVED4_LEN]byte Q1 [384]byte Q2 [384]byte }
func ParseSignature ¶
type SignatureRctBulletproofs ¶
type SignatureRctBulletproofs struct { RingSignatures []*RingMLSAG `json:"ring_signatures"` PseudoOutputCommitments []string `json:"pseudo_output_commitments"` RangeProofs string `json:"range_proofs"` }
func UnmarshalSignatureRctBulletproofs ¶ added in v1.1.1
func UnmarshalSignatureRctBulletproofs(signature *types.SignatureRctBulletproofs) *SignatureRctBulletproofs
type TombstoneValue ¶
type TombstoneValue uint64
func (TombstoneValue) MarshalJSON ¶
func (tv TombstoneValue) MarshalJSON() ([]byte, error)
func (*TombstoneValue) UnmarshalJSON ¶
func (tv *TombstoneValue) UnmarshalJSON(data []byte) error
type Tx ¶
type Tx struct { Prefix *TxPrefix `json:"prefix"` Signature *SignatureRctBulletproofs `json:"signature"` }
func UnmarshalTx ¶ added in v1.1.1
type TxC ¶ added in v1.1.1
type TxC struct { Tx []byte TxOut *types.TxOut ConfirmationOut []byte TxOutChange *types.TxOut ConfirmationChange []byte }
func MCTransactionBuilderCreateC ¶ added in v1.1.1
func MCTransactionBuilderCreateCWithEnclave ¶ added in v1.1.7
func MCTransactionBuilderCreateCWithEnclave(inputCs []*InputC, amount, changeAmount, fee, tombstone, memo uint64, tokenID, version uint, recipient, change *account.PublicAddress, enclave string) (*TxC, error)
mc_transaction_builder_create
type TxIn ¶
type TxIn struct { Ring []*TxOut `json:"ring"` Proofs []*TxOutMembershipProof `json:"proofs"` }
type TxOut ¶
type TxOut struct { Amount *Amount `json:"masked_amount"` TargetKey string `json:"target_key"` PublicKey string `json:"public_key"` EFogHint string `json:"e_fog_hint"` EMemo string `json:"e_memo"` }
func UnmarshalTxOut ¶ added in v1.1.1
type TxOutAmount ¶ added in v1.1.1
func MCTxOutGetAmount ¶ added in v1.1.1
func MCTxOutGetAmount(maskedAmountStr, maskedTokenIDStr string, version int64, publicKeyStr, viewPrivateKeyStr string) (*TxOutAmount, error)
type TxOutMembershipElement ¶
type TxOutMembershipProof ¶
type TxOutMembershipProof struct { Index string `json:"index"` HighestIndex string `json:"highest_index"` Elements []*TxOutMembershipElement `json:"elements"` }
func UnmarshalTxOutMembershipProof ¶ added in v1.1.1
func UnmarshalTxOutMembershipProof(proof *types.TxOutMembershipProof) *TxOutMembershipProof
type TxOutWithProof ¶
type TxOutWithProof struct { TxOut *TxOut `json:"tx_out"` Proof *TxOutMembershipProof `json:"proof"` }
type TxOutWithProofC ¶ added in v1.1.1
type TxOutWithProofC struct { TxOut *types.TxOut TxOutMembershipProof *types.TxOutMembershipProof }
type TxPrefix ¶
type TxPrefix struct { Inputs []*TxIn `json:"inputs"` Outputs []*TxOut `json:"outputs"` Fee FeeValue `json:"fee"` TombstoneBlock TombstoneValue `json:"tombstone_block"` }
func UnmarshalPrefix ¶ added in v1.1.1
type TxProposal ¶
type UnspentTxOut ¶
type UnspentTxOut struct { TxOut *TxOut `json:"tx_out"` SubaddressIndex uint64 `json:"subaddress_index"` KeyImage string `json:"key_image"` Value string `json:"value"` AttemptedSpendHeight uint64 `json:"attempted_spend_height"` AttemptedSpendTombstone uint64 `json:"attempted_spend_tombstone"` MonitorId string `json:"monitor_id"` }
Click to show internal directories.
Click to hide internal directories.