package
0.1.2
Repository: https://github.com/statechannels/go-nitro.git
Documentation: pkg.go.dev

# README

Off-chain protocols

This package defines the off-chain protocols for managing channels. These protocols are abstract rules which nodes should follow in order to reach a desired goal.

To implement the protocols, we make use of an abstraction we call the Objective. Objectives are named for the goal which the off-chain protocol aspires to achieve.

The following table shows some example objectives and their implemetation status:

Objective typeImplemented
direct-fundx
direct-defundx
virtual-fundx
virtual-defundx
challenge

The set of objectives comprises the functional core of a go-nitro node. They expose only pure functions -- but otherwise take on as much responsibility as possible, leaving only a small amount of responsibility to an imperative shell.

Each Objective type is implemented by a Go struct implementing the Objective interface. Each instance of an Objective type will hold its own data.

The imperative shell will typically be responsible for:

  • spawning new objective instances of one type or another
  • reading and persisting objectives to and from a store.
  • listening to peers and the blockchain for events relevant to the objective
  • "updating" objectives by passing events to their Update(event) function (an updated copy is returned)
  • "cranking" objectives by calling Crank() (side effects are returned)
  • executing side effects

# Packages

Package directdefund implements an off-chain protocol to defund a directly-funded channel.
Package directfund implements an off-chain protocol to directly fund a channel.
No description provided by the author
Package virtualfund implements an off-chain protocol to virtually fund a channel.

# Functions

CreateObjectivePayload generates an objective message from the given objective id and payload.
CreateObjectivePayloadMessage returns a message for each recipient tht contains an objective payload.
CreateSignedProposalMessage returns a signed proposal message addressed to the counterparty in the given ledger It contains the provided signed proposals and any proposals in the proposal queue.
CreateSignedProposalMessage returns a signed proposal message addressed to the counterparty in the given ledger channel.
CreateVoucherMessage returns a signed voucher message for each of the recipients provided.
DeserializeMessage deserializes the passed string into a protocols.Message.
GetProposalObjectiveId returns the objectiveId for a proposal.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

AdjudicationStatus mirrors the on chain adjudication status of a particular channel.
ChainTransactionBase is a convenience struct that is embedded in other transaction structs.
No description provided by the author
No description provided by the author
Message is an object to be sent across the wire.
MessageSummary is a summary of a message suitable for logging.
ObjectivePayload is a message containing a payload of []byte that an objective is responsible for decoding.
ObjectivePayloadSummary is a summary of an objective payload suitable for logging.
PaymentSummary is a summary of a payment voucher suitable for logging.
ProposalSummary is a summary of a proposal suitable for logging.
SideEffects are effects to be executed by an imperative shell.
No description provided by the author

# Interfaces

ChainTransaction defines the interface that every transaction must implement.
Objective is the interface for off-chain protocols.
ObjectiveRequest is a request to create a new objective.
ProposalReceiver is an Objective that receives proposals.
Storable is an object that can be stored by the store.
No description provided by the author

# Type aliases

ObjectiveId is a unique identifier for an Objective.
No description provided by the author
No description provided by the author
WaitingFor is an enumerable "pause-point" computed from an Objective.