core

package
v1.0.7-hotfix1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: GPL-3.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTokenAmount = "100000000000000000"
	//DefaultTokenDecimal              = 8
	DefaultChainID           = 1
	DefaultPledgeDailyReward = 288745000
	//DefaultPledgeDailyReward = 300000000
	//当 t = 2 时,即按批分红,且继续质押,且提取时,tx_size = 2644 b,当前单元大小为 5 m = 5120 kb =>1,982.934947049924
	//  即 t = 1时,tx_size = 1322 b unit =5120 kb,t = 3,872.919818456884
	DefaultPledgeAllocateThreshold = 1000
	//  当添加新质押地址 t = 2 时,tx_size = 1267 b,当前单元大小为 5 m = 5120 kb =>3,236.345679012346
	//  即 t = 1 时, tx_size = 633.5 b,当前单元大小为 5 m = 5120 kb =>8,088.467614533965
	DefaultPledgeRecordsThreshold = 2000
	// DefaultTxCoinYearRate            = 0
	DefaultRewardHeight              = 100
	DefaultGenerateUnitReward        = 15000
	DefaultDepositPeriod             = 0
	DefaultDepositAmountForMediator  = 50 * 100000000
	DefaultDepositAmountForJury      = 10 * 100000000
	DefaultDepositAmountForDeveloper = 1 * 100000000
	DefaultFoundationAddress         = "P1LA8TkEWxU6FcMzkyeSbf9b9FwZwxrYRuF"

	DefaultUccMemory      = 524288000  // 每个容器使用内存最大 = 524288000 = 500 M
	DefaultUccCpuShares   = 1024       // 每个容器相对占用CPU 1024 = 1 CPU
	DefaultUccCpuQuota    = 100000     //  每个容器最多使用CPU核数 = 1 CPU
	DefaultUccDisk        = 1073741824 //  每个容器磁盘使用量最多使用 = 1073741824 = 1G
	DefaultUccPrivileged  = false
	DefaultUccNetworkMode = "gptn-net" //TODO xiaozhi 生产环境
	//DefaultUccNetworkMode    = "host" //TODO xiaozhi 测试容器运行网络模式
	DefaultUccOOMKillDisable = false

	DefaultContainerDuringTime  = 0    //7天 = 604800 秒
	DefaultRmExpConFromSysParam = true //默认删除过期合约容器以系统参数 7 天为主

	DefaultTempUccMemory    = 1073741824
	DefaultTempUccCpuShares = 1024
	DefaultTempUccCpuQuota  = 200000

	DefaultTokenHolder = "P1Kp2hcLhGEP45Xgx7vmSrE37QXunJUd8gJ"

	DefaultMediator  = "P1nqukWkjFKk4UCUd2mdfV5VAgVuCApyXd"
	DefaultPublickey = "0236b88303d4c1986de09a2d1c292b16fd2b90fb89b5d2874705e4e17c4e648c26"

	DefaultNodeInfo = "pnode://4bdc1c533f6e3700a0a6cc346bf2364eace58a10d8a782762c8d2b27cf4d96c25827c82a15" +
		"684d348e88722b259f31abcccd4d0eaae0f52eeb85e1eb5342b862@127.0.0.1:30303"
	DefaultInitPubKey = "2SvBCoCHWA8Zg2Q8v2onmaTeZj6YmWLbp6mzoCZeDwiUcmuqFwd8fZXCfdmEhTodbWaSJ8T7MvjQiZkn4S9VTQnKDr" +
		"EkETt84Sr58vmjVdhdXNjjzqn8j6oHzvduxGo4UjWB66wd1GFXKoz5XD8hcPDzCyGVqZLjb7wu2pkJxeG1Mt3"

	DefaultJuryAddr = "P16bXzewsexHwhGYdt1c1qbzjBirCqDg8mN"

	DefaultMaxMediatorCount    = 1
	DefaultActiveMediatorCount = 5 //21
	DefaultMinMediatorCount    = 1 //21
	DefaultMinMediatorInterval = 1
	DefaultMinMaintSkipSlots   = 0

	//contract//contractId1:v1;contractId2:v2;contractId3:v3
	DefaultContractSystemVersion = "" /* 171-byte string literal not displayed */

	DefaultContractSignatureNum = 3
	DefaultContractElectionNum  = 4

	DefaultContractTxTimeoutUnitFee  = 10 //s
	DefaultContractTxSizeUnitFee     = 1  //byte
	DefaultContractTxInstallFeeLevel = 2.5
	DefaultContractTxDeployFeeLevel  = 1.5
	DefaultContractTxInvokeFeeLevel  = 1.0
	DefaultContractTxStopFeeLevel    = 0.5

	DefaultText = "姓名 丨 坐标 丨 简介   \r\n" +
		"孟岩丨北京丨通证派倡导者、CSDN副总裁、柏链道捷CEO.\r\n" +
		"刘百祥丨上海丨 GoC-lab发起人兼技术社群负责人,复旦大学计算机博士.\r\n" +
		"陈澄丨上海丨引力区开发者社区总理事,EOS超级节点负责人.\r\n" +
		"孙红景丨北京丨CTO、13年IT开发和管理经验.\r\n" +
		"kobegpfan丨北京丨世界500强企业技术总监.\r\n" +
		"余奎丨上海丨加密经济学研究员、产品研发经理.\r\n" +
		"Shangsong丨北京丨Fabric、 多链、 分片 、跨链技术.\r\n" +
		"郑广军丨上海丨区块链java应用开发.\r\n" +
		"钮祜禄虫丨北京丨大数据架构、Dapp开发.\r\n" +
		"彭敏丨四川丨计算机网络和系统集成十余年有经验.\r\n"

	DefaultRootCABytes = "-----BEGIN CERTIFICATE-----\n" +
		"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\n" +
		"B8H3cQht7g48a4RhUw==\n" +
		"-----END CERTIFICATE-----"

	/* percentage fields are fixed point with a denominator of 10,000 */
	PalletOne100Percent            = 10000
	PalletOne1Percent              = PalletOne100Percent / 100
	PalletOneIrreversibleThreshold = 70 * PalletOne1Percent

	DefaultMediatorInterval     = 2      //Devin: Don't change   /* seconds */
	DefaultMaintenanceInterval  = 60 * 5 // 60 * 60 * 24 // seconds, aka: 1 day
	DefaultMaintenanceSkipSlots = 0      //Devin: Don't change // 1 // number of slots to skip for maintenance interval

	DefaultMediatorCreateFee        = 50000
	DefaultAccountUpdateFee         = 1000000
	DefaultTransferPtnBaseFee       = 5000
	DefaultTransferPtnPricePerKByte = 30000
	DefaultContractInvokeFee        = 100000000

	DefaultUnitMaxSize = 5 * 1024 * 1024 //5M
)

