Documentation ¶
Index ¶
- Constants
- Variables
- func CreateChildKey(masterKey *tools.Key, index uint32) (*tools.Key, error)
- func CreateFungibleTransaction(from string, to string, value float32) error
- func CreateGenesisTransaction()
- func CreateHDHierarchy(purpose, network, index, role, keyIndex string) string
- func CreateMasterKey(keySeed []byte) *tools.Key
- func CreateNewBlock(chainId string, lastHash []byte, lastBlockId uint32, version uint32) []byte
- func CreateSeedForKey() ([]byte, error)
- func Decode(input string, alphabet *Alphabet) ([]byte, error)
- func Encode(input []byte, alphabet *Alphabet) string
- func GetBalanceFromAddress(from string) float32
- func GetChildPubKey(childKey *tools.Key) *tools.Key
- func ValidateTXBeforeCreate(tx *Transaction) error
- func WriteGenesisToFile(data *Genesis)
- func WriteInBlockToFile(blockData []byte)
- type Account
- type Address
- type AddressManager
- type Alphabet
- type Ancestor
- type Block
- type BlockHeader
- type BlockQueue
- type BlocksParams
- type Coin
- type CoinCache
- type CoinCacheEntry
- type Coinbase
- type CoinbaseManager
- type Config
- type CurrencyConfig
- type DNAProcessor
- type DNARaw
- type DNATrainer
- type DOGEInfo
- type DnaTrainingData
- type DnaTrainingSet
- type Filter
- type Genesis
- type IAddress
- type IBlock
- type ICoinbase
- type ICoins
- type IDna
- type IOrganism
- type IState
- type ITransaction
- type IValidator
- type IWizechain
- type Inputs
- type Organism
- type Outpoint
- type Outputs
- type POSParams
- type State
- type Trainer
- type Transaction
- type Validator
- type Validators
- type WalletInterface
- type Wizechain
Constants ¶
View Source
const ( CoinFlagDirty = 0 CoinFlagFresh = 1 )
View Source
const ( HDPurpose = "48" HDNetwork = "Wizechain" )
View Source
const DOGE_TESTNET_API_KEY = "571b-3bd9-8808-a3bd"
View Source
const TEST_API_BALANCE_URL = "https://block.io/api/v2/get_address_balance/?api_key=" + DOGE_TESTNET_API_KEY + "&labels=testwize"
View Source
const TEST_API_EST_NETFEE = "https://block.io/api/v2/get_network_fee_estimate/?api_key=" + DOGE_TESTNET_API_KEY
View Source
const TICKER_URL = "https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=usd"
Variables ¶
View Source
var ( CoinsDefaultCoinbase = false CoinsDefaultOutput = 0 CoinsDefaultHeight = uint32(0) CoinsDefaultVersion = 0 )
View Source
var ( AddrPrefixWallet = [2]byte{0x77, 0x32} AddrPrefixTX = [2]byte{0x74, 0x31} AddrPrefixBlock = [2]byte{0x62, 0x31} AddrPrefixContent = [2]byte{0x63, 0x63} )
View Source
var ( BitcoinAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") IPFSAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") FlickrAlphabet = NewAlphabet("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ") RippleAlphabet = NewAlphabet("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz") WizegeneAlphabet = NewAlphabet("wWzZiIbcdeghjklmnopqQrstuxy123456789ABCDEGHKLMOPRSTUVXYaFf") )
Alphabet: copy from https://en.wikipedia.org/wiki/Base58
View Source
var CurrencySymbol4Byte = [4]byte{0x57, 0x49, 0x5a, 0x45}
View Source
var (
ErrorInvalidBase58String = errors.New("invalid base58 string")
)
Errors
View Source
var HDRoleActive = `0x1`
View Source
var HDRoleMemo = `0x3`
View Source
var HDRoleOwner = `0x0`
View Source
var HDRoleValidator = `0x4`
View Source
var HashFunc func(string) uint32 = func(s string) uint32 { var val uint32 = 1 for i := 0; i < len(s); i++ { val += (val * 37) + uint32(s[i]) } return val }
View Source
var LivePrefix4Byte = [4]byte{0x06, 0x41, 0x02, 0x01}
View Source
var LocalPrefix4Byte = [4]byte{0x06, 0x41, 0x02, 0x03}
View Source
var TestPrefix4Byte = [4]byte{0x06, 0x41, 0x02, 0x02}
Functions ¶
func CreateGenesisTransaction ¶
func CreateGenesisTransaction()
func CreateHDHierarchy ¶
func CreateMasterKey ¶
func CreateNewBlock ¶
func CreateSeedForKey ¶
func GetBalanceFromAddress ¶
func ValidateTXBeforeCreate ¶
func ValidateTXBeforeCreate(tx *Transaction) error
func WriteGenesisToFile ¶
func WriteGenesisToFile(data *Genesis)
func WriteInBlockToFile ¶
func WriteInBlockToFile(blockData []byte)
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func (*Address) SeedToMnemonic ¶
type AddressManager ¶
type AddressManager struct {
IAddress
}
var AM AddressManager
func (AddressManager) Create ¶
func (am AddressManager) Create(network [4]byte, prefix [2]byte) *Address
func (*AddressManager) NewAddressRing ¶
func (am *AddressManager) NewAddressRing(network [4]byte, prefix [2]byte) *Address
func (AddressManager) ToString ¶
func (am AddressManager) ToString() string
func (AddressManager) Validate ¶
func (am AddressManager) Validate() bool
type Alphabet ¶
type Alphabet struct {
// contains filtered or unexported fields
}
Alphabet The base58 alphabet object.
func NewAlphabet ¶
NewAlphabet create a custom alphabet from 58-length string. Note: len(rune(alphabet)) must be 58.
type Block ¶
type Block struct { Header *BlockHeader BlockVersion uint32 Tx []Transaction Payload []byte // are sidechain blocks RightBlocks []Block // are parent chain blocks may be null if not a sidechain LeftBlocks []Block Created int64 ElapsedSinceCreation uint64 // contains filtered or unexported fields }
func CreateRawBlock ¶
type BlockHeader ¶
type BlockQueue ¶
func NewBlockQueue ¶
func NewBlockQueue() *BlockQueue
func (*BlockQueue) Add ¶
func (q *BlockQueue) Add(block *Block)
func (*BlockQueue) GetTip ¶
func (q *BlockQueue) GetTip() interface{}
type BlocksParams ¶
type CoinCache ¶
type CoinCache struct { Entries map[uint32]CoinCacheEntry // contains filtered or unexported fields }
type CoinCacheEntry ¶
type CoinCacheEntry struct {
// contains filtered or unexported fields
}
type CoinbaseManager ¶
type CoinbaseManager struct { ICoinbase // contains filtered or unexported fields }
func NewCoinbase ¶
func NewCoinbase() *CoinbaseManager
func (*CoinbaseManager) CalcMaskSize ¶
func (cb *CoinbaseManager) CalcMaskSize()
func (*CoinbaseManager) SetCacheBackend ¶
func (cb *CoinbaseManager) SetCacheBackend()
type CurrencyConfig ¶
type DNAProcessor ¶
type DNAProcessor struct {
IDna
}
func NewProcessor ¶
func NewProcessor() *DNAProcessor
type DNATrainer ¶
type DOGEInfo ¶
func GetDogeBalance ¶
func GetDogeBalance() *DOGEInfo
type DnaTrainingData ¶
type DnaTrainingData struct {
// contains filtered or unexported fields
}
type DnaTrainingSet ¶
type DnaTrainingSet []DnaTrainingData
type Genesis ¶
type Genesis struct { GenesisTime int64 `json:"genesis_time"` ChainID string `json:"chain_id"` Balances map[string]float32 `json:"balances"` Currency *CurrencyConfig `json:"currency"` POS *POSParams `json:"pos_parameters"` BlockchainParams *BlocksParams `json:"blocks_parameters"` // contains filtered or unexported fields }
func CreateGenesisBlock ¶
func LoadGenesisFromJSON ¶
func LoadGenesisFromJSON() *Genesis
type ICoinbase ¶
type ICoinbase interface { Cleanup() ClearUnspendable() CalcMaskSize() Serialize() []byte UnSerialize() *Coin GetAddress() string GetUTXO(txID string) []Coin HaveUTXO(txID string) bool GetCoinBlock() *Block SetCacheBackend() AddCoin(outPoint int, coin Coin, possibleOverwrite bool) // contains filtered or unexported methods }
type ITransaction ¶
type ITransaction interface {
// contains filtered or unexported methods
}
type IValidator ¶
type IValidator interface { }
type IWizechain ¶
type Inputs ¶
type Inputs struct { From string `json:"from"` To string `json:"to"` Value float32 `json:"value"` Data string `json:"data"` }
func (*Inputs) IsStakingReward ¶
type State ¶
type State struct { Pk int `storm:"id,increment"` IsGenesisState bool Balances map[string]float32 IState // contains filtered or unexported fields }
func (*State) AddToMempool ¶
func (*State) CreateCache ¶
func (s *State) CreateCache()
func (*State) CreateGenesisState ¶
func (s *State) CreateGenesisState(db *storm.DB)
func (*State) GetCacheSize ¶
func (*State) GetDatabase ¶
func (s *State) GetDatabase() *storm.DB
type Trainer ¶
type Trainer struct {
DNATrainer
}
func NewTrainer ¶
func NewTrainer() *Trainer
func (*Trainer) GetTrainingSet ¶
type Transaction ¶
type Transaction struct { Pk int `storm:"id,increment"` ITransaction Inputs []*Inputs Outputs []*Outputs IsCoinbase bool IsStakingReward bool }
func GetGenesisTransaction ¶
func GetGenesisTransaction(db *storm.DB) (bool, []Transaction)
func (*Transaction) GetDatabase ¶
func (t *Transaction) GetDatabase() *storm.DB
type Validators ¶
type Validators []Validator
type WalletInterface ¶
type WalletInterface interface { }
type Wizechain ¶
type Wizechain struct { ID string Chaincode string Version string Blocks []*Block BlockHeaders []*BlockHeader MasterFingerPrint string MasterDNA string // contains filtered or unexported fields }
func NewWizeChain ¶
func (*Wizechain) CreateBlock ¶
func (w *Wizechain) CreateBlock()
func (*Wizechain) GetGenesis ¶
func (w *Wizechain) GetGenesis()
func (*Wizechain) GetNumBlocks ¶
func (*Wizechain) GetPreviousBlock ¶
func (*Wizechain) SetGenesis ¶
func (w *Wizechain) SetGenesis()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.