Documentation
¶
Overview ¶
Package value implements a simple native contract that can store, delete, and display values.
Index ¶
Constants ¶
View Source
const ( // ContractUID is the unique (4-bytes) identifier of the contract, it is // used to prefix keys in the K/V store and by DARCs for access control. ContractUID = "VALU" // ContractName is the name of the contract. ContractName = "go.dedis.ch/dela.Value" // KeyArg is the argument's name in the transaction that contains the // provided key to update. KeyArg = "value:key" // ValueArg is the argument's name in the transaction that contains the // provided value to set. ValueArg = "value:value" // CmdArg is the argument's name to indicate the kind of command we want to // run on the contract. Should be one of the Command type. CmdArg = "value:command" // CredentialAllCommand defines the credential command that is allowed to // perform all commands. CredentialAllCommand = "all" )
Variables ¶
This section is empty.
Functions ¶
func NewCreds ¶
func NewCreds() access.Credential
NewCreds creates new credentials for a value contract execution. We might want to use in the future a separate credential for each command.
func RegisterContract ¶
RegisterContract registers the value contract to the given execution service.
Types ¶
type Command ¶
type Command string
Command defines a type of command for the value contract
const ( // CmdWrite defines the command to write a value CmdWrite Command = "WRITE" // CmdRead defines a command to read a value CmdRead Command = "READ" // CmdDelete defines a command to delete a value CmdDelete Command = "DELETE" // CmdList defines a command to list all values set (and not deleted) // so far. CmdList Command = "LIST" )
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract is a simple smart contract that allows one to handle the storage by performing CRUD operations.
- implements native.Contract
func NewContract ¶
NewContract creates a new Value contract
Click to show internal directories.
Click to hide internal directories.