protocol

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ConsensusCurrentVersion = ConsensusV19

ConsensusCurrentVersion is the latest version and should be used when a specific version is not provided.

View Source
const ConsensusFuture = ConsensusVersion(
	"future",
)

ConsensusFuture is a protocol that should not appear in any production network, but is used to test features before they are released.

View Source
const ConsensusTest0 = ConsensusVersion("test0")

ConsensusTest0 is a version of ConsensusV0 used for testing (it has different approved upgrade paths).

View Source
const ConsensusTest1 = ConsensusVersion("test1")

ConsensusTest1 is an extension of ConsensusTest0 that supports a sorted-list balance commitment.

View Source
const ConsensusTestBigBlocks = ConsensusVersion("test-big-blocks")

ConsensusTestBigBlocks is a version of ConsensusV0 used for testing with big block size (large MaxTxnBytesPerBlock). at the time versioning was introduced.

View Source
const ConsensusTestRapidRewardRecalculation = ConsensusVersion("test-fast-reward-recalculation")

ConsensusTestRapidRewardRecalculation is a version of ConsensusCurrentVersion that decreases the RewardRecalculationInterval greatly.

View Source
const ConsensusV10 = ConsensusVersion("v10")

ConsensusV10 introduces fast partition recovery.

View Source
const ConsensusV11 = ConsensusVersion("v11")

ConsensusV11 introduces efficient encoding of SignedTxn using SignedTxnInBlock.

View Source
const ConsensusV12 = ConsensusVersion("v12")

ConsensusV12 increases the maximum length of a version string.

View Source
const ConsensusV13 = ConsensusVersion(

	"https://github.com/algorand/spec/tree/0c8a9dc44d7368cc266d5407b79fb3311f4fc795",
)

ConsensusV13 makes the consensus version a meaningful string.

View Source
const ConsensusV14 = ConsensusVersion(
	"https://github.com/algorand/spec/tree/2526b6ae062b4fe5e163e06e41e1d9b9219135a9",
)

ConsensusV14 adds tracking of closing amounts in ApplyData, and enables genesis hash in transactions.

View Source
const ConsensusV15 = ConsensusVersion(
	"https://github.com/algorand/spec/tree/a26ed78ed8f834e2b9ccb6eb7d3ee9f629a6e622",
)

ConsensusV15 adds tracking of reward distributions in ApplyData.

View Source
const ConsensusV16 = ConsensusVersion(
	"https://github.com/algorand/spec/tree/22726c9dcd12d9cddce4a8bd7e8ccaa707f74101",
)

ConsensusV16 fixes domain separation in Credentials and requires GenesisHash.

View Source
const ConsensusV17 = ConsensusVersion(
	"https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0",
)

ConsensusV17 points to 'final' spec commit for 2019 june release

View Source
const ConsensusV18 = ConsensusVersion(
	"https://github.com/algorandfoundation/specs/tree/6c6bd668be0ab14098e51b37e806c509f7b7e31f",
)

ConsensusV18 points to reward calculation spec commit

View Source
const ConsensusV19 = ConsensusVersion(
	"https://github.com/algorandfoundation/specs/tree/03ae4eac54f1325377d0a2df62b5ef7cc08c5e18",
)

ConsensusV19 points to 'final' spec commit for 2019 nov release

View Source
const ConsensusV7 = ConsensusVersion("v7")

ConsensusV7 increases MaxBalLookback to 320 in preparation for the twin seeds change.

View Source
const ConsensusV8 = ConsensusVersion("v8")

ConsensusV8 uses the new parameters and seed derivation policy from the agreement protocol's security analysis.

View Source
const ConsensusV9 = ConsensusVersion("v9")

ConsensusV9 increases min balance to 100,000 microAlgos.

View Source
const DEPRECATEDConsensusV0 = ConsensusVersion("v0")

DEPRECATEDConsensusV0 is a baseline version of the Algorand consensus protocol. at the time versioning was introduced. It is now deprecated.

View Source
const DEPRECATEDConsensusV1 = ConsensusVersion("v1")

DEPRECATEDConsensusV1 adds support for Genesis ID in transactions, but does not require it (transactions missing a GenesisID value are still allowed). It is now deprecated.

View Source
const DEPRECATEDConsensusV2 = ConsensusVersion("v2")

DEPRECATEDConsensusV2 fixes a bug in the agreement protocol where proposalValues fail to commit to the original period and sender of a block.

View Source
const DEPRECATEDConsensusV3 = ConsensusVersion("v3")

DEPRECATEDConsensusV3 adds support for fine-grained ephemeral keys.

View Source
const DEPRECATEDConsensusV4 = ConsensusVersion("v4")

DEPRECATEDConsensusV4 adds support for a min balance and a transaction that closes out an account.

View Source
const DEPRECATEDConsensusV5 = ConsensusVersion("v5")

DEPRECATEDConsensusV5 sets MinTxnFee to 1000 and fixes a blance lookback bug

View Source
const DEPRECATEDConsensusV6 = ConsensusVersion("v6")

DEPRECATEDConsensusV6 adds support for explicit ephemeral-key parameters

Variables

View Source
var CodecHandle *codec.MsgpackHandle

CodecHandle is used to instantiate msgpack encoders and decoders with our settings (canonical, paranoid about decoding errors)

View Source
var JSONHandle *codec.JsonHandle

JSONHandle is used to instantiate JSON encoders and decoders with our settings (canonical, paranoid about decoding errors)

Functions

func Decode

