Documentation ¶
Index ¶
- type AppData
- type ExeContext
- func (ctx *ExeContext) CreateTxHeader(txh *TxHeader, data *AppData)
- func (ctx *ExeContext) FixedTransaction(inSize uint8, outSize uint8) *Transaction
- func (ctx *ExeContext) FromBytes(arr []byte, tx *Transaction) bool
- func (ctx *ExeContext) GetTxHeaderIdentifier(tx *Transaction, txBytes []byte) (bool, []byte, *string)
- func (ctx *ExeContext) InsertTxHeader(txn int, tx *Transaction) (bool, *string)
- func (ctx *ExeContext) ModDiv(a []byte, b []byte) (c []byte)
- func (ctx *ExeContext) ModMul(a []byte, b []byte) (c []byte)
- func (ctx *ExeContext) PrepareAppDataClient(data *AppData) (bool, error)
- func (ctx *ExeContext) PrepareAppDataPeer(data *AppData) (bool, error)
- func (ctx *ExeContext) PrepareAppDataPeerWithTemps(data *AppData) (bool, error)
- func (ctx *ExeContext) PrintDetails()
- func (ctx *ExeContext) RandomAppData(data *AppData, inSize uint8, outSize uint8, averageSize uint16)
- func (ctx *ExeContext) RandomTransaction() *Transaction
- func (ctx *ExeContext) ToBytes(tx *Transaction) []byte
- func (ctx *ExeContext) UpdateAppDataClient(data *AppData) (bool, error)
- func (ctx *ExeContext) UpdateAppDataPeer(txNum int, tx *Transaction) (bool, *string)
- func (ctx *ExeContext) UpdateAppDataPeerToTemp(txNum int, tx *Transaction) (bool, *string)
- func (ctx *ExeContext) VerifyIncomingTransaction(tx *Transaction) (bool, *string)
- func (ctx *ExeContext) VerifyIncomingTransactionWithTemp(tx *Transaction) (bool, *string)
- func (ctx *ExeContext) VerifyStoredAllTransaction() (bool, *string)
- func (ctx *ExeContext) VerifyTxHeader(txh *TxHeader, data *AppData) (bool, *string)
- type Generator
- type InputData
- type OutputData
- type Pubkey
- type SigKeyPair
- type Signature
- type SignatureContext
- type Suite
- type TempUser
- type Transaction
- type TxHeader
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppData ¶
type AppData struct { Inputs []InputData `json:"i"` // inputs as a byte array Outputs []OutputData `json:"o"` // outputs as a byte array }
type ExeContext ¶
type ExeContext struct { AverageInputMax uint8 // average number of inputs will be in [0, AverageInputMax] AverageOutputMax uint8 // average number of outputs will be in [0, AverageOutputMax] PublicKeyReuse int // (UTXO models) when a new output is created whether to reuse the input public key or // not will be decided from this such that probability of reuse = 1/publicKeyReuse TotalUsers int // (ACC models) total number of users represented if this is a client TotalTx int // total number of transactions if this is a peer TotalBlock int // total number of blocks if this is a peer TotalTempUsers int // maximum number of temp users TempUsers map[[sha256.Size]byte]TempUser TempPKs map[[128]byte]int TempTxH map[int][]byte // only used for origami accounts CurrentUsers int CurrentUsersWithTemp int CurrentOutputs int // in Origami, CurrentUsers = CurrentOutputs CurrentOutputsWithTemp int // in Origami, CurrentUsers = CurrentOutputs DeletedOutputs int // // contains filtered or unexported fields }
func NewContext ¶
func (*ExeContext) CreateTxHeader ¶
func (ctx *ExeContext) CreateTxHeader(txh *TxHeader, data *AppData)
CreateTxHeader creates a transaction header
func (*ExeContext) FixedTransaction ¶
func (ctx *ExeContext) FixedTransaction(inSize uint8, outSize uint8) *Transaction
func (*ExeContext) FromBytes ¶
func (ctx *ExeContext) FromBytes(arr []byte, tx *Transaction) bool
func (*ExeContext) GetTxHeaderIdentifier ¶
func (ctx *ExeContext) GetTxHeaderIdentifier(tx *Transaction, txBytes []byte) (bool, []byte, *string)
GetTxHeaderIdentifier outputs an identifier a special hash to be included into the tx block hash computation for classics: hash is the hash of the entire transaction for origami: hash is the hash of (activity, all account pks)
func (*ExeContext) InsertTxHeader ¶
func (ctx *ExeContext) InsertTxHeader(txn int, tx *Transaction) (bool, *string)
InsertTxHeader adds a transaction header, which was verified before.
func (*ExeContext) ModDiv ¶
func (ctx *ExeContext) ModDiv(a []byte, b []byte) (c []byte)
ModDiv h0 = (h0 * h1^{-1}) % q
func (*ExeContext) ModMul ¶
func (ctx *ExeContext) ModMul(a []byte, b []byte) (c []byte)
ModMul h0 = (h0 * h1) % q
func (*ExeContext) PrepareAppDataClient ¶
func (ctx *ExeContext) PrepareAppDataClient(data *AppData) (bool, error)
PrepareAppDataClient get user details for inputs using the header
func (*ExeContext) PrepareAppDataPeer ¶
func (ctx *ExeContext) PrepareAppDataPeer(data *AppData) (bool, error)
PrepareAppDataPeer get output details for inputs using the header
func (*ExeContext) PrepareAppDataPeerWithTemps ¶
func (ctx *ExeContext) PrepareAppDataPeerWithTemps(data *AppData) (bool, error)
PrepareAppDataPeerWithTemps get output details for inputs using the header. Note that it also checks temporary users
func (*ExeContext) PrintDetails ¶
func (ctx *ExeContext) PrintDetails()
func (*ExeContext) RandomAppData ¶
func (ctx *ExeContext) RandomAppData(data *AppData, inSize uint8, outSize uint8, averageSize uint16)
RandomAppData creates an application data change for randomly chosen users
func (*ExeContext) RandomTransaction ¶
func (ctx *ExeContext) RandomTransaction() *Transaction
RandomTransaction outputs a transaction according to the sigType and txModel txModel:1 - classicUTXO txModel:2 - classicACC txModel:3 - classicAUTXO txModel:4 - classicAACC txModel:5 - origamiUTXO txModel:6 - origamiACC
func (*ExeContext) ToBytes ¶
func (ctx *ExeContext) ToBytes(tx *Transaction) []byte
func (*ExeContext) UpdateAppDataClient ¶
func (ctx *ExeContext) UpdateAppDataClient(data *AppData) (bool, error)
UpdateAppDataClient update user details for new app data changes
func (*ExeContext) UpdateAppDataPeer ¶
func (ctx *ExeContext) UpdateAppDataPeer(txNum int, tx *Transaction) (bool, *string)
UpdateAppDataPeer update output details for new app data changes
func (*ExeContext) UpdateAppDataPeerToTemp ¶
func (ctx *ExeContext) UpdateAppDataPeerToTemp(txNum int, tx *Transaction) (bool, *string)
UpdateAppDataPeerToTemp update output details for new app data changes
func (*ExeContext) VerifyIncomingTransaction ¶
func (ctx *ExeContext) VerifyIncomingTransaction(tx *Transaction) (bool, *string)
VerifyIncomingTransaction verifies a raw transaction
func (*ExeContext) VerifyIncomingTransactionWithTemp ¶
func (ctx *ExeContext) VerifyIncomingTransactionWithTemp(tx *Transaction) (bool, *string)
VerifyIncomingTransactionWithTemp verifies a raw transaction including temps
func (*ExeContext) VerifyStoredAllTransaction ¶
func (ctx *ExeContext) VerifyStoredAllTransaction() (bool, *string)
VerifyStoredAllTransaction verifies all stored transactions
func (*ExeContext) VerifyTxHeader ¶
func (ctx *ExeContext) VerifyTxHeader(txh *TxHeader, data *AppData) (bool, *string)
VerifyTxHeader verifies a transaction header
type InputData ¶
type InputData struct { Header []byte `json:"h"` // identifier like a hash // contains filtered or unexported fields }
type OutputData ¶
type SigKeyPair ¶
type SigKeyPair struct { Pk kyber.Point `json:"p"` Sk kyber.Scalar `json:"s"` }
type SignatureContext ¶
type SignatureContext struct { SigType int32 // signature module SkSize int32 PkSize int32 SigSize int32 // contains filtered or unexported fields }
func NewSigContext ¶
func NewSigContext(sigType int32) *SignatureContext
NewSigContext assigns ctx objects 1 - Schnorr 2 - BLS
type Transaction ¶
type TxHeader ¶
type TxHeader struct { Kyber []Signature `json:"k"` // signatures // contains filtered or unexported fields }
type User ¶
type User struct { H []byte `json:"H"` // hash N uint8 `json:"N"` // number of outputs created by the user Keys []byte `json:"Keys"` // pk with/out sk Data []byte `json:"Data"` // most recent application Data UDelta []byte `json:"UDelta"` // could be empty Txns []int `json:"txns"` // for origami-header identifier // contains filtered or unexported fields }