Documentation
¶
Overview ¶
Package transaction defines transaction logic for the Nym application.
Index ¶
- Constants
- func CreateCredentialRequest(privateKey *ecdsa.PrivateKey, pipeAccountAddress ethcommon.Address, ...) ([]byte, error)
- func CreateNewAccountRequest(privateKey *ecdsa.PrivateKey, credential []byte) ([]byte, error)
- func CreateNewDepositCoconutCredentialRequest(protoSig *coconut.ProtoSignature, pubMb [][]byte, ...) ([]byte, error)
- func CreateNewTransferRequest(sourcePrivateKey *ecdsa.PrivateKey, targetAddress ethcommon.Address, ...) ([]byte, error)
- func CreateNewTransferToPipeAccountNotification(privateKey *ecdsa.PrivateKey, clientAddress ethcommon.Address, ...) ([]byte, error)
- func NewLookUpZetaTx(zeta *Curve.ECP) []byte
- type AccountTransferRequest
- func (*AccountTransferRequest) Descriptor() ([]byte, []int)
- func (m *AccountTransferRequest) GetAmount() uint64
- func (m *AccountTransferRequest) GetNonce() []byte
- func (m *AccountTransferRequest) GetSig() []byte
- func (m *AccountTransferRequest) GetSourceAddress() []byte
- func (m *AccountTransferRequest) GetTargetAddress() []byte
- func (*AccountTransferRequest) ProtoMessage()
- func (m *AccountTransferRequest) Reset()
- func (m *AccountTransferRequest) String() string
- func (m *AccountTransferRequest) XXX_DiscardUnknown()
- func (m *AccountTransferRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountTransferRequest) XXX_Merge(src proto.Message)
- func (m *AccountTransferRequest) XXX_Size() int
- func (m *AccountTransferRequest) XXX_Unmarshal(b []byte) error
- type CredentialRequest
- func (*CredentialRequest) Descriptor() ([]byte, []int)
- func (m *CredentialRequest) GetClientAddress() []byte
- func (m *CredentialRequest) GetCryptoMaterials() *scheme.ProtoBlindSignMaterials
- func (m *CredentialRequest) GetNonce() []byte
- func (m *CredentialRequest) GetPipeAccountAddress() []byte
- func (m *CredentialRequest) GetSig() []byte
- func (m *CredentialRequest) GetValue() int64
- func (*CredentialRequest) ProtoMessage()
- func (m *CredentialRequest) Reset()
- func (m *CredentialRequest) String() string
- func (m *CredentialRequest) XXX_DiscardUnknown()
- func (m *CredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CredentialRequest) XXX_Merge(src proto.Message)
- func (m *CredentialRequest) XXX_Size() int
- func (m *CredentialRequest) XXX_Unmarshal(b []byte) error
- type DepositCoconutCredentialRequest
- func (*DepositCoconutCredentialRequest) Descriptor() ([]byte, []int)
- func (m *DepositCoconutCredentialRequest) GetProviderAddress() []byte
- func (m *DepositCoconutCredentialRequest) GetPubM() [][]byte
- func (m *DepositCoconutCredentialRequest) GetSig() *scheme.ProtoSignature
- func (m *DepositCoconutCredentialRequest) GetTheta() *scheme.ProtoThetaTumbler
- func (m *DepositCoconutCredentialRequest) GetValue() int64
- func (*DepositCoconutCredentialRequest) ProtoMessage()
- func (m *DepositCoconutCredentialRequest) Reset()
- func (m *DepositCoconutCredentialRequest) String() string
- func (m *DepositCoconutCredentialRequest) XXX_DiscardUnknown()
- func (m *DepositCoconutCredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DepositCoconutCredentialRequest) XXX_Merge(src proto.Message)
- func (m *DepositCoconutCredentialRequest) XXX_Size() int
- func (m *DepositCoconutCredentialRequest) XXX_Unmarshal(b []byte) error
- type NewAccountRequest
- func (*NewAccountRequest) Descriptor() ([]byte, []int)
- func (m *NewAccountRequest) GetAddress() []byte
- func (m *NewAccountRequest) GetCredential() []byte
- func (m *NewAccountRequest) GetSig() []byte
- func (*NewAccountRequest) ProtoMessage()
- func (m *NewAccountRequest) Reset()
- func (m *NewAccountRequest) String() string
- func (m *NewAccountRequest) XXX_DiscardUnknown()
- func (m *NewAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NewAccountRequest) XXX_Merge(src proto.Message)
- func (m *NewAccountRequest) XXX_Size() int
- func (m *NewAccountRequest) XXX_Unmarshal(b []byte) error
- type TransferToPipeAccountNotification
- func (*TransferToPipeAccountNotification) Descriptor() ([]byte, []int)
- func (m *TransferToPipeAccountNotification) GetAmount() uint64
- func (m *TransferToPipeAccountNotification) GetClientAddress() []byte
- func (m *TransferToPipeAccountNotification) GetPipeAccountAddress() []byte
- func (m *TransferToPipeAccountNotification) GetSig() []byte
- func (m *TransferToPipeAccountNotification) GetTxHash() []byte
- func (m *TransferToPipeAccountNotification) GetWatcherPublicKey() []byte
- func (*TransferToPipeAccountNotification) ProtoMessage()
- func (m *TransferToPipeAccountNotification) Reset()
- func (m *TransferToPipeAccountNotification) String() string
- func (m *TransferToPipeAccountNotification) XXX_DiscardUnknown()
- func (m *TransferToPipeAccountNotification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TransferToPipeAccountNotification) XXX_Merge(src proto.Message)
- func (m *TransferToPipeAccountNotification) XXX_Size() int
- func (m *TransferToPipeAccountNotification) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( // TxTypeLookUpZeta is byte prefix for transaction to check for presence of zeta. TxTypeLookUpZeta byte = 0x01 // TxNewAccount is byte prefix for transaction to create new account. TxNewAccount byte = 0x02 // TxTransferBetweenAccounts is byte prefix for transaction to transfer funds between 2 accounts. for debug TxTransferBetweenAccounts byte = 0x03 // // TxTransferToPipeAccount is byte prefix for transaction to transfer client's funds to pipe account. // TxTransferToPipeAccount byte = 0x04 // TxDepositCoconutCredential is byte prefix for transaction to deposit a coconut credential (+ transfer funds). TxDepositCoconutCredential byte = 0xa0 // TxTransferToPipeAccountNotification is byte prefix for transaction notifying tendermint nodes about // transfer to pipe account that happened on ethereum chain TxTransferToPipeAccountNotification byte = 0xa1 // TxCredentialRequest is byte prefix for transaction indicating client wanting to convert some of its tokens // into a credential TxCredentialRequest byte = 0xa2 // TxAdvanceBlock is byte prefix for transaction to store entire tx block in db to advance the blocks. TxAdvanceBlock byte = 0xff // entirely for debug purposes )
Variables ¶
This section is empty.
Functions ¶
func CreateCredentialRequest ¶
func CreateCredentialRequest(privateKey *ecdsa.PrivateKey, pipeAccountAddress ethcommon.Address, bsm *coconut.BlindSignMaterials, value int64, ) ([]byte, error)
func CreateNewAccountRequest ¶
func CreateNewAccountRequest(privateKey *ecdsa.PrivateKey, credential []byte) ([]byte, error)
CreateNewAccountRequest creates new request for tx for new account creation.
func CreateNewDepositCoconutCredentialRequest ¶
func CreateNewDepositCoconutCredentialRequest( protoSig *coconut.ProtoSignature, pubMb [][]byte, protoThetaTumbler *coconut.ProtoThetaTumbler, value int64, address ethcommon.Address, ) ([]byte, error)
CreateNewDepositCoconutCredentialRequest creates new request for tx to send credential created out of given token (that is bound to particular merchant address) to be spent.
func CreateNewTransferRequest ¶
func CreateNewTransferRequest(sourcePrivateKey *ecdsa.PrivateKey, targetAddress ethcommon.Address, amount uint64, ) ([]byte, error)
CreateNewTransferRequest creates new request for tx to transfer funds from one account to another. Currently and possibly only for debug purposes to freely transfer tokens between accounts to setup different scenarios.
func NewLookUpZetaTx ¶
NewLookUpZetaTx creates new request for tx to lookup provided zeta.
Types ¶
type AccountTransferRequest ¶
type AccountTransferRequest struct { // Used to validate signature + determine source address SourceAddress []byte `protobuf:"bytes,1,opt,name=SourceAddress,json=sourceAddress,proto3" json:"SourceAddress,omitempty"` // Used to determine target address TargetAddress []byte `protobuf:"bytes,2,opt,name=TargetAddress,json=targetAddress,proto3" json:"TargetAddress,omitempty"` // Amount to be transferred Amount uint64 `protobuf:"varint,3,opt,name=Amount,json=amount,proto3" json:"Amount,omitempty"` // While this function will only be available in debug and hence a nonce is really not needed, // I figured I should include it anyway as it's a good practice + will need to figure out a proper // nonce system anyway. Nonce []byte `protobuf:"bytes,4,opt,name=Nonce,json=nonce,proto3" json:"Nonce,omitempty"` // Signature on request to confirm its validitiy Sig []byte `protobuf:"bytes,5,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
DEBUG
func (*AccountTransferRequest) Descriptor ¶
func (*AccountTransferRequest) Descriptor() ([]byte, []int)
func (*AccountTransferRequest) GetAmount ¶
func (m *AccountTransferRequest) GetAmount() uint64
func (*AccountTransferRequest) GetNonce ¶
func (m *AccountTransferRequest) GetNonce() []byte
func (*AccountTransferRequest) GetSig ¶
func (m *AccountTransferRequest) GetSig() []byte
func (*AccountTransferRequest) GetSourceAddress ¶
func (m *AccountTransferRequest) GetSourceAddress() []byte
func (*AccountTransferRequest) GetTargetAddress ¶
func (m *AccountTransferRequest) GetTargetAddress() []byte
func (*AccountTransferRequest) ProtoMessage ¶
func (*AccountTransferRequest) ProtoMessage()
func (*AccountTransferRequest) Reset ¶
func (m *AccountTransferRequest) Reset()
func (*AccountTransferRequest) String ¶
func (m *AccountTransferRequest) String() string
func (*AccountTransferRequest) XXX_DiscardUnknown ¶
func (m *AccountTransferRequest) XXX_DiscardUnknown()
func (*AccountTransferRequest) XXX_Marshal ¶
func (m *AccountTransferRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AccountTransferRequest) XXX_Merge ¶
func (m *AccountTransferRequest) XXX_Merge(src proto.Message)
func (*AccountTransferRequest) XXX_Size ¶
func (m *AccountTransferRequest) XXX_Size() int
func (*AccountTransferRequest) XXX_Unmarshal ¶
func (m *AccountTransferRequest) XXX_Unmarshal(b []byte) error
type CredentialRequest ¶
type CredentialRequest struct { // Ethereum address of the client ClientAddress []byte `protobuf:"bytes,1,opt,name=ClientAddress,json=clientAddress,proto3" json:"ClientAddress,omitempty"` // While right now it's completely unrequired as there is only a single pipe account, it might be useful // to have this information in the future if we decided to monitor multiple chains or have multiple pipe accounts // for example on epoch changes. PipeAccountAddress []byte `protobuf:"bytes,2,opt,name=PipeAccountAddress,json=pipeAccountAddress,proto3" json:"PipeAccountAddress,omitempty"` // All the cryptographic materials required by issuers to perform a blind sign CryptoMaterials *scheme.ProtoBlindSignMaterials `protobuf:"bytes,3,opt,name=CryptoMaterials,json=cryptoMaterials,proto3" json:"CryptoMaterials,omitempty"` // Value of the credential. While it is included in a BIG form in CryptoMaterials, it's easier to operate on it // when it's an int. We can't send it as an uint64, as milagro requires a normal int argument to construct a BIG num. Value int64 `protobuf:"varint,4,opt,name=Value,json=value,proto3" json:"Value,omitempty"` // Required to prevent replay attacks. Nonce []byte `protobuf:"bytes,5,opt,name=Nonce,json=nonce,proto3" json:"Nonce,omitempty"` // Signature on entire request with client's ethereum key (so that client's address could be used to verify it) Sig []byte `protobuf:"bytes,6,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CredentialRequest) Descriptor ¶
func (*CredentialRequest) Descriptor() ([]byte, []int)
func (*CredentialRequest) GetClientAddress ¶
func (m *CredentialRequest) GetClientAddress() []byte
func (*CredentialRequest) GetCryptoMaterials ¶
func (m *CredentialRequest) GetCryptoMaterials() *scheme.ProtoBlindSignMaterials
func (*CredentialRequest) GetNonce ¶
func (m *CredentialRequest) GetNonce() []byte
func (*CredentialRequest) GetPipeAccountAddress ¶
func (m *CredentialRequest) GetPipeAccountAddress() []byte
func (*CredentialRequest) GetSig ¶
func (m *CredentialRequest) GetSig() []byte
func (*CredentialRequest) GetValue ¶
func (m *CredentialRequest) GetValue() int64
func (*CredentialRequest) ProtoMessage ¶
func (*CredentialRequest) ProtoMessage()
func (*CredentialRequest) Reset ¶
func (m *CredentialRequest) Reset()
func (*CredentialRequest) String ¶
func (m *CredentialRequest) String() string
func (*CredentialRequest) XXX_DiscardUnknown ¶
func (m *CredentialRequest) XXX_DiscardUnknown()
func (*CredentialRequest) XXX_Marshal ¶
func (m *CredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CredentialRequest) XXX_Merge ¶
func (m *CredentialRequest) XXX_Merge(src proto.Message)
func (*CredentialRequest) XXX_Size ¶
func (m *CredentialRequest) XXX_Size() int
func (*CredentialRequest) XXX_Unmarshal ¶
func (m *CredentialRequest) XXX_Unmarshal(b []byte) error
type DepositCoconutCredentialRequest ¶
type DepositCoconutCredentialRequest struct { // The actual credential Sig *scheme.ProtoSignature `protobuf:"bytes,1,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"` // The public attributes in credential. Note that pubM[0] = BIG(value) PubM [][]byte `protobuf:"bytes,2,rep,name=PubM,json=pubM,proto3" json:"PubM,omitempty"` // Crypto materials to verify the credential + required NIZK Theta *scheme.ProtoThetaTumbler `protobuf:"bytes,3,opt,name=Theta,json=theta,proto3" json:"Theta,omitempty"` // Value of the credential. While it is included in a BIG form in CryptoMaterials, it's easier to operate on it // when it's an int. We can't send it as an uint64, as milagro requires a normal int argument to construct a BIG num. Value int64 `protobuf:"varint,4,opt,name=Value,json=value,proto3" json:"Value,omitempty"` // Address of the service provider to which the proof is bound and whose account balance will be increased ProviderAddress []byte `protobuf:"bytes,5,opt,name=ProviderAddress,json=providerAddress,proto3" json:"ProviderAddress,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DepositCoconutCredentialRequest) Descriptor ¶
func (*DepositCoconutCredentialRequest) Descriptor() ([]byte, []int)
func (*DepositCoconutCredentialRequest) GetProviderAddress ¶
func (m *DepositCoconutCredentialRequest) GetProviderAddress() []byte
func (*DepositCoconutCredentialRequest) GetPubM ¶
func (m *DepositCoconutCredentialRequest) GetPubM() [][]byte
func (*DepositCoconutCredentialRequest) GetSig ¶
func (m *DepositCoconutCredentialRequest) GetSig() *scheme.ProtoSignature
func (*DepositCoconutCredentialRequest) GetTheta ¶
func (m *DepositCoconutCredentialRequest) GetTheta() *scheme.ProtoThetaTumbler
func (*DepositCoconutCredentialRequest) GetValue ¶
func (m *DepositCoconutCredentialRequest) GetValue() int64
func (*DepositCoconutCredentialRequest) ProtoMessage ¶
func (*DepositCoconutCredentialRequest) ProtoMessage()
func (*DepositCoconutCredentialRequest) Reset ¶
func (m *DepositCoconutCredentialRequest) Reset()
func (*DepositCoconutCredentialRequest) String ¶
func (m *DepositCoconutCredentialRequest) String() string
func (*DepositCoconutCredentialRequest) XXX_DiscardUnknown ¶
func (m *DepositCoconutCredentialRequest) XXX_DiscardUnknown()
func (*DepositCoconutCredentialRequest) XXX_Marshal ¶
func (m *DepositCoconutCredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DepositCoconutCredentialRequest) XXX_Merge ¶
func (m *DepositCoconutCredentialRequest) XXX_Merge(src proto.Message)
func (*DepositCoconutCredentialRequest) XXX_Size ¶
func (m *DepositCoconutCredentialRequest) XXX_Size() int
func (*DepositCoconutCredentialRequest) XXX_Unmarshal ¶
func (m *DepositCoconutCredentialRequest) XXX_Unmarshal(b []byte) error
type NewAccountRequest ¶
type NewAccountRequest struct { // Public Key of the user used to derive account address and validate signature Address []byte `protobuf:"bytes,1,opt,name=Address,json=address,proto3" json:"Address,omitempty"` // represents some optional credential from an IP if required Credential []byte `protobuf:"bytes,2,opt,name=Credential,json=credential,proto3" json:"Credential,omitempty"` // Signature on request to confirm its validity + asserts knowledge of private key Sig []byte `protobuf:"bytes,3,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NewAccountRequest) Descriptor ¶
func (*NewAccountRequest) Descriptor() ([]byte, []int)
func (*NewAccountRequest) GetAddress ¶
func (m *NewAccountRequest) GetAddress() []byte
func (*NewAccountRequest) GetCredential ¶
func (m *NewAccountRequest) GetCredential() []byte
func (*NewAccountRequest) GetSig ¶
func (m *NewAccountRequest) GetSig() []byte
func (*NewAccountRequest) ProtoMessage ¶
func (*NewAccountRequest) ProtoMessage()
func (*NewAccountRequest) Reset ¶
func (m *NewAccountRequest) Reset()
func (*NewAccountRequest) String ¶
func (m *NewAccountRequest) String() string
func (*NewAccountRequest) XXX_DiscardUnknown ¶
func (m *NewAccountRequest) XXX_DiscardUnknown()
func (*NewAccountRequest) XXX_Marshal ¶
func (m *NewAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NewAccountRequest) XXX_Merge ¶
func (m *NewAccountRequest) XXX_Merge(src proto.Message)
func (*NewAccountRequest) XXX_Size ¶
func (m *NewAccountRequest) XXX_Size() int
func (*NewAccountRequest) XXX_Unmarshal ¶
func (m *NewAccountRequest) XXX_Unmarshal(b []byte) error
type TransferToPipeAccountNotification ¶
type TransferToPipeAccountNotification struct { // Used to identify the particular watcher and to verify signature WatcherPublicKey []byte `protobuf:"bytes,1,opt,name=WatcherPublicKey,json=watcherPublicKey,proto3" json:"WatcherPublicKey,omitempty"` // Ethereum address of the client ClientAddress []byte `protobuf:"bytes,2,opt,name=ClientAddress,json=clientAddress,proto3" json:"ClientAddress,omitempty"` // While right now it's completely unrequired as there is only a single pipe account, it might be useful // to have this information in the future if we decided to monitor multiple chains or have multiple pipe accounts // for example on epoch changes. PipeAccountAddress []byte `protobuf:"bytes,3,opt,name=PipeAccountAddress,json=pipeAccountAddress,proto3" json:"PipeAccountAddress,omitempty"` // Amount transferred by the client to the pipe account. Amount uint64 `protobuf:"varint,4,opt,name=Amount,json=amount,proto3" json:"Amount,omitempty"` // Hash of the transaction in which the transfer occured. // Used to distinguish from multiple transfers the client might have done. TxHash []byte `protobuf:"bytes,5,opt,name=TxHash,json=txHash,proto3" json:"TxHash,omitempty"` // Signature on the entire message done with the watcher's key. Sig []byte `protobuf:"bytes,6,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TransferToPipeAccountNotification) Descriptor ¶
func (*TransferToPipeAccountNotification) Descriptor() ([]byte, []int)
func (*TransferToPipeAccountNotification) GetAmount ¶
func (m *TransferToPipeAccountNotification) GetAmount() uint64
func (*TransferToPipeAccountNotification) GetClientAddress ¶
func (m *TransferToPipeAccountNotification) GetClientAddress() []byte
func (*TransferToPipeAccountNotification) GetPipeAccountAddress ¶
func (m *TransferToPipeAccountNotification) GetPipeAccountAddress() []byte
func (*TransferToPipeAccountNotification) GetSig ¶
func (m *TransferToPipeAccountNotification) GetSig() []byte
func (*TransferToPipeAccountNotification) GetTxHash ¶
func (m *TransferToPipeAccountNotification) GetTxHash() []byte
func (*TransferToPipeAccountNotification) GetWatcherPublicKey ¶
func (m *TransferToPipeAccountNotification) GetWatcherPublicKey() []byte
func (*TransferToPipeAccountNotification) ProtoMessage ¶
func (*TransferToPipeAccountNotification) ProtoMessage()
func (*TransferToPipeAccountNotification) Reset ¶
func (m *TransferToPipeAccountNotification) Reset()
func (*TransferToPipeAccountNotification) String ¶
func (m *TransferToPipeAccountNotification) String() string
func (*TransferToPipeAccountNotification) XXX_DiscardUnknown ¶
func (m *TransferToPipeAccountNotification) XXX_DiscardUnknown()
func (*TransferToPipeAccountNotification) XXX_Marshal ¶
func (m *TransferToPipeAccountNotification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TransferToPipeAccountNotification) XXX_Merge ¶
func (m *TransferToPipeAccountNotification) XXX_Merge(src proto.Message)
func (*TransferToPipeAccountNotification) XXX_Size ¶
func (m *TransferToPipeAccountNotification) XXX_Size() int
func (*TransferToPipeAccountNotification) XXX_Unmarshal ¶
func (m *TransferToPipeAccountNotification) XXX_Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.