Documentation ¶
Index ¶
- Constants
- Variables
- type Amendment
- type ApprovedClaim
- type Ballots
- type Block
- type CategoryVariable
- type CidLink
- type CitizenOfName
- type Claim
- type Claims
- type Cratos
- type Currency
- type Demos
- type Evidence
- type Expirable
- type IntegerVariable
- type IssuedBlock
- type JointWallet
- type MultiPartyDocument
- type Notary
- type Observable
- type ObservableList
- type Observer
- type OpenBallot
- type PersonalizedAdaptivePoW
- func (pow PersonalizedAdaptivePoW) DifficultyFor(user string) (uint, float64)
- func (pow PersonalizedAdaptivePoW) GetGlobalDifficulty(oldBlock Block) (globalDiff uint, prevTime []int64, issuerFrame []IssuedBlock)
- func (pow PersonalizedAdaptivePoW) GetIssuerFrame(block Block, issuerCount int) int
- func (pow PersonalizedAdaptivePoW) GetMedianAndCount(user string) (medianOfBlocksCount float64, nbPersonalBlocksInFrame float64, ...)
- func (pow PersonalizedAdaptivePoW) GetNbZerosAndRemainder() (int, int)
- func (pow PersonalizedAdaptivePoW) MaxGenTime() float64
- func (pow PersonalizedAdaptivePoW) MaxSpeed() float64
- func (pow PersonalizedAdaptivePoW) MinGenTime() float64
- func (pow PersonalizedAdaptivePoW) MinSpeed() float64
- func (pow PersonalizedAdaptivePoW) PartToSign() []byte
- type PubkeysOfRole
- type PublicAccount
- type PublicWallet
- type Roles
- type Rule
- type Signable
- type SignedStampedDoc
- type Tax
- type Transaction
- type UnitIntervalVariable
- type Value
- type Vars
- type VoteableVariable
- type Wallet
- type Wrapper
Constants ¶
View Source
const ( ProposeTax = "ProposeTax" ProposeTaxVar = "ProposeTaxVar" ProposeTaxRevenueTarget = "ProposeTaxRevenueTarget" ProposeTaxType = "ProposeTaxType" ProposeNewVariable = "ProposeNewVariable" ProposeCreateAccount = "ProposeCreateAccount" ProposeAccountPermission = "ProposeAccountPermission" ProposeNewRole = "ProposeNewRole" ProposeAddPermission = "ProposeAddPermission" )
Constitutional Proposition predicates
View Source
const ( GlobalTransactionTax = "GlobalTransactionTax" BytesTax = "BytesTax" )
Tax types
View Source
const ( UnitIntervalType = "UnitIntervalValue" CategoryType = "CategoryVariable" IntegerType = "IntegerVariable" )
Variable types
View Source
const ( VoteGrantClaim = "VoteGrantClaim" VoteRevokeClaim = "VoteRevokeClaim" VoteGrantPermissionToRole = "VoteGrantPermissionToRole" VoteRevokePermissionToRole = "VoteRevokePermissionToRole" VoteVariableValue = "VoteVariableValue" VoteAmendment = "VoteAmendment" )
View Source
const ( Citizen = "Citizen" CitizenshipOfficer = "CitizenshipOfficer" )
View Source
const ( DtDiffEval = 12 // window size (# of blocks) to compute pow difficulty PercentRot = 0.67 )
View Source
const ClaimExpiry = 1
Variables ¶
View Source
var AvailablePropose = []string{ ProposeTax, ProposeTaxVar, ProposeTaxRevenueTarget, ProposeTaxType, ProposeNewVariable, ProposeCreateAccount, ProposeAccountPermission, ProposeNewRole, ProposeAddPermission}
View Source
var AvailableRole = []string{ Citizen, CitizenshipOfficer, }
View Source
var AvailableTaxType = []string{GlobalTransactionTax, BytesTax}
View Source
var AvailableVariableTax = []string{UnitIntervalType, CategoryType, IntegerType}
View Source
var AvailableVotes = []string{ VoteGrantClaim, VoteRevokeClaim, VoteGrantPermissionToRole, VoteRevokePermissionToRole, VoteVariableValue, VoteAmendment, }
View Source
var InstallAmendment = map[string]func(predicate *Rule, cratos *Cratos){ ProposeTax: installTax, ProposeTaxVar: installTaxVar, ProposeTaxRevenueTarget: installTaxRevenueTarget, ProposeTaxType: installTaxType, ProposeNewVariable: installNewVariable, ProposeCreateAccount: installNewAccount, ProposeAccountPermission: installAccountPermission, ProposeNewRole: installNewRole, ProposeAddPermission: installAddPermission, }
Installation procedures
View Source
var VerifyPredicate = map[string]func(predicate *Rule, cratos *Cratos) bool{ ProposeTax: func(p *Rule, cratos *Cratos) bool { return true }, ProposeTaxVar: func(p *Rule, cratos *Cratos) bool { return true }, ProposeTaxRevenueTarget: func(p *Rule, cratos *Cratos) bool { return true }, ProposeTaxType: checkTaxType, ProposeNewVariable: checkNewVar, ProposeCreateAccount: func(p *Rule, cratos *Cratos) bool { return true }, ProposeAccountPermission: func(p *Rule, cratos *Cratos) bool { return true }, ProposeNewRole: func(p *Rule, cratos *Cratos) bool { return true }, ProposeAddPermission: func(p *Rule, cratos *Cratos) bool { return true }, }
Basic predicate integrity check
Functions ¶
This section is empty.
Types ¶
type Amendment ¶
type Amendment struct { Name string Predicates []Rule SignedStampedDoc }
func (Amendment) PartToSign ¶
type ApprovedClaim ¶
type ApprovedClaim struct { Claim Claim SignedStampedDoc }
func (ApprovedClaim) PartToSign ¶
func (approved ApprovedClaim) PartToSign() []byte
type Ballots ¶
type Ballots struct {
Vote []OpenBallot
}
type Block ¶
type Block struct { // header Index uint32 Previous CidLink `json:",omitempty"` Network string // data Demos CidLink Cratos CidLink Currency CidLink Notary CidLink `json:",omitempty"` Evidences []Evidence // validation SignedStampedDoc Difficulty CidLink Nonce string PoWHash string }
the hash is not part of the block itself as it is the ipfs cid
func (Block) IsHashValid ¶
func (block Block) IsHashValid(difficulty PersonalizedAdaptivePoW) bool
func (Block) PartToHash ¶
func (Block) PartToSign ¶
type CategoryVariable ¶
type CategoryVariable string
func ParseCategoryVar ¶
func ParseCategoryVar(s string) CategoryVariable
func (CategoryVariable) Description ¶
func (v CategoryVariable) Description() string
func (CategoryVariable) FloatValue ¶
func (v CategoryVariable) FloatValue() float64
func (CategoryVariable) IsLegal ¶
func (v CategoryVariable) IsLegal(s string) bool
type CitizenOfName ¶
type Claim ¶
type Claim struct { ChosenName string Role string SignedStampedDoc }
func (Claim) PartToSign ¶
type Claims ¶
type Claims struct {
Claim []ApprovedClaim
}
type Currency ¶
type Currency struct { Name string MonetaryMass uint64 UnitBase uint8 //Inflation float32 CitizenCount uint32 Dividend uint64 Wallets map[string]uint64 JointWallets map[string]uint64 PublicWallets map[string]uint64 }
func (Currency) SumAccounts ¶
type Demos ¶
type Demos struct { Population uint64 CitizensByName map[string]CitizenOfName PublicKeysByRole map[string][]string }
type IntegerVariable ¶
type IntegerVariable int64
func ParseIntegerVar ¶
func ParseIntegerVar(s string) IntegerVariable
func (IntegerVariable) Description ¶
func (v IntegerVariable) Description() string
func (IntegerVariable) FloatValue ¶
func (v IntegerVariable) FloatValue() float64
func (IntegerVariable) IsLegal ¶
func (v IntegerVariable) IsLegal(s string) bool
type IssuedBlock ¶
type JointWallet ¶
type MultiPartyDocument ¶
type MultiPartyDocument struct { Timestamp int64 // contains filtered or unexported fields }
Associate Public Keys to a crypted Pointer and a signature
type Notary ¶
type Notary struct {
Documents []MultiPartyDocument
}
type Observable ¶
Observer pattern
type ObservableList ¶
type ObservableList struct {
// contains filtered or unexported fields
}
func (*ObservableList) Deregister ¶
func (c *ObservableList) Deregister(o Observer)
func (*ObservableList) NotifyAll ¶
func (c *ObservableList) NotifyAll()
func (*ObservableList) Register ¶
func (c *ObservableList) Register(o Observer)
type OpenBallot ¶
type OpenBallot struct { Permission string VoteObject string VoteValue string SignedStampedDoc }
func (OpenBallot) PartToSign ¶
func (b OpenBallot) PartToSign() []byte
type PersonalizedAdaptivePoW ¶
type PersonalizedAdaptivePoW struct { AvgGenTime float64 // # of seconds between each blocks CommonDifficulty uint PreviousBlockTimes []int64 PersonalHandicap map[string]uint IssuersFrame []IssuedBlock }
func (PersonalizedAdaptivePoW) DifficultyFor ¶
func (pow PersonalizedAdaptivePoW) DifficultyFor(user string) (uint, float64)
func (PersonalizedAdaptivePoW) GetGlobalDifficulty ¶
func (pow PersonalizedAdaptivePoW) GetGlobalDifficulty(oldBlock Block) (globalDiff uint, prevTime []int64, issuerFrame []IssuedBlock)
func (PersonalizedAdaptivePoW) GetIssuerFrame ¶
func (pow PersonalizedAdaptivePoW) GetIssuerFrame(block Block, issuerCount int) int
func (PersonalizedAdaptivePoW) GetMedianAndCount ¶
func (PersonalizedAdaptivePoW) GetNbZerosAndRemainder ¶
func (pow PersonalizedAdaptivePoW) GetNbZerosAndRemainder() (int, int)
func (PersonalizedAdaptivePoW) MaxGenTime ¶
func (pow PersonalizedAdaptivePoW) MaxGenTime() float64
func (PersonalizedAdaptivePoW) MaxSpeed ¶
func (pow PersonalizedAdaptivePoW) MaxSpeed() float64
func (PersonalizedAdaptivePoW) MinGenTime ¶
func (pow PersonalizedAdaptivePoW) MinGenTime() float64
func (PersonalizedAdaptivePoW) MinSpeed ¶
func (pow PersonalizedAdaptivePoW) MinSpeed() float64
func (PersonalizedAdaptivePoW) PartToSign ¶
func (pow PersonalizedAdaptivePoW) PartToSign() []byte
type PubkeysOfRole ¶
type PubkeysOfRole struct { }
type PublicAccount ¶
type PublicWallet ¶
type SignedStampedDoc ¶
==== Signature related stuff ====
func (SignedStampedDoc) Details ¶
func (d SignedStampedDoc) Details() (pk string, sign []byte)
func (SignedStampedDoc) GetPublicKey ¶
func (d SignedStampedDoc) GetPublicKey() string
func (SignedStampedDoc) GetSignature ¶
func (d SignedStampedDoc) GetSignature() string
func (SignedStampedDoc) PartToSign ¶
func (d SignedStampedDoc) PartToSign() []byte
func (*SignedStampedDoc) Stamp ¶
func (d *SignedStampedDoc) Stamp(s SignedStampedDoc)
type Transaction ¶
type Transaction struct { SignedStampedDoc To string Amount uint64 }
func (Transaction) PartToSign ¶
func (t Transaction) PartToSign() []byte
type UnitIntervalVariable ¶
type UnitIntervalVariable float64
func ParseUnitIntervalVar ¶
func ParseUnitIntervalVar(s string) UnitIntervalVariable
func (UnitIntervalVariable) Description ¶
func (v UnitIntervalVariable) Description() string
func (UnitIntervalVariable) FloatValue ¶
func (v UnitIntervalVariable) FloatValue() float64
func (UnitIntervalVariable) IsLegal ¶
func (v UnitIntervalVariable) IsLegal(s string) bool
type VoteableVariable ¶
Click to show internal directories.
Click to hide internal directories.