Variables

View Source
var Suite = bn256.NewSuiteG2()

Functions

func CheckChainParameterValue added in v1.0.3

func CheckChainParameterValue(field, value string, icp *ImmutableChainParameters, cp *ChainParameters,
	fn GetMediatorCountFn) error

func CheckSysConfigArgType added in v1.0.3

func CheckSysConfigArgType(field, value string) error

func CreateInitDKS

func CreateInitDKS() (secStr, pubStr string)

author Albert·Gou

func DeriveSha

func DeriveSha(list DerivableList) common.Hash

func GenInitPair

func GenInitPair() (kyber.Scalar, kyber.Point)

func GetTrieInfo

func GetTrieInfo(list DerivableList) (*trie.Trie, common.Hash)

func PointToStr

func PointToStr(pub kyber.Point) string

author Albert·Gou

func ScalarToStr

func ScalarToStr(sec kyber.Scalar) string

author Albert·Gou

func StrToMedAdd

func StrToMedAdd(addStr string) (common.Address, error)

func StrToMedNode

func StrToMedNode(medNode string) (*discover.Node, error)

func StrToPoint

func StrToPoint(pubStr string) (kyber.Point, error)

func StrToScalar

func StrToScalar(secStr string) (kyber.Scalar, error)

Types

type ChainParameters

