types

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 11 Imported by: 75

Documentation

Index

Constants

View Source
const (
	// StateProofBasic is our initial state proof setup. using falcon keys and subset-sum hash
	StateProofBasic StateProofType = 0

	// NumStateProofTypes is the max number of types of state proofs
	// that we support.  This is used as an allocation bound for a map
	// containing different stateproof types in msgpack encoding.
	NumStateProofTypes int = 1

	// MaxReveals is a bound on allocation and on numReveals to limit log computation
	MaxReveals int = 640

	// MaxEncodedTreeDepth is the maximum tree depth (root only depth 0) for a tree which
	// is being encoded (either by msbpack or by the fixed length encoding)
	MaxEncodedTreeDepth = 16

	// MaxNumLeavesOnEncodedTree is the maximum number of leaves allowed for a tree which
	// is being encoded (either by msbpack or by the fixed length encoding)
	MaxNumLeavesOnEncodedTree = 1 << MaxEncodedTreeDepth
)
View Source
const (
	Sha512_256Size    = sha512.Size256
	SumhashDigestSize = Sumhash512DigestSize
	Sha256Size        = sha256.Size
)

Sizes of each hash

View Source
const AssetMaxNumberOfDecimals = 19

AssetMaxNumberOfDecimals is the maximum value of the Decimals field

View Source
const AssetMetadataHashLen = 32

AssetMetadataHashLen is the length of the AssetMetadataHash in bytes

View Source
const AssetNameMaxLen = 32

AssetNameMaxLen is the max length in bytes for the asset name

View Source
const AssetURLMaxLen = 96

AssetURLMaxLen is the max length in bytes for the asset url

View Source
const AssetUnitNameMaxLen = 8

AssetUnitNameMaxLen is the max length in bytes for the asset unit name

View Source
const FalconPublicKeySize = 0x701

FalconPublicKeySize pulled out of falcon.go

View Source
const KeyStoreRootSize = 64

KeyStoreRootSize is the size, in bytes, of keyreg verifier

View Source
const LogicSigMaxCost = 20000

LogicSigMaxCost is a max execution const of a TEAL program

View Source
const LogicSigMaxSize = 1000

LogicSigMaxSize is a max TEAL program size (with args)

View Source
const MaxTxGroupSize = 16

MaxTxGroupSize is max number of transactions in a single group

View Source
const MerkleSignatureSchemeRootSize = SumhashDigestSize

MerkleSignatureSchemeRootSize is the size of the root of the merkle tree.

View Source
const Sumhash512DigestSize = 64

Sumhash512DigestSize The size in bytes of the sumhash checksum

Variables

View Source
var GenesisHashID = "GE"

GenesisHashID is the Genesis HashID defined in go-algorand/protocol/hash.go

Functions

func EncodeAddress

func EncodeAddress(addr []byte) (a string, err error)

EncodeAddress turns a byte slice into the human readable representation of the address. This representation includes a 4-byte checksum

func OAdd

func OAdd(a uint64, b uint64) (res uint64, overflowed bool)

OAdd adds 2 values with overflow detection

func OAdd16

func OAdd16(a uint16, b uint16) (res uint16, overflowed bool)

OAdd16 adds 2 uint16 values with overflow detection

func OMul

func OMul(a uint64, b uint64) (res uint64, overflowed bool)

OMul multiplies 2 values with overflow detection

func OSub

func OSub(a uint64, b uint64) (res uint64, overflowed bool)

OSub subtracts b from a with overflow detection

Types

type Account added in v2.1.0

type Account struct {
	Status          byte     `codec:"onl"`
	MicroAlgos      uint64   `codec:"algo"`
	VoteID          [32]byte `codec:"vote"`
	StateProofID    [64]byte `codec:"stprf"`
	SelectionID     [32]byte `codec:"sel"`
	VoteFirstValid  uint64   `codec:"voteFst"`
	VoteLastValid   uint64   `codec:"voteLst"`
	VoteKeyDilution uint64   `codec:"voteKD"`
	// contains filtered or unexported fields
}

Account contains the data associated with a given address. This includes the account balance, cryptographic public keys, consensus delegation status.

type AccountApp added in v2.1.0

type AccountApp struct {
	Address Address
	App     AppIndex
}

AccountApp is used as a map key.

type AccountAsset added in v2.1.0

type AccountAsset struct {
	Address Address
	Asset   AssetIndex
}

AccountAsset is used as a map key.

type AccountBaseData added in v2.1.0

type AccountBaseData struct {
	Status             Status
	MicroAlgos         MicroAlgos
	RewardsBase        uint64
	RewardedMicroAlgos MicroAlgos
	AuthAddr           Address
	IncentiveEligible  bool

	TotalAppSchema      StateSchema // Totals across created globals, and opted in locals.
	TotalExtraAppPages  uint32      // Total number of extra pages across all created apps
	TotalAppParams      uint64      // Total number of apps this account has created
	TotalAppLocalStates uint64      // Total number of apps this account is opted into.
	TotalAssetParams    uint64      // Total number of assets created by this account
	TotalAssets         uint64      // Total of asset creations and optins (i.e. number of holdings)
	TotalBoxes          uint64      // Total number of boxes associated to this account
	TotalBoxBytes       uint64      // Total bytes for this account's boxes. keys _and_ values count

	LastProposed  Round // The last round that this account proposed the winning block.
	LastHeartbeat Round // The last round that this account sent a heartbeat to show it was online.
}

AccountBaseData contains base account info like balance, status and total number of resources

type AccountData added in v2.1.0

type AccountData struct {
	AccountBaseData
	VotingData
}

AccountData provides users of the Balances interface per-account data (like basics.AccountData) but without any maps containing AppParams, AppLocalState, AssetHolding, or AssetParams. This ensures that transaction evaluation must retrieve and mutate account, asset, and application data separately, to better support on-disk and in-memory schemas that do not store them together.

type AccountDeltas added in v2.1.0

type AccountDeltas struct {
	// Actual data. If an account is deleted, `Accts` contains the BalanceRecord
	// with an empty `AccountData` and a populated `Addr`.
	Accts []BalanceRecord

	// AppResources deltas. If app params or local state is deleted, there is a nil value in AppResources.Params or AppResources.State and Deleted flag set
	AppResources []AppResourceRecord

	AssetResources []AssetResourceRecord
	// contains filtered or unexported fields
}

AccountDeltas stores ordered accounts and allows fast lookup by address One key design aspect here was to ensure that we're able to access the written deltas in a deterministic order, while maintaining O(1) lookup. In order to do that, each of the arrays here is constructed as a pair of (slice, map). The map would point the address/address+creatable id onto the index of the element within the slice. If adding fields make sure to add them to the .reset() method to avoid dirty state

type AccountTotals added in v2.1.0

type AccountTotals struct {
	Online           AlgoCount `codec:"online"`
	Offline          AlgoCount `codec:"offline"`
	NotParticipating AlgoCount `codec:"notpart"`

	// Total number of algos received per reward unit since genesis
	RewardsLevel uint64 `codec:"rwdlvl"`
	// contains filtered or unexported fields
}

AccountTotals represents the totals of algos in the system grouped by different account status values.

type Address

type Address [hashLenBytes]byte

Address represents an Algorand address.

var ZeroAddress Address = [hashLenBytes]byte{}

ZeroAddress is Address with all zero bytes. For handy == != comparisons.

func DecodeAddress

func DecodeAddress(addr string) (a Address, err error)

