Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct {
	Version         uint16
	SenderPubKey    *ecdsa.PublicKey
	SigLen          uint8  // len of the signature
	Signature       []byte // size varies
	RecipPubKeyHash []byte // 32 bytes
	Value           uint64
	StateNonce      uint64
}
    Version Sender Public Key Signature Length Signature Recipient Public Key Hash Value
func New ¶
func New(version uint16, sender *ecdsa.PrivateKey, recipient []byte, value uint64, nextStateNonce uint64) (*Contract, error)
version field comes from version parameter sender public key comes from sender private key signature comes from calling sign contract signature length comes from signature recipient pk hash comes from sha-256 hash of rpk value is value parameter returns contract struct
func (*Contract) Deserialize ¶
Deserialize into a struct
func (*Contract) Marshal ¶
func (c *Contract) Marshal() (JSONContract, error)
Marshal takes a Contract and returns a JSONContract
type JSONContract ¶
type JSONContract struct {
	Version                uint16
	SenderPublicKey        string
	SignatureLength        uint8
	Signature              string
	RecipientWalletAddress string
	Value                  uint64
	StateNonce             uint64
}
    func (*JSONContract) Unmarshal ¶
func (mc *JSONContract) Unmarshal() (Contract, error)
Unmarshal takes a JSONContract and returns a Contract
 Click to show internal directories. 
   Click to hide internal directories.