Documentation ¶
Index ¶
- Constants
- Variables
- func AccountNameFromPartKeyFilename(filename string) string
- func AccountNameFromRootKeyFilename(filename string) string
- func FormatVersionAndLicense() string
- func GetAlgorandVersion() string
- func GetConfigFilePath(file string) (string, error)
- func GetDefaultConfigFilePath() (string, error)
- func GetGlobalConfigFileRoot() (string, error)
- func GetLicenseInfo() string
- func IsPartKeyFilename(filename string) bool
- func IsRootKeyFilename(filename string) bool
- func LoadPhonebook(datadir string) ([]string, error)
- func MatchesPartKeyFilename(s, filename string) bool
- func MatchesRootKeyFilename(s, filename string) bool
- func PartKeyFilename(s string, firstValid, lastValid uint64) string
- func RootKeyFilename(s string) string
- func SavePhonebookToDisk(entries []string, root string) error
- func SetCurrentVersion(version Version)
- func SetGlobalConfigFileRoot(rootPath string) string
- func UpdateVersionDataDir(dataDir string)
- type ConsensusParams
- type Global
- type Local
- type Version
Constants ¶
const ConfigFilename = "config.json"
ConfigFilename is the name of the config.json file where we store per-algod-instance settings
const CrashFilename = "crash.sqlite"
CrashFilename is the name of the agreement database file. It is used to recover from node crashes.
const Devnet protocol.NetworkID = "devnet"
Devnet identifies the 'development network' use for development and not generally accessible publicly
const Devtestnet protocol.NetworkID = "devtestnet"
Devtestnet identifies the 'development network for tests' use for running tests against development and not generally accessible publicly
const GenesisJSONFile = "genesis.json"
GenesisJSONFile is the name of the genesis.json file
const LedgerFilenamePrefix = "ledger"
LedgerFilenamePrefix is the prefix of the name of the ledger database files
const Mainnet protocol.NetworkID = "mainnet"
Mainnet identifies the publicly-available real-money network
const PhonebookFilename = "phonebook.json" // No longer used in product - still in tests
PhonebookFilename is the name of the phonebook configuration files - no longer used
const Testnet protocol.NetworkID = "testnet"
Testnet identifies the publicly-available test network
const VersionMajor = 2
VersionMajor is the Major semantic version number (#.y.z) - changed when first public release (0.y.z -> 1.y.z) and when backwards compatibility is broken.
const VersionMinor = 0
VersionMinor is the Minor semantic version number (x.#.z) - changed when backwards-compatible features are introduced. Not enforced until after initial public release (x > 0).
Variables ¶
var Branch string
Branch is the git branch in effect when the build was created. It will be set by the build tools
var BuildNumber string
BuildNumber is the monotonic build number, currently based on the date and hour-of-day. It will be set to a build number by the build tools (for 'production' builds for now)
var Channel string
Channel is the computed release channel based on the Branch in effect when the build was created. It will be set by the build tools
var CommitHash string
CommitHash is the git commit id in effect when the build was created. It will be set by the build tools (for 'production' builds for now)
var Consensus map[protocol.ConsensusVersion]ConsensusParams
Consensus tracks the protocol-level settings for different versions of the consensus protocol.
var DefaultDeadlock string
DefaultDeadlock is the default setting to use for EnableDeadlockDetection. It's computed for the build based on the current branch being built - intending to disable deadlock detection in 'production' builds.
var Protocol = Global{ SmallLambda: 2000 * time.Millisecond, BigLambda: 15000 * time.Millisecond, }
Protocol holds the global configuration settings for the agreement protocol, initialized with our current defaults. This is used across all nodes we create.
Functions ¶
func AccountNameFromPartKeyFilename ¶
AccountNameFromPartKeyFilename returns the account name given a participation key filename.
If filename is not a valid participation key filename, this returns the filename unchanged.
func AccountNameFromRootKeyFilename ¶
AccountNameFromRootKeyFilename returns the account name given a root key filename.
If filename is not a valid root key filename, this returns the filename unchanged.
func FormatVersionAndLicense ¶
func FormatVersionAndLicense() string
FormatVersionAndLicense prints current version and license information
func GetAlgorandVersion ¶
func GetAlgorandVersion() string
GetAlgorandVersion retrieves the current version formatted as a simple version string (Major.Minor.BuildNumber)
func GetConfigFilePath ¶
GetConfigFilePath retrieves the full path to a configuration file These are global configurations - not specific to data-directory / network.
func GetDefaultConfigFilePath ¶
GetDefaultConfigFilePath retrieves the default directory for global (not per-instance) config files By default we store in ~/.algorand/. This will likely only change for tests.
func GetGlobalConfigFileRoot ¶
GetGlobalConfigFileRoot returns the current root folder for global configuration files. This will likely only change for tests.
func GetLicenseInfo ¶
func GetLicenseInfo() string
GetLicenseInfo retrieves the current license information
func IsPartKeyFilename ¶
IsPartKeyFilename returns true if the given filename is a valid participation key filename.
func IsRootKeyFilename ¶
IsRootKeyFilename returns true if the given filename is a valid root key filename.
func LoadPhonebook ¶
LoadPhonebook returns a phonebook loaded from the provided directory, if it exists. NOTE: We no longer use phonebook for anything but tests, but users should be able to use it
func MatchesPartKeyFilename ¶
MatchesPartKeyFilename returns true if the given filename is the participation key file of the given account name.
func MatchesRootKeyFilename ¶
MatchesRootKeyFilename returns true if the given filename is the root key file of the given account name.
func PartKeyFilename ¶
PartKeyFilename gives the participation key filename that corresponds to the given account name and validity period.
func RootKeyFilename ¶
RootKeyFilename gives the root key filename that corresponds to the given account name.
func SavePhonebookToDisk ¶
SavePhonebookToDisk writes the phonebook into a root/PhonebookFilename file
func SetCurrentVersion ¶
func SetCurrentVersion(version Version)
SetCurrentVersion allows replacing the current global Version structure (for the application)
func SetGlobalConfigFileRoot ¶
SetGlobalConfigFileRoot allows overriding the root folder for global configuration files. It returns the current one so it can be restored, if desired. This will likely only change for tests.
func UpdateVersionDataDir ¶
func UpdateVersionDataDir(dataDir string)
UpdateVersionDataDir is a convenience method for setting the data dir on the global Version struct Used by algod and algoh to set built-time ephemeral version component e.g. data directory
Types ¶
type ConsensusParams ¶
type ConsensusParams struct { // Consensus protocol upgrades. Votes for upgrades are collected for // UpgradeVoteRounds. If the number of positive votes is over // UpgradeThreshold, the proposal is accepted. // // UpgradeVoteRounds needs to be long enough to collect an // accurate sample of participants, and UpgradeThreshold needs // to be high enough to ensure that there are sufficient participants // after the upgrade. // // There is a delay of UpgradeWaitRounds between approval of // an upgrade and its deployment, to give clients time to notify users. UpgradeVoteRounds uint64 UpgradeThreshold uint64 UpgradeWaitRounds uint64 MaxVersionStringLen int // MaxTxnBytesPerBlock determines the maximum number of bytes // that transactions can take up in a block. Specifically, // the sum of the lengths of encodings of each transaction // in a block must not exceed MaxTxnBytesPerBlock. MaxTxnBytesPerBlock int // MaxTxnBytesPerBlock is the maximum size of a transaction's Note field. MaxTxnNoteBytes int // MaxTxnLife is how long a transaction can be live for: // the maximum difference between LastValid and FirstValid. // // Note that in a protocol upgrade, the ledger must first be upgraded // to hold more past blocks for this value to be raised. MaxTxnLife uint64 // ApprovedUpgrades describes the upgrade proposals that this protocol // implementation will vote for. ApprovedUpgrades map[protocol.ConsensusVersion]bool // SupportGenesisHash indicates support for the GenesisHash // fields in transactions (and requires them in blocks). SupportGenesisHash bool // RequireGenesisHash indicates that GenesisHash must be present // in every transaction. RequireGenesisHash bool // DefaultKeyDilution specifies the granularity of top-level ephemeral // keys. KeyDilution is the number of second-level keys in each batch, // signed by a top-level "batch" key. The default value can be // overriden in the account state. DefaultKeyDilution uint64 // MinBalance specifies the minimum balance that can appear in // an account. To spend money below MinBalance requires issuing // an account-closing transaction, which transfers all of the // money from the account, and deletes the account state. MinBalance uint64 // MinTxnFee specifies the minimum fee allowed on a transaction. // A minimum fee is necessary to prevent DoS. In some sense this is // a way of making the spender subsidize the cost of storing this transaction. MinTxnFee uint64 // RewardUnit specifies the number of MicroAlgos corresponding to one reward // unit. // // Rewards are received by whole reward units. Fractions of // RewardUnits do not receive rewards. RewardUnit uint64 // RewardsRateRefreshInterval is the number of rounds after which the // rewards level is recomputed for the next RewardsRateRefreshInterval rounds. RewardsRateRefreshInterval uint64 // seed-related parameters SeedLookback uint64 // how many blocks back we use seeds from in sortition. delta_s in the spec SeedRefreshInterval uint64 // how often an old block hash is mixed into the seed. delta_r in the spec // ledger retention policy MaxBalLookback uint64 // (current round - MaxBalLookback) is the oldest round the ledger must answer balance queries for // sortition threshold factors NumProposers uint64 SoftCommitteeSize uint64 SoftCommitteeThreshold uint64 CertCommitteeSize uint64 CertCommitteeThreshold uint64 NextCommitteeSize uint64 // for any non-FPR votes >= deadline step, committee sizes and thresholds are constant NextCommitteeThreshold uint64 LateCommitteeSize uint64 LateCommitteeThreshold uint64 RedoCommitteeSize uint64 RedoCommitteeThreshold uint64 DownCommitteeSize uint64 DownCommitteeThreshold uint64 FastRecoveryLambda time.Duration // time between fast recovery attempts FastPartitionRecovery bool // set when fast partition recovery is enabled // commit to payset using a hash of entire payset, // instead of txid merkle tree PaysetCommitFlat bool MaxTimestampIncrement int64 // maximum time between timestamps on successive blocks // support for the efficient encoding in SignedTxnInBlock SupportSignedTxnInBlock bool // force the FeeSink address to be non-participating in the genesis balances. ForceNonParticipatingFeeSink bool // support for ApplyData in SignedTxnInBlock ApplyData bool // track reward distributions in ApplyData RewardsInApplyData bool // domain-separated credentials CredentialDomainSeparationEnabled bool // support for transactions that mark an account non-participating SupportBecomeNonParticipatingTransactions bool // fix the rewards calculation by avoiding subtracting too much from the rewards pool PendingResidueRewards bool // asset support Asset bool // max number of assets per account MaxAssetsPerAccount int // max length of asset name MaxAssetNameBytes int // max length of asset unit name MaxAssetUnitNameBytes int // max length of asset url MaxAssetURLBytes int // support sequential transaction counter TxnCounter TxnCounter bool // transaction groups SupportTxGroups bool // max group size MaxTxGroupSize int // support for transaction leases SupportTransactionLeases bool // 0 for no support, otherwise highest version supported LogicSigVersion uint64 // len(LogicSig.Logic) + len(LogicSig.Args[*]) must be less than this LogicSigMaxSize uint64 // sum of estimated op cost must be less than this LogicSigMaxCost uint64 }
ConsensusParams specifies settings that might vary based on the particular version of the consensus protocol.
type Global ¶
type Global struct { SmallLambda time.Duration // min amount of time to wait for leader's credential (i.e., time to propagate one credential) BigLambda time.Duration // max amount of time to wait for leader's proposal (i.e., time to propagate one block) }
Global defines global Algorand protocol parameters which should not be overriden.
type Local ¶
type Local struct { // Version tracks the current version of the defaults so we can migrate old -> new // This is specifically important whenever we decide to change the default value // for an existing parameter. Version uint32 // environmental (may be overridden) // if true, does not garbage collect; also, replies to catchup requests Archival bool // gossipNode.go // how many peers to propagate to? GossipFanout int NetAddress string ReconnectTime time.Duration // what we should tell people to connect to PublicAddress string MaxConnectionsPerIP int // 0 == disable PeerPingPeriodSeconds int // for https serving TLSCertFile string TLSKeyFile string // Logging BaseLoggerDebugLevel uint32 // if this is 0, do not produce agreement.cadaver CadaverSizeTarget uint64 // IncomingConnectionsLimit specifies the max number of long-lived incoming // connections. 0 means no connections allowed. -1 is unbounded. IncomingConnectionsLimit int // BroadcastConnectionsLimit specifies the number of connections that // will receive broadcast (gossip) messages from this node. If the // node has more connections than this number, it will send broadcasts // to the top connections by priority (outgoing connections first, then // by money held by peers based on their participation key). 0 means // no outgoing messages (not even transaction broadcasting to outgoing // peers). -1 means unbounded (default). BroadcastConnectionsLimit int // AnnounceParticipationKey specifies that this node should announce its // participation key (with the largest stake) to its gossip peers. This // allows peers to prioritize our connection, if necessary, in case of a // DoS attack. Disabling this means that the peers will not have any // additional information to allow them to prioritize our connection. AnnounceParticipationKey bool // PriorityPeers specifies peer IP addresses that should always get // outgoing broadcast messages from this node. PriorityPeers map[string]bool // To make sure the algod process does not run out of FDs, algod ensures // that RLIMIT_NOFILE exceeds the max number of incoming connections (i.e., // IncomingConnectionsLimit) by at least ReservedFDs. ReservedFDs are meant // to leave room for short-lived FDs like DNS queries, SQLite files, etc. ReservedFDs uint64 // local server // API endpoint address EndpointAddress string // timeouts passed to the rest http.Server implementation RestReadTimeoutSeconds int RestWriteTimeoutSeconds int // SRV-based phonebook DNSBootstrapID string // Log file size limit in bytes LogSizeLimit uint64 // text/template for creating log archive filename. // Available template vars: // Time at start of log: {{.Year}} {{.Month}} {{.Day}} {{.Hour}} {{.Minute}} {{.Second}} // Time at end of log: {{.EndYear}} {{.EndMonth}} {{.EndDay}} {{.EndHour}} {{.EndMinute}} {{.EndSecond}} // // If the filename ends with .gz or .bz2 it will be compressed. // // default: "node.archive.log" (no rotation, clobbers previous archive) LogArchiveName string // LogArchiveMaxAge will be parsed by time.ParseDuration(). // Valid units are 's' seconds, 'm' minutes, 'h' hours LogArchiveMaxAge string // number of consecutive attempts to catchup after which we replace the peers we're connected to CatchupFailurePeerRefreshRate int // where should the node exporter listen for metrics NodeExporterListenAddress string // enable metric reporting flag EnableMetricReporting bool // enable top accounts reporting flag EnableTopAccountsReporting bool // enable agreement reporting flag. Currently only prints additional period events. EnableAgreementReporting bool // enable agreement timing metrics flag EnableAgreementTimeMetrics bool // The path to the node exporter. NodeExporterPath string // The fallback DNS resolver address that would be used if the system resolver would fail to retrieve SRV records FallbackDNSResolverAddress string // exponential increase factor of transaction pool's fee threshold, should always be 2 in production TxPoolExponentialIncreaseFactor uint64 SuggestedFeeBlockHistory int // TxPoolSize is the number of transactions that fit in the transaction pool TxPoolSize int // number of seconds allowed for syncing transactions TxSyncTimeoutSeconds int64 // number of seconds between transaction synchronizations TxSyncIntervalSeconds int64 // the number of incoming message hashes buckets. IncomingMessageFilterBucketCount int // the size of each incoming message hash bucket. IncomingMessageFilterBucketSize int // the number of outgoing message hashes buckets. OutgoingMessageFilterBucketCount int // the size of each outgoing message hash bucket. OutgoingMessageFilterBucketSize int // enable the filtering of outgoing messages EnableOutgoingNetworkMessageFiltering bool // enable the filtering of incoming messages EnableIncomingMessageFilter bool // control enabling / disabling deadlock detection. // negative (-1) to disable, positive (1) to enable, 0 for default. DeadlockDetection int // Prefer to run algod Hosted (under algoh) // Observed by `goal` for now. RunHosted bool // The maximal number of blocks that catchup will fetch in parallel. // If less than Protocol.SeedLookback, then Protocol.SeedLookback will be used as to limit the catchup. CatchupParallelBlocks uint64 // Generate AssembleBlockMetrics telemetry event EnableAssembleStats bool // Generate ProcessBlockMetrics telemetry event EnableProcessBlockStats bool // SuggestedFeeSlidingWindowSize is number of past blocks that will be considered in computing the suggested fee SuggestedFeeSlidingWindowSize uint32 // the max size the sync server would return TxSyncServeResponseSize int // IsIndexerActive indicates whether to activate the indexer for fast retrieval of transactions // Note -- Indexer cannot operate on non Archival nodes IsIndexerActive bool // UseXForwardedForAddress indicates whether or not the node should use the X-Forwarded-For HTTP Header when // determining the source of a connection. If used, it should be set to the string "X-Forwarded-For", unless the // proxy vendor provides another header field. In the case of CloudFlare proxy, the "CF-Connecting-IP" header // field can be used. UseXForwardedForAddressField string // ForceRelayMessages indicates whether the network library relay messages even in the case that no NetAddress was specified. ForceRelayMessages bool // ConnectionsRateLimitingWindowSeconds is being used in conjunction with ConnectionsRateLimitingCount; // see ConnectionsRateLimitingCount description for further information. Providing a zero value // in this variable disables the connection rate limiting. ConnectionsRateLimitingWindowSeconds uint // ConnectionsRateLimitingCount is being used along with ConnectionsRateLimitingWindowSeconds to determine if // a connection request should be accepted or not. The gossip network examine all the incoming requests in the past // ConnectionsRateLimitingWindowSeconds seconds that share the same origin. If the total count exceed the ConnectionsRateLimitingCount // value, the connection is refused. ConnectionsRateLimitingCount uint // EnableRequestLogger enabled the logging of the incoming requests to the telemetry server. EnableRequestLogger bool }
Local holds the per-node-instance configuration settings for the protocol.
func GetDefaultLocal ¶
func GetDefaultLocal() Local
GetDefaultLocal returns a copy of the current defaultLocal config
func LoadConfigFromDisk ¶
LoadConfigFromDisk returns a Local config structure based on merging the defaults with settings loaded from the config file from the custom dir. If the custom file cannot be loaded, the default config is returned (with the error from loading the custom file).
func (Local) DNSBootstrap ¶
DNSBootstrap returns the network-specific DNSBootstrap identifier
func (Local) DNSBootstrapArray ¶
DNSBootstrapArray returns an array of one or more DNS Bootstrap identifiers
func (Local) SaveToDisk ¶
SaveToDisk writes the Local settings into a root/ConfigFilename file
func (Local) SaveToFile ¶
SaveToFile saves the config to a specific filename, allowing overriding the default name
type Version ¶
type Version struct { // Algorand's major version number Major int // Algorand's minor version number Minor int // Algorand's Build Number BuildNumber int // Suffix for any metadata Suffix string // Hash of commit the build is based on CommitHash string // Branch the build is based on Branch string // Branch-derived release channel the build is based on Channel string // DataDirectory for the current instance DataDirectory string }
Version is the type holding our full version information.
func GetCurrentVersion ¶
func GetCurrentVersion() Version
GetCurrentVersion retrieves a copy of the current global Version structure (for the application)
func (Version) GetCommitHash ¶
GetCommitHash returns the commit ID for the build's source