DecodeAddress turns a checksum address string into an Address object. It checks that the checksum is correct and whether the address is canonical, and returns an error if it's not.

func (Address) IsZero

func (a Address) IsZero() bool

IsZero returs true if the Address is all zero bytes.

func (*Address) MarshalText added in v2.1.0

func (a *Address) MarshalText() ([]byte, error)

MarshalText returns the address string as an array of bytes

func (Address) String

func (a Address) String() string

String grabs a human-readable representation of the address. This representation includes a 4-byte checksum.

func (*Address) UnmarshalText added in v2.1.0

func (a *Address) UnmarshalText(text []byte) error

UnmarshalText initializes the Address from an array of bytes. The bytes may be in the base32 checksum format, or the raw bytes base64 encoded.

type AlgoCount added in v2.1.0

type AlgoCount struct {

	// Sum of algos of all accounts in this class.
	Money MicroAlgos `codec:"mon"`

	// Total number of whole reward units in accounts.
	RewardUnits uint64 `codec:"rwd"`
	// contains filtered or unexported fields
}

AlgoCount represents a total of algos of a certain class of accounts (split up by their Status value).

type AppBoxReference

type AppBoxReference struct {
	// The ID of the app that owns the box. Must be converted to BoxReference during transaction submission.
	AppID uint64

	// The Name of the box unique to the app it belongs to
	Name []byte
}

AppBoxReference names a box by the app ID

type AppIndex

type AppIndex uint64

AppIndex is the unique integer index of an application that can be used to look up the creator of the application, whose balance record contains the AppParams

type AppLocalState added in v2.1.0

type AppLocalState struct {
	Schema   StateSchema  `codec:"hsch"`
	KeyValue TealKeyValue `codec:"tkv"`
	// contains filtered or unexported fields
}

AppLocalState stores the LocalState associated with an application. It also stores a cached copy of the application's LocalStateSchema so that MinBalance requirements may be computed 1. without looking up the AppParams and 2. even if the application has been deleted

type AppLocalStateDelta added in v2.1.0

type AppLocalStateDelta struct {
	LocalState *AppLocalState
	Deleted    bool
}

AppLocalStateDelta tracks a changed AppLocalState, and whether it was deleted

type AppParams added in v2.1.0

type AppParams struct {
	ApprovalProgram   []byte       `codec:"approv,allocbound=config.MaxAvailableAppProgramLen"`
	ClearStateProgram []byte       `codec:"clearp,allocbound=config.MaxAvailableAppProgramLen"`
	GlobalState       TealKeyValue `codec:"gs"`
	StateSchemas
	ExtraProgramPages uint32 `codec:"epp"`
	// contains filtered or unexported fields
}

AppParams stores the global information associated with an application

type AppParamsDelta added in v2.1.0

type AppParamsDelta struct {
	Params  *AppParams
	Deleted bool
}

AppParamsDelta tracks a changed AppParams, and whether it was deleted

type AppResourceRecord added in v2.1.0

type AppResourceRecord struct {
	Aidx   AppIndex
	Addr   Address
	Params AppParamsDelta
	State  AppLocalStateDelta
}

AppResourceRecord represents AppParams and AppLocalState in deltas

type ApplicationCallTxnFields

type ApplicationCallTxnFields struct {
	ApplicationID   AppIndex       `codec:"apid"`
	OnCompletion    OnCompletion   `codec:"apan"`
	ApplicationArgs [][]byte       `codec:"apaa,allocbound=encodedMaxApplicationArgs,maxtotalbytes=config.MaxAppTotalArgLen"`
	Accounts        []Address      `codec:"apat,allocbound=encodedMaxAccounts"`
	ForeignApps     []AppIndex     `codec:"apfa,allocbound=encodedMaxForeignApps"`
	ForeignAssets   []AssetIndex   `codec:"apas,allocbound=encodedMaxForeignAssets"`
	BoxReferences   []BoxReference `codec:"apbx,allocbound=encodedMaxBoxReferences"`

	LocalStateSchema  StateSchema `codec:"apls"`
	GlobalStateSchema StateSchema `codec:"apgs"`
	ApprovalProgram   []byte      `codec:"apap"`
	ClearStateProgram []byte      `codec:"apsu"`
	ExtraProgramPages uint32      `codec:"apep"`
	// contains filtered or unexported fields
}

ApplicationCallTxnFields captures the transaction fields used for all interactions with applications

func (*ApplicationCallTxnFields) Empty

func (ac *ApplicationCallTxnFields) Empty() bool

Empty indicates whether or not all the fields in the ApplicationCallTxnFields are zeroed out

type ApplicationFields

type ApplicationFields struct {
	ApplicationCallTxnFields
}

ApplicationFields are the fields that are common to all application

type ApplyData

type ApplyData struct {

	// Closing amount for transaction.
	ClosingAmount MicroAlgos `codec:"ca"`

	// Closing amount for asset transaction.
	AssetClosingAmount uint64 `codec:"aca"`

	// Rewards applied to the Sender, Receiver, and CloseRemainderTo accounts.
	SenderRewards   MicroAlgos `codec:"rs"`
	ReceiverRewards MicroAlgos `codec:"rr"`
	CloseRewards    MicroAlgos `codec:"rc"`
	EvalDelta       EvalDelta  `codec:"dt"`

	ConfigAsset   uint64 `codec:"caid"`
	ApplicationID uint64 `codec:"apid"`
	// contains filtered or unexported fields
}

ApplyData contains information about the transaction's execution.

type AssetConfigTxnFields

type AssetConfigTxnFields struct {

	// ConfigAsset is the asset being configured or destroyed.
	// A zero value means allocation.
	ConfigAsset AssetIndex `codec:"caid"`

	// AssetParams are the parameters for the asset being
	// created or re-configured.  A zero value means destruction.
	AssetParams AssetParams `codec:"apar"`
	// contains filtered or unexported fields
}

AssetConfigTxnFields captures the fields used for asset allocation, re-configuration, and destruction.

type AssetFreezeTxnFields

type AssetFreezeTxnFields struct {

	// FreezeAccount is the address of the account whose asset
	// slot is being frozen or un-frozen.
	FreezeAccount Address `codec:"fadd"`

	// FreezeAsset is the asset ID being frozen or un-frozen.
	FreezeAsset AssetIndex `codec:"faid"`

	// AssetFrozen is the new frozen value.
	AssetFrozen bool `codec:"afrz"`
	// contains filtered or unexported fields
}

AssetFreezeTxnFields captures the fields used for freezing asset slots.

type AssetHolding added in v2.1.0

type AssetHolding struct {
	Amount uint64 `codec:"a"`
	Frozen bool   `codec:"f"`
	// contains filtered or unexported fields
}

AssetHolding describes an asset held by an account.

type AssetHoldingDelta added in v2.1.0

type AssetHoldingDelta struct {
	Holding *AssetHolding
	Deleted bool
}

AssetHoldingDelta records a changed AssetHolding, and whether it was deleted

type AssetIndex

type AssetIndex uint64

AssetIndex is the unique integer index of an asset that can be used to look up the creator of the asset, whose balance record contains the AssetParams

type AssetParams