type ChainParameters struct {
	ChainParametersBase

	ChainParametersExtra
}

ChainParameters 区块链网络参数结构体的定义 变量名一定要大写,否则外部无法访问,导致无法进行json编码和解码

func NewChainParams

func NewChainParams() ChainParameters

func (*ChainParameters) DecodeRLP

func (cp *ChainParameters) DecodeRLP(s *rlp.Stream) error

func (*ChainParameters) EncodeRLP

func (cp *ChainParameters) EncodeRLP(w io.Writer) error

func (*ChainParameters) GetCPT added in v1.0.4

func (cp *ChainParameters) GetCPT() *ChainParametersTemp

type ChainParametersBase

type ChainParametersBase struct {
	GenerateUnitReward uint64 `json:"generate_unit_reward"` //每生产一个单元,奖励多少Dao的PTN
	PledgeDailyReward  uint64 `json:"pledge_daily_reward"`  //质押金的日奖励额
	RewardHeight       uint64 `json:"reward_height"`        //每多少高度进行一次奖励的派发
	UnitMaxSize        uint64 `json:"unit_max_size"`        //一个单元最大允许多大
	//TransactionMaxSize uint64 `json:"tx_max_size"`          //一个交易最大允许多大
	FoundationAddress string `json:"foundation_address"` //基金会地址,该地址具有一些特殊权限,比如发起参数修改的投票,发起罚没保证金等

	DepositAmountForMediator  uint64 `json:"deposit_amount_for_mediator"` //保证金的数量
	DepositAmountForJury      uint64 `json:"deposit_amount_for_jury"`
	DepositAmountForDeveloper uint64 `json:"deposit_amount_for_developer"`
	RmExpConFromSysParam      bool   `json:"remove_expired_container_from_system_parameter"`

	// 活跃mediator的数量。 number of active mediators
	ActiveMediatorCount uint8 `json:"active_mediator_count"`

	// 用户可投票mediator的最大数量。the maximum number of mediator users can vote for
	MaximumMediatorCount uint8 `json:"max_mediator_count"`

	// unit生产之间的间隔时间,以秒为单元。 interval in seconds between Units
	MediatorInterval uint8 `json:"mediator_interval"`

	// MaintenanceInterval 必须是 MediatorInterval的整数倍
	// 区块链维护事件之间的间隔,以秒为单元。 interval in sections between unit maintenance events
	MaintenanceInterval uint32 `json:"maintenance_interval"`

	// 在维护时跳过的MediatorInterval数量。 number of MediatorInterval to skip at maintenance time
	MaintenanceSkipSlots uint8 `json:"maintenance_skip_slots"`

	// 目前的操作交易费,current schedule of fees
	MediatorCreateFee        uint64 `json:"mediator_create_fee"` //no use, delete
	AccountUpdateFee         uint64 `json:"account_update_fee"`
	TransferPtnBaseFee       uint64 `json:"transfer_ptn_base_fee"`
	TransferPtnPricePerKByte uint64 `json:"transfer_ptn_price_per_KByte"` //APP_DATA
}

func NewChainParametersBase

func NewChainParametersBase() ChainParametersBase

type ChainParametersExtra added in v1.0.4

type ChainParametersExtra struct {
	ChainParametersExtra104alpha

	PledgeAllocateThreshold int `json:"pledge_allocate_threshold"`
	PledgeRecordsThreshold  int `json:"pledge_records_threshold"`
}

func NewChainParametersExtra added in v1.0.4

func NewChainParametersExtra() ChainParametersExtra

func (*ChainParametersExtra) GetCPT added in v1.0.4

