Documentation ¶
Index ¶
- Constants
- Variables
- func Configure(appCfg *AppConfig, tmcfg *config.Config, initializing bool)
- func GetInterrupt() *util.Interrupt
- func GetNetVersion() uint64
- func GetRawGenesisData(devMode bool) json.RawMessage
- func IsMainNet() bool
- func IsMainNetVersion(version uint64) bool
- func IsTendermintInitialized(tmcfg *config.Config) bool
- func SetVersion(netVersion uint64)
- type AppConfig
- func (c *AppConfig) DataDir() string
- func (c *AppConfig) G() *Globals
- func (c *AppConfig) GetAppDBDir() string
- func (c *AppConfig) GetAppName() string
- func (c *AppConfig) GetConsoleHistoryPath() string
- func (c *AppConfig) GetDBRootDir() string
- func (c *AppConfig) GetDHTStoreDir() string
- func (c *AppConfig) GetExtensionDir() string
- func (c *AppConfig) GetRepoPath(name string) string
- func (c *AppConfig) GetRepoRoot() string
- func (c *AppConfig) GetStateTreeDBDir() string
- func (c *AppConfig) IsAttachMode() bool
- func (c *AppConfig) IsDev() bool
- func (c *AppConfig) IsLightNode() bool
- func (c *AppConfig) IsProd() bool
- func (c *AppConfig) IsTest() bool
- func (c *AppConfig) IsValidatorNode() bool
- func (c *AppConfig) KeystoreDir() string
- func (c *AppConfig) LoadKeys(nodeKeyFile, privValKeyFile, privValStateFile string) *p2p.NodeKey
- func (c *AppConfig) NetDataDir() string
- func (c *AppConfig) SetDataDir(d string)
- func (c *AppConfig) SetNetDataDir(d string)
- func (c *AppConfig) SetRepoRoot(dir string)
- type ChainInfo
- type DHTConfig
- type GenDataEntry
- type Globals
- type Info
- type MempoolConfig
- type NetConfig
- type NodeConfig
- type RPCConfig
- type RemoteConfig
- type RepoConfig
- type RepoOwner
- type VersionInfo
Constants ¶
const ( // ModeProd refers to production mode ModeProd = iota + 1 // ModeDev refers to development mode ModeDev // ModeTest refers to test mode ModeTest )
const ( GenDataTypeAccount = "account" GenDataTypeRepo = "repo" )
Genesis data type
const DefaultNetVersion = uint64(1)
DefaultNetVersion is the default network version used when no network version is provided.
const MainNetVersion = uint64(1)
MainNetVersion is the main net version number
Variables ¶
var ( // AppName is the name of the application AppName = "kit" // DefaultDataDir is the path to the data directory DefaultDataDir = os.ExpandEnv("$HOME/." + AppName) // KeystoreDirName is the name of the directory where accounts are stored KeystoreDirName = "keystore" // AppEnvPrefix is used as the prefix for environment variables AppEnvPrefix = AppName // DefaultNodeAddress is the default Node listening address DefaultNodeAddress = ":9000" // DefaultTMRPCAddress is the default RPC listening address for the tendermint DefaultTMRPCAddress = "127.0.0.1:9001" // DefaultRemoteServerAddress is the default remote server listening address DefaultRemoteServerAddress = ":9002" // DefaultDHTAddress is the default DHT listening address DefaultDHTAddress = ":9003" // DefaultPassAgentPort is the port on which the passphrase cache agent listens on DefaultPassAgentPort = "9004" // NoColorFormatting indicates that stdout/stderr output should have no color NoColorFormatting = false // DefaultLightNodeTrustPeriod is the trusting period that headers can be // verified within. Should be significantly less than the unbonding period. // TODO: Determine actual value for production env DefaultLightNodeTrustPeriod = 168 * time.Hour )
var DevChain = &ChainInfo{ Name: "dev", NetVersion: "1000", GenesisTime: 1595700581, Validators: []string{}, Configurer: func(cfg *AppConfig, tmc *tmcfg.Config) { tmc.Consensus.CreateEmptyBlocksInterval = 5 * time.Second }, }
DevChain contains configurations for development
var MainChain = &ChainInfo{ Name: "main-dev", NetVersion: "1", GenesisTime: 1595700581, Validators: []string{}, Configurer: func(cfg *AppConfig, tmc *tmcfg.Config) { tmc.Consensus.CreateEmptyBlocksInterval = 120 * time.Second }, }
MainChain contains configurations for mainnet
var TestnetChainV1 = &ChainInfo{ Name: "testnet-v1", NetVersion: "2000", GenesisTime: 1595700581, Validators: []string{ "47shQ9ihsZBf2nYL6tAYR8q8Twb47KTNjimowxaNFRyGPL93oZL", "48LZFEsZsRPda1q2kiNZKToiTaeSx63GJdq6DWq9m9C4mSvWhHD", "48pFW5Yd5BLm4EVUJW8g9oG1BkNQz4wp2saLB8XmkvMRwRAB2FH", "48GKXaSLgJ5ox2C1jDshFGtD6Y4Zhd1doxK6iTDp3KCSZjzdWKt", }, ChainSeedPeers: []string{ "a2f1e5786d3564c14faafffd6a050d2f81c655d9@s1.makeos.org:9000", "9cd75740de0c9d7b2a5d3921b78abbbb39b1bebe@s2.makeos.org:9000", "3ccd79a6f332f83b85f63290ca53187022aada0a@s3.makeos.org:9000", "d0165f00485e22ec0197e15a836ce66587515a84@s4.makeos.org:9000", }, DHTSeedPeers: []string{ "/dns4/s1.makeos.org/tcp/9003/p2p/12D3KooWAeorTJTi3uRDC3nSMa1V9CujJQg5XcN3UjSSV2HDceQU", "/dns4/s2.makeos.org/tcp/9003/p2p/12D3KooWEksv3Nvbv5dRwKRkLJjoLvsuC6hyokj5sERx8mWrxMoB", "/dns4/s3.makeos.org/tcp/9003/p2p/12D3KooWJzM4Hf5KWrXnAJjgJkro7zK2edtDu8ocYt8UgU7vsmFa", "/dns4/s4.makeos.org/tcp/9003/p2p/12D3KooWE7KybnAaoxuw6UiMpof2LT9hMky8k83tZgpdNCqRWx9P", }, Configurer: func(cfg *AppConfig, tmc *tmcfg.Config) { tmc.Consensus.CreateEmptyBlocksInterval = 10 * time.Minute }, }
TestnetChainV1 contains configurations for testnet v1 chain
Functions ¶
func Configure ¶
Configure sets up the application command structure, tendermint and kit configuration. This is where all configuration and settings are prepared
func GetInterrupt ¶
GetInterrupt returns the component interrupt channel
func GetRawGenesisData ¶
func GetRawGenesisData(devMode bool) json.RawMessage
GetRawGenesisData returns the genesis data in raw JSON format. If devMode is true, the development genesis file is used.
func IsMainNetVersion ¶
IsMainNetVersion checks whether a given version represents the mainnet version
func IsTendermintInitialized ¶
IsTendermintInitialized checks if node is initialized
func SetVersion ¶
func SetVersion(netVersion uint64)
SetVersion sets the protocol version. All protocol handlers will be prefixed with the version to create a
Types ¶
type AppConfig ¶
type AppConfig struct { // Node holds the node configurations Node *NodeConfig `json:"node" mapstructure:"node"` // Repo holds repo-related configuration Repo *RepoConfig `json:"repo" mapstructure:"repo"` // Net holds network configurations Net *NetConfig `json:"net" mapstructure:"net"` // RPC holds RPC configurations RPC *RPCConfig `json:"rpc" mapstructure:"rpc"` // DHT holds DHT configurations DHT *DHTConfig `json:"dht" mapstructure:"dht"` // Remote holds repository remote configurations Remote *RemoteConfig `json:"remote" mapstructure:"remote"` // Mempool holds mempool configurations Mempool *MempoolConfig `json:"mempool" mapstructure:"mempool"` // GenesisFileEntries includes the initial state objects GenesisFileEntries []*GenDataEntry `json:"gendata" mapstructure:"gendata"` // VersionInfo holds version information VersionInfo *VersionInfo `json:"-" mapstructure:"-"` // contains filtered or unexported fields }
AppConfig represents the applications configuration
func EmptyAppConfig ¶
func EmptyAppConfig() *AppConfig
EmptyAppConfig returns an empty Config Object
func (*AppConfig) GetAppDBDir ¶
GetAppDBDir returns the path where app's database files are stored.
func (*AppConfig) GetAppName ¶
GetAppName returns the app's name
func (*AppConfig) GetConsoleHistoryPath ¶
GetConsoleHistoryPath returns the filepath where the console input history is stored
func (*AppConfig) GetDBRootDir ¶
GetDBRootDir returns the directory where all database files are stored
func (*AppConfig) GetDHTStoreDir ¶
GetDHTStoreDir returns the path where dht database files are stored
func (*AppConfig) GetExtensionDir ¶
GetExtensionDir returns the extension directory
func (*AppConfig) GetRepoPath ¶ added in v0.0.30
GetRepoPath returns the full path of a repository
func (*AppConfig) GetRepoRoot ¶
GetRepoRoot returns the repo root directory
func (*AppConfig) GetStateTreeDBDir ¶
GetStateTreeDBDir returns the path where state's database files are stored
func (*AppConfig) IsAttachMode ¶
IsAttachMode checks whether the node was started in attach mode
func (*AppConfig) IsLightNode ¶
IsLightNode checks if the node is in light mode
func (*AppConfig) IsValidatorNode ¶
IsValidatorNode checks if the node is in validator mode
func (*AppConfig) KeystoreDir ¶
KeystoreDir returns the application's accounts directory
func (*AppConfig) LoadKeys ¶
LoadKeys gets the node key from the node key file and caches it for fast access
func (*AppConfig) NetDataDir ¶
NetDataDir returns the network's data directory
func (*AppConfig) SetDataDir ¶
SetDataDir sets the application's data directory
func (*AppConfig) SetNetDataDir ¶
SetNetDataDir sets the network's data directory
func (*AppConfig) SetRepoRoot ¶
SetRepoRoot sets the repo root directory
type ChainInfo ¶
type ChainInfo struct { NetVersion string GenesisTime uint64 Validators []string Name string ChainSeedPeers []string DHTSeedPeers []string Configurer func(cfg *AppConfig, tmcfg *tmcfg.Config) }
ChainInfo implements Info
func (*ChainInfo) GetVersion ¶
GetVersion returns the chain's numeric version
type DHTConfig ¶
type DHTConfig struct { On bool `json:"on" mapstructure:"on"` Address string `json:"address" mapstructure:"address"` BootstrapPeers string `json:"addpeer" mapstructure:"addpeer"` }
DHTConfig describes DHT config parameters
type GenDataEntry ¶
type GenDataEntry struct { Type string `json:"type" mapstructure:"type"` Balance string `json:"balance" mapstructure:"balance"` // Type: Account Address string `json:"address" mapstructure:"address"` // Type: Repo Name string `json:"name" mapstructure:"name"` Helm bool `json:"helm" mapstructure:"helm"` Owners map[string]*RepoOwner `json:"owners" mapstructure:"owners"` Config map[string]interface{} `json:"config" mapstructure:"config"` }
GenDataEntry describes a genesis file data entry
func RawStateToGenesisData ¶
func RawStateToGenesisData(state json.RawMessage) (entries []*GenDataEntry)
RawStateToGenesisData returns the genesis data
type Globals ¶
type Globals struct { Log logger.Logger Bus *emitter.Emitter NodeKey *p2p.NodeKey TMConfig *tmcfg.Config PrivVal *ed25519.FilePV }
Globals holds references to global objects
type Info ¶
type Info interface { GetVersion() string GetName() string Configure(cfg *AppConfig, tmc *tmcfg.Config) }
Info describes a chain version
type MempoolConfig ¶
type MempoolConfig struct { Size int `json:"size" mapstructure:"size"` CacheSize int `json:"cacheSize" mapstructure:"cacheSize"` MaxTxSize int `json:"maxTxSize" mapstructure:"maxTxSize"` MaxTxsSize int64 `json:"maxTxsSize" mapstructure:"maxTxsSize"` }
MempoolConfig describes mempool config parameters
type NetConfig ¶
type NetConfig struct {
Version uint64 `json:"version" mapstructure:"version"`
}
NetConfig describes network configurations
type NodeConfig ¶
type NodeConfig struct { // Mode determines the current environment type Mode int `json:"mode" mapstructure:"mode"` // ListeningAddr is the node's listening address ListeningAddr string `json:"address" mapstructure:"address"` // PersistentPeers is a comma separated list of persistent peers to connect to. PersistentPeers string `json:"addpeer" mapstructure:"addpeer"` // GitBinPath is the path to the git executable GitBinPath string `json:"gitpath" mapstructure:"gitpath"` // Extensions contains list of extensions to run on startup Extensions []string `json:"exts" mapstructure:"exts"` // ExtensionsArgs contains arguments for extensions ExtensionsArgs map[string]string `json:"extsargs" mapstructure:"extsargs"` // Validator indicates whether to run the node in validator mode Validator bool `json:"validator" mapstructure:"validator"` // IgnoreSeeds will prevent seed address from being used IgnoreSeeds bool `json:"ignoreSeeds" mapstructure:"ignoreSeeds"` // Light indicates whether to run the node in light mode Light bool `json:"light" mapstructure:"light"` // LightNodePrimaryAddr is the light node's primary node address LightNodePrimaryAddr string `json:"primary" mapstructure:"primary"` // LightNodeWitnessAddrs is a list of witness addresses to pass to the light node LightNodeWitnessAddrs []string `json:"witaddress" mapstructure:"witaddress"` // LightMaxOpenConnections is the maximum number of open connections to the light node RPC proxy service LightMaxOpenConnections int `json:"maxopenconns" mapstructure:"maxopenconns"` // LightNodeTrustingPeriod is the time within which headers can be verified. // Should be significantly less than the unbonding period. LightNodeTrustingPeriod string `json:"period" mapstructure:"period"` // LightNodeTrustedHeaderHeight is the light node trusted header height LightNodeTrustedHeaderHeight int64 `json:"height" mapstructure:"height"` // LightNodeTrustedHeaderHash is the light node trusted header hash LightNodeTrustedHeaderHash string `json:"hash" mapstructure:"hash"` // LightNodeTrustLevel is the trust level to attain before a header is accepted. // Must be between 1/3 and 3/3. LightNodeTrustLevel string `json:"trustlevel" mapstructure:"trustlevel"` // LightNodeSequentialVerification allows the node to verify all headers sequentially // instead of skipping verification. LightNodeSequentialVerification bool `json:"sequential" mapstructure:"sequential"` }
NodeConfig represents node's configuration
type RPCConfig ¶
type RPCConfig struct { On bool `json:"on" mapstructure:"on"` User string `json:"user" mapstructure:"user"` Password string `json:"password" mapstructure:"password"` DisableAuth bool `json:"disableauth" mapstructure:"disableauth"` AuthPubMethod bool `json:"authpubmethod" mapstructure:"authpubmethod"` HTTPS bool `json:"https" mapstructure:"https"` TMRPCAddress string `json:"tmaddress" mapstructure:"tmaddress"` }
RPCConfig describes RPC config settings
type RemoteConfig ¶
type RemoteConfig struct { Address string `json:"address" mapstructure:"address"` Name string `json:"name" mapstructure:"name"` }
RemoteConfig describes repository manager config parameters
type RepoConfig ¶
type RepoConfig struct { // Track contains names of repositories to be tracked Track []string `json:"track" mapstructure:"track"` // Untrack contains the names of repositories to be untracked Untrack []string `json:"untrack" mapstructure:"untrack"` // UntrackAll indicates that all currently tracked repositories are to be untracked UntrackAll bool `json:"untrackall" mapstructure:"untrackall"` }
RepoConfig represents repo-related configuration
type RepoOwner ¶
type RepoOwner struct { Creator bool `json:"creator" mapstructure:"creator" msgpack:"creator"` JoinedAt uint64 `json:"joinedAt" mapstructure:"joinedAt" msgpack:"joinedAt"` Veto bool `json:"veto" mapstructure:"veto" msgpack:"veto"` }
RepoOwner describes an owner of a repository
type VersionInfo ¶
type VersionInfo struct { BuildVersion string `json:"buildVersion" mapstructure:"buildVersion"` BuildCommit string `json:"buildCommit" mapstructure:"buildCommit"` BuildDate string `json:"buildDate" mapstructure:"buildDate"` GoVersion string `json:"goVersion" mapstructure:"goVersion"` }
VersionInfo describes the clients components and runtime version information