type AssetParams struct {

	// Total specifies the total number of units of this asset
	// created.
	Total uint64 `codec:"t"`

	// Decimals specifies the number of digits to display after the decimal
	// place when displaying this asset. A value of 0 represents an asset
	// that is not divisible, a value of 1 represents an asset divisible
	// into tenths, and so on. This value must be between 0 and 19
	// (inclusive).
	Decimals uint32 `codec:"dc"`

	// DefaultFrozen specifies whether slots for this asset
	// in user accounts are frozen by default or not.
	DefaultFrozen bool `codec:"df"`

	// UnitName specifies a hint for the name of a unit of
	// this asset.
	UnitName string `codec:"un,allocbound=config.MaxAssetUnitNameBytes"`

	// AssetName specifies a hint for the name of the asset.
	AssetName string `codec:"an,allocbound=config.MaxAssetNameBytes"`

	// URL specifies a URL where more information about the asset can be
	// retrieved
	URL string `codec:"au,allocbound=config.MaxAssetURLBytes"`

	// MetadataHash specifies a commitment to some unspecified asset
	// metadata. The format of this metadata is up to the application.
	MetadataHash [AssetMetadataHashLen]byte `codec:"am"`

	// Manager specifies an account that is allowed to change the
	// non-zero addresses in this AssetParams.
	Manager Address `codec:"m"`

	// Reserve specifies an account whose holdings of this asset
	// should be reported as "not minted".
	Reserve Address `codec:"r"`

	// Freeze specifies an account that is allowed to change the
	// frozen state of holdings of this asset.
	Freeze Address `codec:"f"`

	// Clawback specifies an account that is allowed to take units
	// of this asset from any account.
	Clawback Address `codec:"c"`
	// contains filtered or unexported fields
}

AssetParams describes the parameters of an asset.

func (AssetParams) IsZero

func (ap AssetParams) IsZero() bool

IsZero returns true if the AssetParams struct is completely empty. The AssetParams zero object is used in destroying an asset.

type AssetParamsDelta added in v2.1.0

type AssetParamsDelta struct {
	Params  *AssetParams
	Deleted bool
}

AssetParamsDelta tracks a changed AssetParams, and whether it was deleted

type AssetResourceRecord added in v2.1.0

type AssetResourceRecord struct {
	Aidx    AssetIndex
	Addr    Address
	Params  AssetParamsDelta
	Holding AssetHoldingDelta
}

AssetResourceRecord represents AssetParams and AssetHolding in deltas

type AssetTransferTxnFields

type AssetTransferTxnFields struct {
	XferAsset AssetIndex `codec:"xaid"`

	// AssetAmount is the amount of asset to transfer.
	// A zero amount transferred to self allocates that asset
	// in the account's Assets map.
	AssetAmount uint64 `codec:"aamt"`

	// AssetSender is the sender of the transfer.  If this is not
	// a zero value, the real transaction sender must be the Clawback
	// address from the AssetParams.  If this is the zero value,
	// the asset is sent from the transaction's Sender.
	AssetSender Address `codec:"asnd"`

	// AssetReceiver is the recipient of the transfer.
	AssetReceiver Address `codec:"arcv"`

	// AssetCloseTo indicates that the asset should be removed
	// from the account's Assets map, and specifies where the remaining
	// asset holdings should be transferred.  It's always valid to transfer
	// remaining asset holdings to the creator account.
	AssetCloseTo Address `codec:"aclose"`
	// contains filtered or unexported fields
}

AssetTransferTxnFields captures the fields used for asset transfers.

type BalanceRecord added in v2.1.0

type BalanceRecord struct {
	Addr Address
	AccountData
}

BalanceRecord is similar to basics.BalanceRecord but with decoupled base and voting data

type Bid

type Bid struct {

	// BidderKey identifies the bidder placing this bid.
	BidderKey Address `codec:"bidder"`

	// BidCurrency specifies how much external currency the bidder
	// is putting in with this bid.
	BidCurrency uint64 `codec:"cur"`

	// MaxPrice specifies the maximum price, in units of external
	// currency per Algo, that the bidder is willing to pay.
	// This must be at least as high as the current price of the
	// auction in the block in which this bid appears.
	MaxPrice uint64 `codec:"price"`

	// BidID identifies this bid.  The first bid by a bidder (identified
	// by BidderKey) with a particular BidID on the blockchain will be
	// considered, preventing replay of bids.  Specifying a different
	// BidID allows the bidder to place multiple bids in an auction.
	BidID uint64 `codec:"id"`

	// AuctionKey specifies the auction for this bid.
	AuctionKey Address `codec:"auc"`

	// AuctionID identifies the auction for which this bid is intended.
	AuctionID uint64 `codec:"aid"`
	// contains filtered or unexported fields
}

Bid represents a bid by a user as part of an auction.

type Block

type Block struct {
	BlockHeader
	Payset Payset `codec:"txns,maxtotalbytes=config.MaxTxnBytesPerBlock"`
}

A Block contains the Payset and metadata corresponding to a given Round.

func (*Block) FromBase64String

func (block *Block) FromBase64String(b64string string) error

FromBase64String converts a base64 string to a Block

type BlockHash

type BlockHash Digest

BlockHash represents the hash of a block

func (*BlockHash) MarshalText added in v2.1.0

func (b *BlockHash) MarshalText() ([]byte, error)

MarshalText returns the BlockHash string as an array of bytes

func (*BlockHash) UnmarshalText added in v2.1.0

func (b *BlockHash) UnmarshalText(text []byte) error

UnmarshalText initializes the BlockHash from an array of bytes.

type BlockHeader

type BlockHeader struct {
	Round Round `codec:"rnd"`

	// The hash of the previous block
	Branch BlockHash `codec:"prev"`

	// Sortition seed
	Seed [32]byte `codec:"seed"`

	TxnCommitments

	// TimeStamp in seconds since epoch
	TimeStamp int64 `codec:"ts"`

	// Genesis ID to which this block belongs.
	GenesisID string `codec:"gen,allocbound=config.MaxGenesisIDLen"`

	// Genesis hash to which this block belongs.
	GenesisHash Digest `codec:"gh"`

	// Proposer is the proposer of this block. Like the Seed, agreement adds
	// this after the block is assembled by the transaction pool, so that the same block can be prepared
	// for multiple participating accounts in the same node. Populated if proto.Payouts.Enabled
	Proposer Address `codec:"prp"`

	// FeesCollected is the sum of all fees paid by transactions in this
	// block. Populated if proto.EnableMining.
	FeesCollected MicroAlgos `codec:"fc"`

	// Bonus is the bonus incentive to be paid for proposing this block.  It
	// begins as a consensus parameter value, and decays periodically.
	Bonus MicroAlgos `codec:"bi"`

	// ProposerPayout is the amount that should be moved from the FeeSink to
	// the Proposer at the start of the next block.  It is basically the
	// bonus + the payouts percent of FeesCollected, but may be zero'd by
	// proposer ineligibility.
	ProposerPayout MicroAlgos `codec:"pp"`

	// Rewards.
	//
	// When a block is applied, some amount of rewards are accrued to
	// every account with AccountData.Status=/=NotParticipating.  The
	// amount is (thisBlock.RewardsLevel-prevBlock.RewardsLevel) of
	// MicroAlgos for every whole config.Protocol.RewardUnit of MicroAlgos in
	// that account's AccountData.MicroAlgos.
	//
	// Rewards are not compounded (i.e., not added to AccountData.MicroAlgos)
	// until some other transaction is executed on that account.
	//
	// Not compounding rewards allows us to precisely know how many algos
	// of rewards will be distributed without having to examine every
	// account to determine if it should get one more algo of rewards
	// because compounding formed another whole config.Protocol.RewardUnit
	// of algos.
	RewardsState

	// Consensus protocol versioning.
	//
	// Each block is associated with a version of the consensus protocol,
	// stored under UpgradeState.CurrentProtocol.  The protocol version
	// for a block can be determined without having to first decode the
	// block and its CurrentProtocol field, and this field is present for
	// convenience and explicitness.  Block.Valid() checks that this field
	// correctly matches the expected protocol version.
	//
	// Each block is associated with at most one active upgrade proposal
	// (a new version of the protocol).  An upgrade proposal can be made
	// by a block proposer, as long as no other upgrade proposal is active.
	// The upgrade proposal lasts for many rounds (UpgradeVoteRounds), and
	// in each round, that round's block proposer votes to support (or not)
	// the proposed upgrade.
	//
	// If enough votes are collected, the proposal is approved, and will
	// definitely take effect.  The proposal lingers for some number of
	// rounds to give clients a chance to notify users about an approved
	// upgrade, if the client doesn't support it, so the user has a chance
	// to download updated client software.
	//
	// Block proposers influence this upgrade machinery through two fields
	// in UpgradeVote: UpgradePropose, which proposes an upgrade to a new
	// protocol, and UpgradeApprove, which signals approval of the current
	// proposal.
	//
	// Once a block proposer determines its UpgradeVote, then UpdateState
	// is updated deterministically based on the previous UpdateState and
	// the new block's UpgradeVote.
	UpgradeState
	UpgradeVote

	// TxnCounter is the number of the next transaction that will be
	// committed after this block.  Genesis blocks can start at either
	// 0 or 1000, depending on a consensus parameter (AppForbidLowResources).
	TxnCounter uint64 `codec:"tc"`

	// StateProofTracking tracks the status of the state proofs, potentially
	// for multiple types of ASPs (Algorand's State Proofs).
	//msgp:sort protocol.StateProofType protocol.SortStateProofType
	StateProofTracking map[StateProofType]StateProofTrackingData `codec:"spt,allocbound=NumStateProofTypes"`

	// ParticipationUpdates contains the information needed to mark
	// certain accounts offline because their participation keys expired
	ParticipationUpdates
	// contains filtered or unexported fields
}

A BlockHeader represents the metadata and commitments to the state of a Block. The Algorand Ledger may be defined minimally as a cryptographically authenticated series of BlockHeader objects.

type BoxReference

type BoxReference struct {

	// The index of the app in the foreign app array.
	ForeignAppIdx uint64 `codec:"i"`

	// The name of the box unique to the app it belongs to
	Name []byte `codec:"n"`
	// contains filtered or unexported fields
}

BoxReference names a box by the index in the foreign app array

type Commitment

Commitment represents the root of the vector commitment tree built upon the MSS keys.

type CreatableIndex added in v2.1.0

type CreatableIndex uint64

CreatableIndex represents either an AssetIndex or AppIndex, which come from the same namespace of indices as each other (both assets and apps are "creatables")

type CreatableType added in v2.1.0

type CreatableType uint64

CreatableType is an enum representing whether or not a given creatable is an application or an asset

type DeltaAction

type DeltaAction uint64

DeltaAction is an enum of actions that may be performed when applying a delta to a TEAL key/value store

const (
	// SetBytesAction indicates that a TEAL byte slice should be stored at a key
	SetBytesAction DeltaAction = 1

	// SetUintAction indicates that a Uint should be stored at a key
	SetUintAction DeltaAction = 2

	// DeleteAction indicates that the value for a particular key should be deleted
	DeleteAction DeltaAction = 3
)

type Digest

type Digest [hashLenBytes]byte

Digest is a SHA512_256 hash

func DigestFromString added in v2.1.0

func DigestFromString(str string) (d Digest, err error)

DigestFromString converts a string to a Digest

type EvalDelta

type EvalDelta struct {
	GlobalDelta StateDelta `codec:"gd"`

	// When decoding EvalDeltas, the integer key represents an offset into
	// [txn.Sender, txn.Accounts[0], txn.Accounts[1], ...]
	//msgp:allocbound LocalDeltas config.MaxEvalDeltaAccounts
	LocalDeltas map[uint64]StateDelta `codec:"ld"`

	// If a program modifies the local of an account that is not the Sender, or
	// in txn.Accounts, it must be recorded here, so that the key in LocalDeltas
	// can refer to it.
	//msgp:allocbound SharedAccts config.MaxEvalDeltaAccounts
	SharedAccts []Address `codec:"sa"`

	Logs []string `codec:"lg"`

	InnerTxns []SignedTxnWithAD `codec:"itx"`
	// contains filtered or unexported fields
}

EvalDelta stores StateDeltas for an application's global key/value store, as well as StateDeltas for some number of accounts holding local state for that application

type FalconPublicKey

type FalconPublicKey [FalconPublicKeySize]byte

FalconPublicKey is a wrapper for cfalcon.PublicKeySizey (used for packing)

type FalconSignatureStruct

type FalconSignatureStruct struct {
	Signature             MerkleSignature `codec:"sig"`
	VectorCommitmentIndex uint64          `codec:"idx"`
	Proof                 SingleLeafProof `codec:"prf"`
	VerifyingKey          FalconVerifier  `codec:"vkey"`
	// contains filtered or unexported fields
}

FalconSignatureStruct represents a signature in the merkle signature scheme using falcon signatures as an underlying crypto scheme. It consists of an ephemeral public key, a signature, a merkle verification path and an index. The merkle signature considered valid only if the Signature is verified under the ephemeral public key and the Merkle verification path verifies that the ephemeral public key is located at the given index of the tree (for the root given in the long-term public key). More details can be found on Algorand's spec

type FalconVerifier

type FalconVerifier struct {
	PublicKey FalconPublicKey `codec:"k"`
	// contains filtered or unexported fields
}

FalconVerifier implements the type Verifier interface for the falcon signature scheme.

type GenericDigest

type GenericDigest []byte

GenericDigest is a digest that implements CustomSizeDigest, and can be used as hash output.

func (GenericDigest) IsEmpty

func (d GenericDigest) IsEmpty() bool

IsEmpty checks wether the generic digest is an empty one or not

func (GenericDigest) IsEqual

func (d GenericDigest) IsEqual(other GenericDigest) bool

IsEqual compare two digests

func (GenericDigest) ToSlice

func (d GenericDigest) ToSlice() []byte

ToSlice is used inside the Tree itself when interacting with TreeDigest

type Genesis added in v2.1.0

type Genesis struct {

	// The SchemaID allows nodes to store data specific to a particular
	// universe
	SchemaID string `codec:"id"`

	// Network identifies the unique algorand network for which the ledger
	// is valid.
	Network string `codec:"network"`

	// Proto is the consensus protocol in use at the genesis block.
	Proto string `codec:"proto"`

	// Allocation determines the initial accounts and their state.
	Allocation []GenesisAllocation `codec:"alloc"`

	// RewardsPool is the address of the rewards pool.
	RewardsPool string `codec:"rwd"`

	// FeeSink is the address of the fee sink.
	FeeSink string `codec:"fees"`

	// Timestamp for the genesis block
	Timestamp int64 `codec:"timestamp"`

	// Arbitrary genesis comment string - will be excluded from file if empty
	Comment string `codec:"comment"`

	// DevMode defines whether this network operates in a developer mode or not. Developer mode networks
	// are a single node network, that operates without the agreement service being active. In liue of the
	// agreement service, a new block is generated each time a node receives a transaction group. The
	// default value for this field is "false", which makes this field empty from it's encoding, and
	// therefore backward compatible.
	DevMode bool `codec:"devmode"`
	// contains filtered or unexported fields
}

A Genesis object defines an Algorand "universe"

func (Genesis) Balances added in v2.1.0

func (genesis Genesis) Balances() (GenesisBalances, error)

Balances returns the genesis account balances.

func (Genesis) Hash added in v2.1.0

func (genesis Genesis) Hash() Digest

Hash is the genesis hash.

func (Genesis) ID added in v2.1.0

func (genesis Genesis) ID() string

ID is the effective Genesis identifier - the combination of the network and the ledger schema version

type GenesisAllocation added in v2.1.0

type GenesisAllocation struct {
	Address string  `codec:"addr"`
	Comment string  `codec:"comment"`
	State   Account `codec:"state"`
	// contains filtered or unexported fields
}

GenesisAllocation object represents an allocation of algos to an address in the genesis block. Address is the checksummed short address. Comment is a note about what this address is representing, and is purely informational. State is the initial account state.

type GenesisBalances added in v2.1.0

type GenesisBalances struct {
	Balances    map[Address]Account
	FeeSink     Address
	RewardsPool Address
	Timestamp   int64
}

GenesisBalances contains the information needed to generate a new ledger

func MakeTimestampedGenesisBalances added in v2.1.0

func MakeTimestampedGenesisBalances(balances map[Address]Account, feeSink, rewardsPool Address, timestamp int64) GenesisBalances

MakeTimestampedGenesisBalances returns the information needed to bootstrap the ledger based on a given time

type HashFactory

type HashFactory struct {
	HashType HashType `codec:"t"`
	// contains filtered or unexported fields
}

HashFactory is responsible for generating new hashes accordingly to the type it stores.

type HashType

type HashType uint16

HashType represents different hash functions

const (
	Sha512_256 HashType = iota
	Sumhash
	Sha256
	MaxHashType
)

types of hashes

type Header struct {
	Sender      Address    `codec:"snd"`
	Fee         MicroAlgos `codec:"fee"`
	FirstValid  Round      `codec:"fv"`
	LastValid   Round      `codec:"lv"`
	Note        []byte     `codec:"note"`
	GenesisID   string     `codec:"gen"`
	GenesisHash Digest     `codec:"gh"`

	// Group specifies that this transaction is part of a
	// transaction group (and, if so, specifies the hash
	// of a TxGroup).
	Group Digest `codec:"grp"`

	// Lease enforces mutual exclusion of transactions.  If this field is
	// nonzero, then once the transaction is confirmed, it acquires the
	// lease identified by the (Sender, Lease) pair of the transaction until
	// the LastValid round passes.  While this transaction possesses the
	// lease, no other transaction specifying this lease can be confirmed.
	Lease [32]byte `codec:"lx"`

	// RekeyTo, if nonzero, sets the sender's SpendingKey to the given address
	// If the RekeyTo address is the sender's actual address, the SpendingKey is set to zero
	// This allows "re-keying" a long-lived account -- rotating the signing key, changing
	// membership of a multisig account, etc.
	RekeyTo Address `codec:"rekey"`
	// contains filtered or unexported fields
}

Header captures the fields common to every transaction type.

type IncludedTransactions added in v2.1.0

type IncludedTransactions struct {
	LastValid Round
	Intra     uint64 // the index of the transaction in the block
}

IncludedTransactions defines the transactions included in a block, their index and last valid round.

type KeyregTxnFields

type KeyregTxnFields struct {
	VotePK           VotePK         `codec:"votekey"`
	SelectionPK      VRFPK          `codec:"selkey"`
	VoteFirst        Round          `codec:"votefst"`
	VoteLast         Round          `codec:"votelst"`
	VoteKeyDilution  uint64         `codec:"votekd"`
	Nonparticipation bool           `codec:"nonpart"`
	StateProofPK     MerkleVerifier `codec:"sprfkey"`
	// contains filtered or unexported fields
}

KeyregTxnFields captures the fields used for key registration transactions.

type KvValueDelta added in v2.1.0

type KvValueDelta struct {
	// Data stores the most recent value (nil == deleted)
	Data []byte

	// OldData stores the previous vlaue (nil == didn't exist)
	OldData []byte
}

A KvValueDelta shows how the Data associated with a key in the kvstore has changed. However, OldData is elided during evaluation, and only filled in at the conclusion of a block during the called to roundCowState.deltas()

type LedgerStateDelta added in v2.1.0

type LedgerStateDelta struct {
	// modified new accounts
	Accts AccountDeltas

	// modified kv pairs (nil == delete)
	// not preallocated use .AddKvMod to insert instead of direct assignment
	KvMods map[string]KvValueDelta

	// new Txids for the txtail and TxnCounter, mapped to txn.LastValid
	Txids map[Txid]IncludedTransactions

	// new txleases for the txtail mapped to expiration
	// not pre-allocated so use .AddTxLease to insert instead of direct assignment
	Txleases map[Txlease]Round

	// new creatables creator lookup table
	// not pre-allocated so use .AddCreatable to insert instead of direct assignment
	Creatables map[CreatableIndex]ModifiedCreatable

	// new block header; read-only
	Hdr *BlockHeader

	// StateProofNext represents modification on StateProofNextRound field in the block header. If the block contains
	// a valid state proof transaction, this field will contain the next round for state proof.
	// otherwise it will be set to 0.
	StateProofNext Round

	// previous block timestamp
	PrevTimestamp int64

	// The account totals reflecting the changes in this StateDelta object.
	Totals AccountTotals
	// contains filtered or unexported fields
}

LedgerStateDelta describes the delta between a given round to the previous round If adding a new field not explicitly allocated by PopulateStateDelta, make sure to reset it in .ReuseStateDelta to avoid dirty memory errors. If adding fields make sure to add them to the .Reset() method to avoid dirty state

type LightBlockHeader

type LightBlockHeader struct {
	Seed                Seed   `codec:"0"`
	BlockHash           Digest `codec:"1"`
	RoundNumber         Round  `codec:"r"`
	GenesisHash         Digest `codec:"gh"`
	Sha256TxnCommitment Digest `codec:"tc,allocbound=Sha256Size"`
	// contains filtered or unexported fields
}

LightBlockHeader represents a minimal block header. It contains all the necessary fields for verifying proofs on transactions. In addition, this struct is designed to be used on environments where only SHA256 function exists

type LogicSig

type LogicSig struct {

	// Logic signed by Sig or Msig
	// OR hashed to be the Address of an account.
	Logic []byte `codec:"l"`

	// The signature of the account that has delegated to this LogicSig, if any
	Sig Signature `codec:"sig"`

	// The signature of the multisig account that has delegated to this LogicSig, if any
	Msig MultisigSig `codec:"msig"`

	// Args are not signed, but checked by Logic
	Args [][]byte `codec:"arg"`
	// contains filtered or unexported fields
}

LogicSig contains logic for validating a transaction. LogicSig is signed by an account, allowing delegation of operations. OR LogicSig defines a contract account.

LogicSig cannot sign transactions in all cases. Instead, use LogicSigAccount as a safe, general purpose signing mechanism. Since LogicSig does not track the provided signature's public key, LogicSig cannot sign transactions when delegated to a non-multisig account _and_ the sender is not the delegating account.

func (LogicSig) Blank

func (lsig LogicSig) Blank() bool