type ChainParametersExtra104alpha added in v1.0.4

type ChainParametersExtra104alpha struct {

	//对启动用户合约容器的相关资源的限制
	UccMemory     int64 `json:"ucc_memory"`
	UccCpuShares  int64 `json:"ucc_cpu_shares"`
	UccCpuQuota   int64 `json:"ucc_cpu_quota"`
	UccDisk       int64 `json:"ucc_disk"`
	UccDuringTime int64 `json:"ucc_during_time"`

	//对中间容器的相关资源限制
	TempUccMemory    int64 `json:"temp_ucc_memory"`
	TempUccCpuShares int64 `json:"temp_ucc_cpu_shares"`
	TempUccCpuQuota  int64 `json:"temp_ucc_cpu_quota"`

	//contract about
	ContractSystemVersion string `json:"contract_system_version"`
	ContractSignatureNum  int    `json:"contract_signature_num"`
	ContractElectionNum   int    `json:"contract_election_num"`

	ContractTxTimeoutUnitFee  uint64  `json:"contract_tx_timeout_unit_fee"`
	ContractTxSizeUnitFee     uint64  `json:"contract_tx_size_unit_fee"` // price:  dao/byte
	ContractTxInstallFeeLevel float64 `json:"contract_tx_install_fee_level"`
	ContractTxDeployFeeLevel  float64 `json:"contract_tx_deploy_fee_level"`
	ContractTxInvokeFeeLevel  float64 `json:"contract_tx_invoke_fee_level"`
	ContractTxStopFeeLevel    float64 `json:"contract_tx_stop_fee_level"`
}

func NewChainParametersExtra104alpha added in v1.0.4

func NewChainParametersExtra104alpha() ChainParametersExtra104alpha

func (*ChainParametersExtra104alpha) GetCPT added in v1.0.4

type ChainParametersExtraTemp added in v1.0.4

type ChainParametersExtraTemp struct {
	ChainParametersExtraTemp104alpha

	PledgeAllocateThreshold string
	PledgeRecordsThreshold  string
}

func (*ChainParametersExtraTemp) GetCP added in v1.0.4

type ChainParametersExtraTemp104alpha added in v1.0.4

type ChainParametersExtraTemp104alpha struct {
	UccMemory string
	//UccMemorySwap string
	UccCpuShares string
	UccCpuQuota  string
	//UccCpuPeriod  string
	UccDisk       string
	UccDuringTime string

	TempUccMemory string
	//TempUccMemorySwap string
	TempUccCpuShares string
	TempUccCpuQuota  string

	ContractSystemVersion string
	ContractSignatureNum  string
	ContractElectionNum   string

	ContractTxTimeoutUnitFee  string
	ContractTxSizeUnitFee     string
	ContractTxInstallFeeLevel string
	ContractTxDeployFeeLevel  string
	ContractTxInvokeFeeLevel  string
	ContractTxStopFeeLevel    string
}

func (*ChainParametersExtraTemp104alpha) GetCP added in v1.0.4

type ChainParametersTemp added in v1.0.1

type ChainParametersTemp struct {
	ChainParametersBase

	ChainParametersExtraTemp
}

only for serialization(storage/p2p)

func (*ChainParametersTemp) GetCP added in v1.0.4

func (cpt *ChainParametersTemp) GetCP(cp *ChainParameters) error

type ConsensusEngine

type ConsensusEngine interface {
	Engine() int
	Stop()
	SubscribeCeEvent(chan<- ConsensusEvent) event.Subscription
}

type ConsensusEvent

type ConsensusEvent struct {
	Ce []byte
}

type DerivableList

type DerivableList interface {
	Len() int
	GetRlp(i int) []byte
}

type DigitalIdentityConfig

type DigitalIdentityConfig struct {
	RootCAHolder string `json:"rootCAHolder"` // ROOT CA的持有者
	RootCABytes  string `json:"rootCABytes"`  // ROOT CA证书内容
}

