example

package
v1.1.0-preview Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App - a sample fund transfer app

func ConstructAppInstance

func ConstructAppInstance(ledger ledger.PeerLedger) *App

ConstructAppInstance constructs an instance of an app

func (*App) Init

func (app *App) Init(initialBalances map[string]int) (*common.Envelope, error)

Init simulates init transaction

func (*App) QueryBalances

func (app *App) QueryBalances(accounts []string) ([]int, error)

QueryBalances queries the balance funds

func (*App) TransferFunds

func (app *App) TransferFunds(fromAccount string, toAccount string, transferAmt int) (*common.Envelope, error)

TransferFunds simulates a transaction for transferring fund from fromAccount to toAccount

type Committer

type Committer struct {
	// contains filtered or unexported fields
}

Committer a toy committer

func ConstructCommitter

func ConstructCommitter(ledger ledger.PeerLedger) *Committer

ConstructCommitter constructs a committer for the example

func (*Committer) Commit

func (c *Committer) Commit(rawBlock *common.Block) error

Commit commits the block

type Consenter

type Consenter struct {
	// contains filtered or unexported fields
}

Consenter - a toy Consenter

func ConstructConsenter

func ConstructConsenter() *Consenter

ConstructConsenter constructs a consenter for example

func (*Consenter) ConstructBlock

func (c *Consenter) ConstructBlock(transactions ...*common.Envelope) *common.Block

ConstructBlock constructs a block from a list of transactions

type Marble

type Marble struct {
	Name  string `json:"asset_name"` //the fieldtags are needed to keep case from bouncing around
	Color string `json:"color"`
	Size  int    `json:"size"`
	User  string `json:"owner"`
	Rev   string `json:"_rev"`
	Txid  string `json:"txid"`
}

type MarbleApp

type MarbleApp struct {
	// contains filtered or unexported fields
}

App - a sample fund transfer app

func ConstructMarbleAppInstance

func ConstructMarbleAppInstance(ledger ledger.PeerLedger) *MarbleApp

ConstructAppInstance constructs an instance of an app

func (*MarbleApp) CreateMarble

func (marbleApp *MarbleApp) CreateMarble(args []string) (*common.Envelope, error)

CreateMarble simulates init transaction

func (*MarbleApp) TransferMarble

func (marbleApp *MarbleApp) TransferMarble(args []string) (*common.Envelope, error)

TransferMarble simulates transfer transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL