Documentation ¶
Index ¶
- Constants
- Variables
- func AppDataDir(appName string, roaming bool) string
- func CleanAndExpandPath(path string) string
- func GenerateNetworkKeypair() (crypto.PrivKey, crypto.PubKey, error)
- func HasNetworkKey(ds Datastore) (bool, error)
- func LoadNetworkKey(ds Datastore) (crypto.PrivKey, error)
- func PutNetworkKey(ds Datastore, key crypto.PrivKey) error
- func TstAppDataDir(goos, appName string, roaming bool) string
- func UseLogger(logger *logger.Logger)
- func VersionString() string
- type Config
- type Datastore
- type Policy
- type RPCOptions
- type TorOptions
Constants ¶
const ( DefaultLogFilename = "ilxd.log" DefaultFeePerKilobyte = 10000 DefaultMinimumStake = 175000000000 DefaultMaxMessageSize = 1 << 23 // 8 MiB DefaultSoftLimit = 1 << 20 // 1 MiB )
const ( // NetworkKeyDatastoreKey is the datastore key for the network (libp2p) private key. NetworkKeyDatastoreKey = "/ilxd/libp2pkey/" // ValidatorDatastoreKeyPrefix is the datastore key prefix for the validators. ValidatorDatastoreKeyPrefix = "/ilxd/validator/" // ValidatorSetLastFlushHeight is the datastore key for last flush height of the validator set. ValidatorSetLastFlushHeight = "/ilxd/validatorsetlastflushheight/" // ValidatorSetConsistencyStatusKey is the datastore key for the validator set flush state. ValidatorSetConsistencyStatusKey = "/ilxd/validatorsetconsistencystatus/" // AccumulatorConsistencyStatusKey is the datastore key for the accumulator flush state. AccumulatorConsistencyStatusKey = "/ilxd/accumulatorconsistencystatus/" // AccumulatorLastFlushHeight is the datastore key for last flush height of the accumulator. AccumulatorLastFlushHeight = "/ilxd/accumulatorlastflushheight/" // BlockByHeightKeyPrefix is the datastore key prefix for mapping block heights to block IDs. BlockByHeightKeyPrefix = "/ilxd/blockbyheight/" // BlockKeyPrefix is the datastore key prefix for storing block headers by blockID. BlockKeyPrefix = "/ilxd/block/" // BlockTxsKeyPrefix is the datastore key prefix mapping a block ID to a list of txids. BlockTxsKeyPrefix = "/ilxd/blocktxs/" // BlockIndexStateKey is the datastore key used to store the block index best state. BlockIndexStateKey = "/ilxd/blockindex/" // NullifierKeyPrefix is the datastore key prefix for storing nullifiers in the nullifier set. NullifierKeyPrefix = "/ilxd/nullifier/" // TxoRootKeyPrefix is the datastore key prefix for storing a txo root in the database. TxoRootKeyPrefix = "/ilxd/txoroot/" // TreasuryBalanceKey is the datastire key for storing the balance of the treasury in the database. TreasuryBalanceKey = "/ilxd/treasury/" // AccumulatorStateKey is the datastore key for storing the accumulator state. AccumulatorStateKey = "/ilxd/accumulator/" // AccumulatorCheckpointKey is the datastore key for storing accumulator checkpoints. AccumulatorCheckpointKey = "/ilxd/accumulatorcheckpoint/" // CoinSupplyKey is the datastore key for storing the current supply of coins. CoinSupplyKey = "/ilxd/coinsupply/" // IndexerHeightKeyPrefix is the datastore key prefix for mapping indexers to sync heights. IndexerHeightKeyPrefix = "/ilxd/indexerheight/" // IndexKeyPrefix is the datastore key used by each indexer. This must be extended to use. IndexKeyPrefix = "/ilxd/index/" // ConnGaterKeyPrefix is the datastore namespace key used by the conngater. ConnGaterKeyPrefix = "/ilxd/conngater/" // AutostakeDatastoreKey is the datastore key used to store the autostake bool. AutostakeDatastoreKey = "/ilxd/autostake/" // PrunedBlockchainDatastoreKey is the datastore key used to store a flag setting whether the chain has ever been pruned. PrunedBlockchainDatastoreKey = "/ilxd/pruned/" // CachedAddrInfoDatastoreKey is the datastore key used to persist addrinfos from the peerstore. CachedAddrInfoDatastoreKey = "/ilxd/peerstore/addrinfo/" // TreasuryWhitelistDatastoreKeyPrefix is the datastore key prefix for the treasury whitelist. TreasuryWhitelistDatastoreKeyPrefix = "/ilxd/whitelist/" // TxIndexKey is the datastore key for the transaction index. TxIndexKey = "txindex" // WalletServerIndexKey is the datastore key for the wallet server index. WalletServerIndexKey = "walletserverindex" // AddrIndexKey is the datastore key for the address index. AddrIndexKey = "addrindex" // WalletServerAccumulatorKey is the accumulator key used by the wallet server index. WalletServerAccumulatorKey = "accumulator" // WalletServerBestBlockKey is the best block key used by the wallet server index. WalletServerBestBlockKey = "bestblockid" // WalletServerViewKeyPrefix is the view key prefix used by the wallet server index. WalletServerViewKeyPrefix = "viewkey/" // WalletServerLockingScriptPrefix is the locking script prefix used by the wallet server index. WalletServerLockingScriptPrefix = "lockingscript/" // WalletServerNullifierKeyPrefix is the nullifier key prefix used by the wallet server index. WalletServerNullifierKeyPrefix = "nullifier/" // WalletServerTxKeyPrefix is the tx key prefix used by the wallet server index. WalletServerTxKeyPrefix = "tx/" // AddrIndexAddrKeyPrefix is the address key prefix used by the address index. AddrIndexAddrKeyPrefix = "addr/" // AddrIndexNulliferKeyPrefix is the nullifier key prefix used by the address index. AddrIndexNulliferKeyPrefix = "nullifier/" // AddrIndexOutputIndexKey is the outputs datastore key used by the address index. AddrIndexOutputIndexKey = "outputs/" // AddrIndexMetadataPrefixKey is the metadata prefix datastore key used by the address index. AddrIndexMetadataPrefixKey = "metadata/" // AddrIndexValidatorTxPrefixKey is the validator transaction datastore key prefix used by the address index. AddrIndexValidatorTxPrefixKey = "validatortx/" )
const ( AppMajor uint = 0 AppMinor uint = 0 AppPatch uint = 11 // AppPreRelease MUST only contain characters from semanticAlphabet // per the semantic versioning spec. AppPreRelease = "alpha" )
These constants define the application version and follow the semantic versioning 2.0.0 spec (http://semver.org/).
Variables ¶
var (
DefaultHomeDir = AppDataDir("ilxd", false)
)
Functions ¶
func AppDataDir ¶
AppDataDir returns an operating system specific directory to be used for storing application data for an application.
The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.
The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.
Example results:
dir := AppDataDir("myapp", false) POSIX (Linux/BSD): ~/.myapp Mac OS: $HOME/Library/Application Support/Myapp Windows: %LOCALAPPDATA%\Myapp Plan 9: $home/myapp
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it.
func HasNetworkKey ¶
func TstAppDataDir ¶
TstAppDataDir makes the internal appDataDir function available to the test package.
func VersionString ¶
func VersionString() string
VersionString returns the application version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).
Types ¶
type Config ¶
type Config struct { ShowVersion bool `short:"v" long:"version" description:"Display version information and exit"` ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"` DataDir string `short:"d" long:"datadir" description:"Directory to store data"` LogDir string `long:"logdir" description:"Directory to log output"` WalletDir string `long:"walletdir" description:"Directory to store wallet data"` LogLevel string `short:"l" long:"loglevel" description:"Set the logging level [trace, debug, info, warning, error, fatal]." default:"info"` EnableDebugLogging bool `long:"debug" description:"Enable libp2p debug logging to the terminal"` SeedAddrs []string `long:"seedaddr" description:"Override the default seed addresses with the provided values"` ListenAddrs []string `long:"listenaddr" description:"Override the default listen addresses with the provided values"` Testnet bool `short:"t" long:"testnet" description:"Use the test network"` Alphanet bool `long:"alpha" description:"Use the alpha network"` Regtest bool `short:"r" long:"regtest" description:"Use regression testing mode"` RegtestVal bool `long:"regtestval" description:"Set self as the regtest genesis validator. This can only be done on first startup."` DisableNATPortMap bool `long:"noupnp" description:"Disable use of upnp"` UserAgent string `long:"useragent" description:"A custom user agent to advertise to the network"` NoTxIndex bool `long:"notxindex" description:"Disable the transaction index"` DropTxIndex bool `long:"droptxindex" description:"Delete the tx index from the database"` WSIndex bool `long:"wsindex" description:"Enable the wallet server index to serve lite wallets"` DropWSIndex bool `long:"dropwsindex" description:"Delete the wallet server index from the database"` AddrIndex bool `long:"addrindex" description:"Enable the address index"` DropAddrIndex bool `long:"dropaddrindex" description:"Delete the address index from the database"` MaxBanscore uint32 `long:"maxbanscore" description:"The maximum ban score a peer is allowed to have before getting banned" default:"100"` BanDuration time.Duration `long:"banduration" description:"The duration for which banned peers are banned for" default:"24h"` WalletSeed string `long:"walletseed" description:"A mnemonic seed to initialize the node with. This can only be used on first startup."` CoinbaseAddress string `` /* 171-byte string literal not displayed */ NetworkKey string `long:"networkkey" description:"A network key to use for this node. This will override the node's peer ID."` Prune bool `long:"prune" description:"Delete the blockchain from disk. The node will store just the date needed to validate new blocks."` MockProofs bool `long:"mock" description:"Set the node to use mock proofs instead of full proofs. This option is only available for regtest."` Checkpoint string `` /* 177-byte string literal not displayed */ Policy Policy `group:"Policy"` RPCOpts RPCOptions `group:"RPC Options"` TorOptions TorOptions `group:"Tor Options"` }
Config defines the configuration options for the node.
See LoadConfig for details on the configuration load process.
func LoadConfig ¶
LoadConfig initializes and parses the config using a config file and command line options.
The configuration proceeds as follows:
- Start with a default config with sane settings
- Pre-parse the command line to check for an alternative config file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
The above results in proper functionality without any config settings while still allowing the user to override settings with config files and command line options. Command line options always take precedence.
type Datastore ¶
type Datastore interface { datastore.Datastore datastore.Batching datastore.PersistentDatastore datastore.TxnDatastore }
type Policy ¶
type Policy struct { MinFeePerKilobyte uint64 `` /* 129-byte string literal not displayed */ MinStake uint64 `long:"minstake" description:"The minimum stake required to accept a stake tx into the mempool or a generated block"` TreasuryWhitelist []string `long:"treasurywhitelist" description:"Allow these treasury txids into the mempool and generated blocks"` BlocksizeSoftLimit uint32 `long:"blocksizesoftlimit" description:"The maximum size block this node will generate"` MaxMessageSize int `` /* 178-byte string literal not displayed */ }
type RPCOptions ¶
type RPCOptions struct { RPCCert string `long:"rpccert" description:"A path to the SSL certificate to use with gRPC"` RPCKey string `long:"rpckey" description:"A path to the SSL key to use with gRPC"` ExternalIPs []string `` /* 138-byte string literal not displayed */ GrpcListener string `` /* 151-byte string literal not displayed */ GrpcAuthToken string `long:"grpcauthtoken" description:"Set a token here if you want to enable client authentication with gRPC."` DisableNodeService bool `` /* 145-byte string literal not displayed */ DisableWalletService bool `` /* 149-byte string literal not displayed */ DisableWalletServerService bool `` /* 145-byte string literal not displayed */ EnableProverService bool `long:"enableproverservice" description:"Enable the prover RPC service. This is not turned on by default."` }