func DefaultDigitalIdentityConfig

func DefaultDigitalIdentityConfig() DigitalIdentityConfig

type Genesis

type Genesis struct {
	Version      string `json:"version"`
	GasToken     string `json:"gasToken"`
	TokenAmount  string `json:"tokenAmount"`
	PublicKey    string `json:"mediator_pubkey"`
	MediatorSign string `json:"mediator_sign"`
	//TokenAmount uint64 `json:"tokenAmount"`
	//TokenDecimal              uint32                   `json:"tokenDecimal"`
	//DecimalUnit               string                   `json:"decimal_unit"`
	ChainID     uint64 `json:"chainId"`
	TokenHolder string `json:"tokenHolder"`
	Text        string `json:"text"`
	//SystemConfig          SystemConfig             `json:"systemConfig"`
	DigitalIdentityConfig DigitalIdentityConfig    `json:"digitalIdentityConfig"`
	ParentUnitHash        common.Hash              `json:"parentUnitHash"`
	ParentUnitHeight      int64                    `json:"parentUnitHeight"`
	InitialParameters     ChainParameters          `json:"initialParameters"`
	ImmutableParameters   ImmutableChainParameters `json:"immutableChainParameters"`
	InitialTimestamp      int64                    `json:"initialTimestamp"`
	//InitialActiveMediators    uint16                   `json:"initialActiveMediators"`
	InitialMediatorCandidates []*InitialMediator `json:"initialMediatorCandidates"`
	SystemContracts           []SysContract      `json:"systemContracts"`
}

func (*Genesis) GetTokenAmount

func (g *Genesis) GetTokenAmount() uint64

type GetMediatorCountFn added in v1.0.2

type GetMediatorCountFn func() int

type ImmutableChainParameters

type ImmutableChainParameters struct {
	MinMaintSkipSlots    uint8    `json:"min_maint_skip_slots"`  // 最小区块链维护间隔
	MinimumMediatorCount uint8    `json:"min_mediator_count"`    // 最小活跃mediator数量
	MinMediatorInterval  uint8    `json:"min_mediator_interval"` // 最小的生产槽间隔时间
	UccPrivileged        bool     `json:"ucc_privileged"`        // 防止容器以root权限运行
	UccCapDrop           []string `json:"ucc_cap_drop"`          // 确保容器以最小权限运行
	UccNetworkMode       string   `json:"ucc_network_mode"`      // 容器运行网络模式
	UccOOMKillDisable    bool     `json:"ucc_oom_kill_disable"`  // 是否内存使用量超过上限时系统杀死进程
}

func NewImmutChainParams

func NewImmutChainParams() ImmutableChainParameters

type InitialMediator

type InitialMediator struct {
	*MediatorInfoBase
	JurorDepositExtraJson
}

genesis 文件定义的mediator结构体

func NewInitialMediator

func NewInitialMediator() *InitialMediator

func (*InitialMediator) Validate added in v1.0.3

type JurorDepositExtra added in v1.0.3

type JurorDepositExtra struct {
	PublicKey  []byte         `json:"public_key"`     // 账户地址对应的公钥
	RewardAddr common.Address `json:"reward_address"` // 奖励地址,用于奖励
}

juror保证金额外信息

type JurorDepositExtraJson added in v1.0.3

type JurorDepositExtraJson struct {
	PublicKey  string `json:"public_key"`     // 账户地址对应的公钥
	RewardAddr string `json:"reward_address"` // 奖励地址,用于奖励
}

juror保证金额外信息

func NewJurorDepositExtraJson added in v1.0.3

func NewJurorDepositExtraJson() JurorDepositExtraJson

func (*JurorDepositExtraJson) Validate added in v1.0.3

func (json *JurorDepositExtraJson) Validate(addStr string) (jde JurorDepositExtra, errs error)

type Mediator

mediator 结构体 和具体的账户模型有关

func NewMediator

func NewMediator() *Mediator