Blank returns true iff the lsig is empty. We need this instead of just comparing with == LogicSig{}, because it contains slices.

type MasterDerivationKey

type MasterDerivationKey [masterDerivationKeyLenBytes]byte

MasterDerivationKey is the secret key used to derive keys in wallets

type MerkleSignature

type MerkleSignature []byte

MerkleSignature represents a Falcon signature in a compressed-form

type MerkleVerifier

type MerkleVerifier [KeyStoreRootSize]byte

MerkleVerifier is a state proof

type Message

type Message struct {

	// BlockHeadersCommitment contains a commitment on all light block headers within a state proof interval.
	BlockHeadersCommitment []byte `codec:"b,allocbound=Sha256Size"`
	VotersCommitment       []byte `codec:"v,allocbound=SumhashDigestSize"`
	LnProvenWeight         uint64 `codec:"P"`
	FirstAttestedRound     uint64 `codec:"f"`
	LastAttestedRound      uint64 `codec:"l"`
	// contains filtered or unexported fields
}

Message represents the message that the state proofs are attesting to. This message can be used by lightweight client and gives it the ability to verify proofs on the Algorand's state. In addition to that proof, this message also contains fields that are needed in order to verify the next state proofs (VotersCommitment and LnProvenWeight).

type MessageHash

type MessageHash [32]byte

MessageHash represents the message that a state proof will attest to.

type MicroAlgos

type MicroAlgos uint64

MicroAlgos are the base unit of currency in Algorand

func ToMicroAlgos

func ToMicroAlgos(algos float64) MicroAlgos

ToMicroAlgos converts amount in Algos to microAlgos

func (MicroAlgos) ToAlgos

func (microalgos MicroAlgos) ToAlgos() float64

ToAlgos converts amount in microAlgos to Algos

type ModifiedCreatable added in v2.1.0

type ModifiedCreatable struct {
	// Type of the creatable: app or asset
	Ctype CreatableType

	// Created if true, deleted if false
	Created bool

	// creator of the app/asset
	Creator Address

	// Keeps track of how many times this app/asset appears in
	// accountUpdates.creatableDeltas
	Ndeltas int
}

ModifiedCreatable defines the changes to a single single creatable state

type MultisigSig

type MultisigSig struct {
	Version   uint8            `codec:"v"`
	Threshold uint8            `codec:"thr"`
	Subsigs   []MultisigSubsig `codec:"subsig"`
	// contains filtered or unexported fields
}

MultisigSig holds multiple Subsigs, as well as threshold and version info

func (MultisigSig) Blank

func (msig MultisigSig) Blank() bool

Blank returns true iff the msig is empty. We need this instead of just comparing with == MultisigSig{}, because Subsigs is a slice.

type MultisigSubsig

type MultisigSubsig struct {
	Key ed25519.PublicKey `codec:"pk"`
	Sig Signature         `codec:"s"`
	// contains filtered or unexported fields
}

MultisigSubsig contains a single public key and, optionally, a signature

type NoteField

type NoteField struct {

	// Type indicates which type of a message this is
	Type NoteFieldType `codec:"t"`

	// SignedBid, for NoteBid type
	SignedBid SignedBid `codec:"b"`
	// contains filtered or unexported fields
}

NoteField is the struct that represents an auction message.

type NoteFieldType

type NoteFieldType string

NoteFieldType indicates a type of auction message encoded into a transaction's Note field.

const (
	// NoteDeposit indicates a SignedDeposit message.
	NoteDeposit NoteFieldType = "d"

	// NoteBid indicates a SignedBid message.
	NoteBid NoteFieldType = "b"

	// NoteSettlement indicates a SignedSettlement message.
	NoteSettlement NoteFieldType = "s"

	// NoteParams indicates a SignedParams message.
	NoteParams NoteFieldType = "p"
)

type OnCompletion

type OnCompletion uint64

OnCompletion is an enum representing some layer 1 side effect that an ApplicationCall transaction will have if it is included in a block.

const (
	// NoOpOC indicates that an application transaction will simply call its
	// ApprovalProgram
	NoOpOC OnCompletion = 0

	// OptInOC indicates that an application transaction will allocate some
	// LocalState for the application in the sender's account
	OptInOC OnCompletion = 1

	// CloseOutOC indicates that an application transaction will deallocate
	// some LocalState for the application from the user's account
	CloseOutOC OnCompletion = 2

	// ClearStateOC is similar to CloseOutOC, but may never fail. This
	// allows users to reclaim their minimum balance from an application
	// they no longer wish to opt in to.
	ClearStateOC OnCompletion = 3

	// UpdateApplicationOC indicates that an application transaction will
	// update the ApprovalProgram and ClearStateProgram for the application
	UpdateApplicationOC OnCompletion = 4

	// DeleteApplicationOC indicates that an application transaction will
	// delete the AppParams for the application from the creator's balance
	// record
	DeleteApplicationOC OnCompletion = 5
)

type OneTimeSignatureVerifier added in v2.1.0

type OneTimeSignatureVerifier [32]byte

A OneTimeSignatureVerifier is used to identify the holder of OneTimeSignatureSecrets and prove the authenticity of OneTimeSignatures against some OneTimeSignatureIdentifier.

type Participant

type Participant struct {

	// PK is the identifier used to verify the signature for a specific participant
	PK Verifier `codec:"p"`

	// Weight is AccountData.MicroAlgos.
	Weight uint64 `codec:"w"`
	// contains filtered or unexported fields
}

A Participant corresponds to an account whose AccountData.Status is Online, and for which the expected sigRound satisfies AccountData.VoteFirstValid <= sigRound <= AccountData.VoteLastValid.

In the Algorand ledger, it is possible for multiple accounts to have the same PK. Thus, the PK is not necessarily unique among Participants. However, each account will produce a unique Participant struct, to avoid potential DoS attacks where one account claims to have the same VoteID PK as another account.

type ParticipationUpdates

type ParticipationUpdates struct {

	// ExpiredParticipationAccounts contains a list of online accounts
	// that needs to be converted to offline since their
	// participation key expired.
	ExpiredParticipationAccounts []Address `codec:"partupdrmv"`

	// AbsentParticipationAccounts contains a list of online accounts that
	// needs to be converted to offline since they are not proposing.
	AbsentParticipationAccounts []Address `codec:"partupdabs"`
	// contains filtered or unexported fields
}

ParticipationUpdates represents participation account data that needs to be checked/acted on by the network

type PaymentTxnFields

type PaymentTxnFields struct {
	Receiver Address    `codec:"rcv"`
	Amount   MicroAlgos `codec:"amt"`

	// When CloseRemainderTo is set, it indicates that the
	// transaction is requesting that the account should be
	// closed, and all remaining funds be transferred to this
	// address.
	CloseRemainderTo Address `codec:"close"`
	// contains filtered or unexported fields
}

PaymentTxnFields captures the fields used by payment transactions.

type Payset

type Payset []SignedTxnInBlock

A Payset represents a common, unforgeable, consistent, ordered set of SignedTxn objects.

type Proof

type Proof struct {

	// Path is bounded by MaxNumLeavesOnEncodedTree since there could be multiple reveals, and
	// given the distribution of the elt positions and the depth of the tree,
	// the path length can increase up to 2^MaxEncodedTreeDepth / 2
	Path        []GenericDigest `codec:"pth,allocbound=MaxNumLeavesOnEncodedTree/2"`
	HashFactory HashFactory     `codec:"hsh"`
	// TreeDepth represents the depth of the tree that is being proven.
	// It is the number of edges from the root to a leaf.
	TreeDepth uint8 `codec:"td"`
	// contains filtered or unexported fields
}