func Decode(b []byte, objptr interface{}) error

Decode attempts to decode a msgpack-encoded byte buffer into an object instance pointed to by objptr

func DecodeJSON

func DecodeJSON(b []byte, objptr interface{}) error

DecodeJSON attempts to decode a JSON-encoded byte buffer into an object instance pointed to by objptr

func DecodeStream

func DecodeStream(r io.Reader, objptr interface{}) error

DecodeStream is like Decode but reads from an io.Reader instead.

func Encode

func Encode(obj interface{}) []byte

Encode returns a msgpack-encoded byte buffer for a given object

func EncodeJSON

func EncodeJSON(obj interface{}) []byte

EncodeJSON returns a JSON-encoded byte buffer for a given object

func EncodeLen

func EncodeLen(obj interface{}) int

EncodeLen returns len(Encode(obj))

func EncodeStream

func EncodeStream(w io.Writer, obj interface{})

EncodeStream is like Encode but writes to an io.Writer instead.

func NewEncoder

func NewEncoder(w io.Writer) *codec.Encoder

NewEncoder returns an encoder object writing bytes into [w].

Types

type ConsensusVersion

type ConsensusVersion string

ConsensusVersion is a string that identifies a version of the consensus protocol.

func ConsensusTestFastUpgrade

func ConsensusTestFastUpgrade(proto ConsensusVersion) ConsensusVersion

ConsensusTestFastUpgrade is meant for testing of protocol upgrades: during testing, it is equivalent to another protocol with the exception of the upgrade parameters, which allow for upgrades to take place after only a few rounds.

type CountingWriter

type CountingWriter struct {
	N int
}

CountingWriter is an implementation of io.Writer that tracks the number of bytes written (but discards the actual bytes).

func (*CountingWriter) Write

func (cw *CountingWriter) Write(b []byte) (int, error)

type Decoder

type Decoder interface {
	Decode(objptr interface{}) error
}

Decoder is our interface for a thing that can decode objects.

func NewDecoder

func NewDecoder(r io.Reader) Decoder

NewDecoder returns a decoder object reading bytes from [r].

func NewDecoderBytes

func NewDecoderBytes(b []byte) Decoder

NewDecoderBytes returns a decoder object reading bytes from [b].

func NewJSONDecoder

func NewJSONDecoder(r io.Reader) Decoder

NewJSONDecoder returns a json decoder object reading bytes from [r].

type HashID

type HashID string

HashID is a domain separation prefix for an object type that might be hashed This ensures, for example, the hash of a transaction will never collide with the hash of a vote

const (
	AuctionBid        HashID = "aB"
	AuctionDeposit    HashID = "aD"
	AuctionOutcomes   HashID = "aO"
	AuctionParams     HashID = "aP"
	AuctionSettlement HashID = "aS"

	AgreementSelector HashID = "AS"
	BlockHeader       HashID = "BH"
	BalanceRecord     HashID = "BR"
	Credential        HashID = "CR"
	Genesis           HashID = "GE"
	Message           HashID = "MX"
	NetPrioResponse   HashID = "NPR"
	OneTimeSigKey1    HashID = "OT1"
	OneTimeSigKey2    HashID = "OT2"
	PaysetFlat        HashID = "PF"
	Payload           HashID = "PL"
	Program           HashID = "Program"
	ProgramData       HashID = "ProgData"
	ProposerSeed      HashID = "PS"
	Seed              HashID = "SD"
	TestHashable      HashID = "TE"
	TxGroup           HashID = "TG"
	Transaction       HashID = "TX"
	Vote              HashID = "VO"
)

Hash IDs for specific object types, in lexicographic order to avoid dups.

type NetworkID

type NetworkID string

The NetworkID type is used for strings that identify distinct named networks

type Tag

type Tag string

Tag represents a message type identifier. Messages have a Tag field. Handlers can register to a given Tag. e.g., the agreement service can register to handle agreements with the Agreement tag.

const (
	UnknownMsgTag      Tag = "??"
	AgreementVoteTag   Tag = "AV"
	MsgSkipTag         Tag = "MS"
	NetPrioResponseTag Tag = "NP"
	PingTag            Tag = "pi"
	PingReplyTag       Tag = "pj"
	ProposalPayloadTag Tag = "PP"
	TxnTag             Tag = "TX"
	UniCatchupReqTag   Tag = "UC"
	UniEnsBlockReqTag  Tag = "UE"
	UniEnsBlockResTag  Tag = "US"
	UniCatchupResTag   Tag = "UT"
	VoteBundleTag      Tag = "VB"
)

Tags, in lexicographic sort order of tag values to avoid duplicates.

func (Tag) Complement

func (t Tag) Complement() Tag

Complement is a convenience function for returning a corresponding response/request tag

type TxType

type TxType string

TxType is the type of the transaction written to the ledger

const (
	// PaymentTx indicates a payment transaction
	PaymentTx TxType = "pay"

	// KeyRegistrationTx indicates a transaction that registers participation keys
	KeyRegistrationTx TxType = "keyreg"

	// AssetConfigTx creates, re-configures, or destroys an asset
	AssetConfigTx TxType = "acfg"

	// AssetTransferTx transfers assets between accounts (optionally closing)
	AssetTransferTx TxType = "axfer"

	// AssetFreezeTx changes the freeze status of an asset
	AssetFreezeTx TxType = "afrz"

	// UnknownTx signals an error
	UnknownTx TxType = "unknown"
)

Jump to

Keyboard shortcuts

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