func (*Mediator) GetRewardAdd added in v1.0.2

func (med *Mediator) GetRewardAdd() common.Address

type MediatorApplyInfo

type MediatorApplyInfo struct {
	Name        string `json:"name"`      // 节点名称
	Location    string `json:"loc"`       // 节点所在地区
	Url         string `json:"url"`       // 节点宣传网站
	Description string `json:"applyInfo"` // 节点详细信息描述
}

Mediator申请信息

func NewMediatorApplyInfo

func NewMediatorApplyInfo() *MediatorApplyInfo

type MediatorBase added in v1.0.5

type MediatorBase struct {
	Address    common.Address `json:"address"`    // mediator账户地址,主要用于产块签名
	RewardAdd  common.Address `json:"rewardAdd"`  // mediator奖励地址,主要用于接收产块奖励
	InitPubKey kyber.Point    `json:"initPubKey"` // mediator的群签名初始公钥
	Node       *discover.Node `json:"node"`       // mediator节点网络信息,包括ip和端口等
}

func NeweMediatorBase added in v1.0.5

func NeweMediatorBase() MediatorBase

type MediatorInfoBase

type MediatorInfoBase struct {
	AddStr     string `json:"account"`    // mediator账户地址,主要用于产块签名
	RewardAdd  string `json:"rewardAdd"`  // mediator奖励地址,主要用于接收产块奖励
	InitPubKey string `json:"initPubKey"` // mediator的群签名初始公钥
	Node       string `json:"node"`       // mediator节点网络信息,包括ip和端口等
}

mediator基本信息

func NewMediatorInfoBase

func NewMediatorInfoBase() *MediatorInfoBase

func (*MediatorInfoBase) Validate

func (mib *MediatorInfoBase) Validate() (common.Address, error)

type MediatorInfoExpand

type MediatorInfoExpand struct {
	MediatorInfoExpand105alpha
	TotalProduct uint64 `json:"totalProduct"` // 当前mediator生产区块的总量
}

mediator扩展信息

func NewMediatorInfoExpand

func NewMediatorInfoExpand() *MediatorInfoExpand

type MediatorInfoExpand105alpha added in v1.0.5

type MediatorInfoExpand105alpha struct {
	TotalMissed          uint64 `json:"totalMissed"`          // 当前mediator未能按照调度生产区块的总个数
	LastConfirmedUnitNum uint32 `json:"lastConfirmedUnitNum"` // 当前mediator最新生产的区块编号
	TotalVotes           uint64 `json:"totalVotes"`           // 当前mediator的总共得票数量
}

func NewMediatorInfoExpand105alpha added in v1.0.5

func NewMediatorInfoExpand105alpha() *MediatorInfoExpand105alpha

type SysContract

type SysContract struct {
	Address common.Address `json:"address"`
	Name    string         `json:"name"`
	Active  bool           `json:"active"`
}

type UtxoInterface

type UtxoInterface interface {
	GetAmount() uint64
}

type Utxos

type Utxos []UtxoInterface

func Select_utxo_Greedy

func Select_utxo_Greedy(utxos Utxos, amount uint64) (Utxos, uint64, error)

func (Utxos) Len

func (c Utxos) Len() int

func (Utxos) Less

func (c Utxos) Less(i, j int) bool

func (Utxos) Swap

func (c Utxos) Swap(i, j int)

Directories

Path Synopsis
Package accounts implements high level PalletOne account management.
Package accounts implements high level PalletOne account management.
keystore
Package keystore implements encrypted storage of secp256k1 private keys.
Package keystore implements encrypted storage of secp256k1 private keys.
This file is part of go-palletone.
This file is part of go-palletone.
Package node sets up multi-protocol PalletOne nodes.
Package node sets up multi-protocol PalletOne nodes.
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.
vmContractPub
validatefie
/* This file is part of go-palletone.
/* This file is part of go-palletone.

Jump to

Keyboard shortcuts

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