Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateBlockchain(configFilePath, outputDir string, opts *BlockchainGenerationOpts) error
- func GenerateConfigFile(filepath string, opts *ConfigGenerationOpts) error
- type Authcoin
- type Binaries
- type Blockchain
- type BlockchainGenerationOpts
- type BootstrapPeer
- type Caddy
- type Condition
- type Config
- type ConfigGenerationOpts
- type Currency
- type Explorer
- type Faucet
- type Fraction
- type Frontend
- type FrontendExplorerType
- type Generation
- type Genesis
- type GlobPattern
- type Minting
- type Network
- type NetworkType
- type Output
- type Ports
- type Template
- type TemplateConfig
- type TemplateFrontendConfig
- type TemplateFrontendTypeConfig
- type TransactionPool
- type Transactions
- type UnlockHash
- type Version
Constants ¶
const ( MaxPoolSize uint = 2e7 TransactionSetSizeLimit uint = 250e3 TransactionSizeLimit uint = 16e3 ActualPoolSize = uint64(MaxPoolSize - TransactionSetSizeLimit) )
Variables ¶
var ( // ErrUnsupportedFileType is returned in case generation of a config is requested for // an unsupported file type ErrUnsupportedFileType = errors.New("file type not supported") )
Functions ¶
func GenerateBlockchain ¶
func GenerateBlockchain(configFilePath, outputDir string, opts *BlockchainGenerationOpts) error
GenerateBlockchain imports a config file and uses it to generate a blockchain
func GenerateConfigFile ¶
func GenerateConfigFile(filepath string, opts *ConfigGenerationOpts) error
GenerateConfigFile generates a blockchain config file
Types ¶
type Blockchain ¶
type Blockchain struct { Name string `json:"name" yaml:"name" validate:"required"` LongName string `json:"longName,omitempty" yaml:"longName,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` Repository string `json:"repository" yaml:"repository" validate:"required"` Currency *Currency `json:"currency" yaml:"currency" validate:"required"` Ports *Ports `json:"ports" yaml:"ports" validate:"required"` Binaries *Binaries `json:"binaries,omitempty" yaml:"binaries,omitempty"` Transactions *Transactions `json:"transactions,omitempty" yaml:"transactions,omitempty"` Networks map[string]*Network `json:"networks,omitempty" yaml:"networks,omitempty" validate:"gt=0,dive,required"` }
type BlockchainGenerationOpts ¶
type BlockchainGenerationOpts struct { FrontendExplorerType FrontendExplorerType FrontendFaucet bool }
type BootstrapPeer ¶
type BootstrapPeer struct {
modules.NetAddress
}
func (BootstrapPeer) MarshalText ¶
func (bp BootstrapPeer) MarshalText() ([]byte, error)
MarshalText will marshall JSON/YAML BootstrapPeer type
func (*BootstrapPeer) UnmarshalText ¶
func (bp *BootstrapPeer) UnmarshalText(text []byte) error
UnmarshalText will unMarshall JSON/YAML BootstrapPeer type
type Condition ¶
type Condition struct {
types.UnlockConditionProxy
}
func NewCondition ¶
func NewCondition(mc types.MarshalableUnlockCondition) Condition
func NewMultisigCondition ¶
func NewMultisigCondition(minSignatureCount uint64, uhs ...types.UnlockHash) Condition
func (Condition) MarshalJSON ¶
func (Condition) MarshalYAML ¶
MarshalYAML will marshal the condition type into our specific format
func (*Condition) UnmarshalJSON ¶
func (*Condition) UnmarshalYAML ¶
type Config ¶
type Config struct { Template Template `json:"template,omitempty" yaml:"template,omitempty"` Frontend *Frontend `json:"frontend,omitempty" yaml:"frontend,omitempty"` Generation *Generation `json:"generation,omitempty" yaml:"generation,omitempty"` Blockchain *Blockchain `json:"blockchain" yaml:"blockchain" validate:"required"` }
func BuildConfigStruct ¶
func BuildConfigStruct(filePath string, opts *ConfigGenerationOpts) *Config
BuildConfigStruct builds to default values in our config struct
func ImportAndValidateConfig ¶
ImportAndValidateConfig imports a config file and validates it
type ConfigGenerationOpts ¶
type Fraction ¶
type Fraction struct {
Denominator, Numerator int64
}
Fraction represents ratio.
func (Fraction) MarshalText ¶
MarshalText will marshall JSON/YAML fraction type
func (*Fraction) UnmarshalText ¶
UnmarshalText will unMarshall JSON/YAML fraction type
type FrontendExplorerType ¶
type FrontendExplorerType uint8
const ( FrontendExplorerTypeVueTypescript FrontendExplorerType = iota FrontendExplorerTypePlainJavascript FrontendExplorerTypeNone )
func (*FrontendExplorerType) FromString ¶
func (et *FrontendExplorerType) FromString(str string) error
func (FrontendExplorerType) String ¶
func (et FrontendExplorerType) String() string
type Generation ¶
type Generation struct { Ignore []GlobPattern `json:"ignore" yaml:"ignore" validate:"required"` DisableGoFormatting bool `json:"disableGoFormatting,omitempty" yaml:"disableGoFormatting,omitempty"` }
type Genesis ¶
type Genesis struct { CoinOutputs []Output `json:"coinOuputs" yaml:"coinOutputs" validate:"required"` BlockStakeOutputs []Output `json:"blockStakeOutputs" yaml:"blockStakeOutputs" validate:"required"` Minting *Condition `json:"minting,omitempty" yaml:"minting,omitempty"` Authcoin *Condition `json:"authcoin,omitempty" yaml:"authcoin,omitempty"` GenesisBlockTimestamp int64 `json:"genesisBlockTimestamp" yaml:"genesisBlockTimestamp" validate:"required"` }
type GlobPattern ¶
type GlobPattern struct {
// contains filtered or unexported fields
}
func (GlobPattern) MarshalText ¶
func (gp GlobPattern) MarshalText() ([]byte, error)
func (GlobPattern) Match ¶
func (gp GlobPattern) Match(str string) bool
func (*GlobPattern) UnmarshalText ¶
func (gp *GlobPattern) UnmarshalText(text []byte) error
type Minting ¶
type Minting struct { ConditionUpdate Version `json:"conditionUpdate" yaml:"conditionUpdate" validate:"required"` CoinCreation Version `json:"coinCreation" yaml:"coinCreation" validate:"required"` CoinDestruction *Version `json:"coinDestruction,omitempty" yaml:"coinDestruction,omitempty"` RequireMinerFees bool `json:"requireMinerFees,omitempty" yaml:"requireMinerFees,omitempty"` }
type Network ¶
type Network struct { NetworkType NetworkType `json:"networkType" yaml:"networkType" validate:"required"` Genesis *Genesis `json:"genesis" yaml:"genesis" validate:"required"` TransactionFeePool string `json:"transactionFeePool,omitempty" yaml:"transactionFeePool,omitempty"` BlockSizeLimit uint64 `json:"blockSizeLimit,omitempty" yaml:"blockSizeLimit,omitempty"` ArbitraryDataSizeLimit uint64 `json:"arbitraryDataSizeLimit,omitempty" yaml:"arbitraryDataSizeLimit,omitempty"` BlockCreatorFee string `json:"blockCreatorFee,omitempty" yaml:"blockCreatorFee,omitempty"` MinimumTransactionFee string `json:"minimumTransactionFee,omitempty" yaml:"minimumTransactionFee,omitempty"` BlockFrequency uint64 `json:"blockFrequency,omitempty" yaml:"blockFrequency,omitempty"` MaturityDelay uint64 `json:"maturityDelay,omitempty" yaml:"maturityDelay,omitempty"` MedianTimestampWindow uint64 `json:"medianTimestampWindow,omitempty" yaml:"medianTimestampWindow,omitempty"` TargetWindow uint64 `json:"targetWindow,omitempty" yaml:"targetWindow,omitempty"` MaxAdjustmentUp Fraction `json:"maxAdjustmentUp,omitempty" yaml:"maxAdjustmentUp,omitempty"` MaxAdjustmentDown Fraction `json:"maxAdjustmentDown,omitempty" yaml:"maxAdjustmentDown,omitempty"` FutureThreshold uint64 `json:"futureTreshold,omitempty" yaml:"futureTreshold,omitempty"` ExtremeFutureThreshold uint64 `json:"extremeFutureTreshold,omitempty" yaml:"extremeFutureTreshold,omitempty"` StakeModifierDelay uint64 `json:"stakeModifierDelay,omitempty" yaml:"stakeModifierDelay,omitempty"` BlockStakeAging uint64 `json:"blockStakeAging,omitempty" yaml:"blockStakeAging,omitempty"` TransactionPool TransactionPool `json:"transactionPool,omitempty" yaml:"transactionPool,omitempty"` BootstrapPeers []*BootstrapPeer `json:"bootstrapPeers" yaml:"bootstrapPeers" validate:"required"` }
type NetworkType ¶
type NetworkType int
NetworkType is the type of the network
const ( NetworkTypeStandard NetworkType = iota + 1 NetworkTypeTestnet NetworkTypeDevnet )
NetworkType start with 1 because 0 breaks tests and serialization
type TemplateConfig ¶
type TemplateConfig struct {
Frontend TemplateFrontendConfig `json:"frontend" validate:"required"`
}
type TemplateFrontendConfig ¶
type TemplateFrontendConfig struct { Explorer map[string]TemplateFrontendTypeConfig `json:"explorer" validate:"required"` Faucet map[string]TemplateFrontendTypeConfig `json:"Faucet" validate:"required"` }
type TransactionPool ¶
type Transactions ¶
type UnlockHash ¶
type UnlockHash struct {
types.UnlockHash
}
func (UnlockHash) MarshalText ¶
func (u UnlockHash) MarshalText() ([]byte, error)
MarshalText will marshall JSON/YAML UnlockHash type
func (*UnlockHash) UnmarshalText ¶
func (u *UnlockHash) UnmarshalText(text []byte) error
UnmarshalText will unMarshall JSON/YAML UnlockHash type