Proof is used to convince a verifier about membership of leaves: h0,h1...hn at indexes i0,i1...in on a tree. The verifier has a trusted value of the tree root hash.

type Reveal

type Reveal struct {
	SigSlot sigslotCommit `codec:"s"`
	Part    Participant   `codec:"p"`
	// contains filtered or unexported fields
}

Reveal is a single array position revealed as part of a state proof. It reveals an element of the signature array and the corresponding element of the participants array.

type RewardsState

type RewardsState struct {

	// The FeeSink accepts transaction fees. It can only spend to
	// the incentive pool.
	FeeSink Address `codec:"fees"`

	// The RewardsPool accepts periodic injections from the
	// FeeSink and continually redistributes them to adresses as
	// rewards.
	RewardsPool Address `codec:"rwd"`

	// RewardsLevel specifies how many rewards, in MicroAlgos,
	// have been distributed to each config.Protocol.RewardUnit
	// of MicroAlgos since genesis.
	RewardsLevel uint64 `codec:"earn"`

	// The number of new MicroAlgos added to the participation stake from rewards at the next round.
	RewardsRate uint64 `codec:"rate"`

	// The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits
	// MicroAlgos for every reward unit in the next round.
	RewardsResidue uint64 `codec:"frac"`

	// The round at which the RewardsRate will be recalculated.
	RewardsRecalculationRound Round `codec:"rwcalr"`
	// contains filtered or unexported fields
}

RewardsState represents the global parameters controlling the rate at which accounts accrue rewards.

type Round

type Round uint64

Round represents a round of the Algorand consensus protocol

type Seed

type Seed [32]byte

A Seed contains cryptographic entropy which can be used to determine a committee.

type Signature

type Signature [ed25519.SignatureSize]byte

Signature is an ed25519 signature

type SignedBid

type SignedBid struct {

	// Bid contains information about the bid.
	Bid Bid `codec:"bid"`

	// Sig is a signature by the bidder, as identified in the bid
	// (Bid.BidderKey) over the hash of the Bid.
	Sig Signature `codec:"sig"`
	// contains filtered or unexported fields
}

SignedBid represents a signed bid by a bidder.

type SignedTxn

type SignedTxn struct {
	Sig      Signature   `codec:"sig"`
	Msig     MultisigSig `codec:"msig"`
	Lsig     LogicSig    `codec:"lsig"`
	Txn      Transaction `codec:"txn"`
	AuthAddr Address     `codec:"sgnr"`
	// contains filtered or unexported fields
}

SignedTxn wraps a transaction and a signature. The encoding of this struct is suitable to broadcast on the network

func (*SignedTxn) FromBase64String

func (signedTxn *SignedTxn) FromBase64String(b64string string) error

FromBase64String converts a base64 string to a SignedTxn

type SignedTxnInBlock

type SignedTxnInBlock struct {
	SignedTxnWithAD

	HasGenesisID   bool `codec:"hgi"`
	HasGenesisHash bool `codec:"hgh"`
	// contains filtered or unexported fields
}

SignedTxnInBlock is how a signed transaction is encoded in a block.

type SignedTxnWithAD

type SignedTxnWithAD struct {
	SignedTxn
	ApplyData
	// contains filtered or unexported fields
}

SignedTxnWithAD is a (decoded) SignedTxn with associated ApplyData

type SingleLeafProof

type SingleLeafProof struct {
	Proof
	// contains filtered or unexported fields
}

SingleLeafProof is used to convince a verifier about membership of a specific leaf h at index i on a tree. The verifier has a trusted value of the tree root hash. it corresponds to merkle verification path.

type StateDelta

type StateDelta map[string]ValueDelta

StateDelta is a map from key/value store keys to ValueDeltas, indicating what should happen for that key

type StateProof

type StateProof struct {
	SigCommit                  GenericDigest `codec:"c"`
	SignedWeight               uint64        `codec:"w"`
	SigProofs                  Proof         `codec:"S"`
	PartProofs                 Proof         `codec:"P"`
	MerkleSignatureSaltVersion byte          `codec:"v"`
	// Reveals is a sparse map from the position being revealed
	// to the corresponding elements from the sigs and participants
	// arrays.
	Reveals           map[uint64]Reveal `codec:"r,allocbound=MaxReveals"`
	PositionsToReveal []uint64          `codec:"pr,allocbound=MaxReveals"`
	// contains filtered or unexported fields
}

StateProof represents a proof on Algorand's state.

type StateProofTrackingData

type StateProofTrackingData struct {

	// StateProofVotersCommitment is the root of a vector commitment containing the
	// online accounts that will help sign a state proof.  The
	// VC root, and the state proof, happen on blocks that
	// are a multiple of ConsensusParams.StateProofRounds.  For blocks
	// that are not a multiple of ConsensusParams.StateProofRounds,
	// this value is zero.
	StateProofVotersCommitment GenericDigest `codec:"v"`

	// StateProofOnlineTotalWeight is the total number of microalgos held by the online accounts
	// during the StateProof round (or zero, if the merkle root is zero - no commitment for StateProof voters).
	// This is intended for computing the threshold of votes to expect from StateProofVotersCommitment.
	StateProofOnlineTotalWeight MicroAlgos `codec:"t"`

	// StateProofNextRound is the next round for which we will accept
	// a StateProof transaction.
	StateProofNextRound Round `codec:"n"`
	// contains filtered or unexported fields
}

StateProofTrackingData tracks the status of state proofs.

type StateProofTxnFields

type StateProofTxnFields struct {
	StateProofType StateProofType `codec:"sptype"`
	StateProof     StateProof     `codec:"sp"`
	Message        Message        `codec:"spmsg"`
	// contains filtered or unexported fields
}

StateProofTxnFields captures the fields used for stateproof transactions.

type StateProofType

type StateProofType uint64

StateProofType identifies a particular configuration of state proofs.

type StateSchema

type StateSchema struct {
	NumUint      uint64 `codec:"nui"`
	NumByteSlice uint64 `codec:"nbs"`
	// contains filtered or unexported fields
}

StateSchema sets maximums on the number of each type that may be stored

type StateSchemas added in v2.1.0

type StateSchemas struct {
	LocalStateSchema  StateSchema `codec:"lsch"`
	GlobalStateSchema StateSchema `codec:"gsch"`
	// contains filtered or unexported fields
}

StateSchemas is a thin wrapper around the LocalStateSchema and the GlobalStateSchema, since they are often needed together

type Status added in v2.1.0

type Status byte

Status is the delegation status of an account's MicroAlgos

const (
	// Offline indicates that the associated account receives rewards but does not participate in the consensus.
	Offline Status = iota
	// Online indicates that the associated account participates in the consensus and receive rewards.
	Online
	// NotParticipating indicates that the associated account neither participates in the consensus, nor receives rewards.
	// Accounts that are marked as NotParticipating cannot change their status, but can receive and send Algos to other accounts.
	// Two special accounts that are defined as NotParticipating are the incentive pool (also know as rewards pool) and the fee sink.
	// These two accounts also have additional Algo transfer restrictions.
	NotParticipating
)

type SuggestedParams

type SuggestedParams struct {
	// Fee is the suggested transaction fee
	// Fee is in units of micro-Algos per byte.
	// Fee may fall to zero but a group of N atomic transactions must
	// still have a fee of at least N*MinTxnFee for the current network protocol.
	Fee MicroAlgos `codec:"fee"`

	// Genesis ID
	GenesisID string `codec:"genesis-id"`

	// Genesis hash
	GenesisHash []byte `codec:"genesis-hash"`

	// FirstRoundValid is the first protocol round on which the txn is valid
	FirstRoundValid Round `codec:"first-round"`

	// LastRoundValid is the final protocol round on which the txn may be committed
	LastRoundValid Round `codec:"last-round"`

	// ConsensusVersion indicates the consensus protocol version
	// as of LastRound.
	ConsensusVersion string `codec:"consensus-version"`

	// FlatFee indicates whether the passed fee is per-byte or per-transaction
	// If true, txn fee may fall below the MinTxnFee for the current network protocol.
	FlatFee bool `codec:"flat-fee"`

	// The minimum transaction fee (not per byte) required for the
	// txn to validate for the current network protocol.
	MinFee uint64 `codec:"min-fee"`
}

SuggestedParams wraps the transaction parameters common to all transactions, typically received from the SuggestedParams endpoint of algod. This struct itself is not sent over the wire to or from algod: see models.TransactionParams.

type TealKeyValue added in v2.1.0

type TealKeyValue map[string]TealValue

TealKeyValue represents a key/value store for use in an application's LocalState or GlobalState

type TealType added in v2.1.0

type TealType uint64

TealType is an enum of the types in a TEAL program: Bytes and Uint

const (
	// TealBytesType represents the type of a byte slice in a TEAL program
	TealBytesType TealType = 1

	// TealUintType represents the type of a uint in a TEAL program
	TealUintType TealType = 2
)

type TealValue added in v2.1.0

type TealValue struct {
	Type  TealType `codec:"tt"`
	Bytes string   `codec:"tb"`
	Uint  uint64   `codec:"ui"`
	// contains filtered or unexported fields
}

TealValue contains type information and a value, representing a value in a TEAL program

type Transaction

type Transaction struct {

	// Type of transaction
	Type TxType `codec:"type"`

	// Common fields for all types of transactions
	Header

	// Fields for different types of transactions
	KeyregTxnFields
	PaymentTxnFields
	AssetConfigTxnFields
	AssetTransferTxnFields
	AssetFreezeTxnFields
	ApplicationFields
	StateProofTxnFields
	// contains filtered or unexported fields
}

Transaction describes a transaction that can appear in a block.

func (*Transaction) AddLease

func (tx *Transaction) AddLease(lease [32]byte, feePerByte uint64)

AddLease adds the passed lease (see types/transaction.go) to the header of the passed transaction and updates fee accordingly - lease: the [32]byte lease to add to the header - feePerByte: the new feePerByte

func (*Transaction) AddLeaseWithFlatFee

func (tx *Transaction) AddLeaseWithFlatFee(lease [32]byte, flatFee uint64)

AddLeaseWithFlatFee adds the passed lease (see types/transaction.go) to the header of the passed transaction and updates fee accordingly - lease: the [32]byte lease to add to the header - flatFee: the new flatFee

func (*Transaction) Rekey

func (tx *Transaction) Rekey(rekeyToAddress string) error

Rekey sets the rekeyTo field to the passed address. Any future transacrtion will need to be signed by the rekeyTo address' corresponding private key.

type TxGroup

type TxGroup struct {

	// TxGroupHashes specifies a list of hashes of transactions that must appear
	// together, sequentially, in a block in order for the group to be
	// valid.  Each hash in the list is a hash of a transaction with
	// the `Group` field omitted.
	TxGroupHashes []Digest `codec:"txlist"`
	// contains filtered or unexported fields
}

TxGroup describes a group of transactions that must appear together in a specific order in a block.

type TxType

type TxType string

TxType identifies the type of the transaction

const (
	// PaymentTx is the TxType for payment transactions
	PaymentTx TxType = "pay"
	// KeyRegistrationTx is the TxType for key registration transactions
	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"
	// ApplicationCallTx allows creating, deleting, and interacting with an application
	ApplicationCallTx TxType = "appl"
	// StateProofTx records a state proof
	StateProofTx TxType = "stpf"
)

type Txid added in v2.1.0

type Txid Digest

Txid is a hash used to uniquely identify individual transactions

type Txlease added in v2.1.0

type Txlease struct {
	Sender Address
	Lease  [32]byte
}

A Txlease is a transaction (sender, lease) pair which uniquely specifies a transaction lease.

type TxnCommitments

type TxnCommitments struct {

	// Root of transaction merkle tree using SHA512_256 hash function.
	// This commitment is computed based on the PaysetCommit type specified in the block's consensus protocol.
	NativeSha512_256Commitment Digest `codec:"txn"`

	// Root of transaction vector commitment merkle tree using SHA256 hash function
	Sha256Commitment Digest `codec:"txn256"`
	// contains filtered or unexported fields
}

TxnCommitments represents the commitments computed from the transactions in the block. It contains multiple commitments based on different algorithms and hash functions, to support different use cases.

type UpgradeState

type UpgradeState struct {
	CurrentProtocol        string `codec:"proto"`
	NextProtocol           string `codec:"nextproto"`
	NextProtocolApprovals  uint64 `codec:"nextyes"`
	NextProtocolVoteBefore Round  `codec:"nextbefore"`
	NextProtocolSwitchOn   Round  `codec:"nextswitch"`
}

UpgradeState tracks the protocol upgrade state machine. It is, strictly speaking, computable from the history of all UpgradeVotes but we keep it in the block for explicitness and convenience (instead of materializing it separately, like balances).

type UpgradeVote

type UpgradeVote struct {

	// UpgradePropose indicates a proposed upgrade
	UpgradePropose string `codec:"upgradeprop"`

	// UpgradeDelay indicates the time between acceptance and execution
	UpgradeDelay Round `codec:"upgradedelay"`

	// UpgradeApprove indicates a yes vote for the current proposal
	UpgradeApprove bool `codec:"upgradeyes"`
	// contains filtered or unexported fields
}

UpgradeVote represents the vote of the block proposer with respect to protocol upgrades.

type VRFPK

type VRFPK [ed25519.PublicKeySize]byte

VRFPK is the VRF public key used in key registration transactions

type VRFVerifier added in v2.1.0

type VRFVerifier [32]byte

VRFVerifier is a deprecated name for VrfPubkey

type ValueDelta

type ValueDelta struct {
	Action DeltaAction `codec:"at"`
	Bytes  string      `codec:"bs"`
	Uint   uint64      `codec:"ui"`
	// contains filtered or unexported fields
}

ValueDelta links a DeltaAction with a value to be set

type Verifier

type Verifier struct {
	Commitment  Commitment `codec:"cmt"`
	KeyLifetime uint64     `codec:"lf"`
	// contains filtered or unexported fields
}

Verifier is used to verify a merklesignature.Signature produced by merklesignature.Secrets.

type VotePK

type VotePK [ed25519.PublicKeySize]byte

VotePK is the participation public key used in key registration transactions

type VotingData added in v2.1.0

type VotingData struct {
	VoteID       OneTimeSignatureVerifier
	SelectionID  VRFVerifier
	StateProofID Commitment

	VoteFirstValid  Round
	VoteLastValid   Round
	VoteKeyDilution uint64
}

VotingData holds participation information

Jump to

Keyboard shortcuts

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