Documentation ¶
Index ¶
- Constants
- func CacheExistingDirectoryWithUniformPieceSize(dirpath string, piecesize uint64, registredname []byte) ([]byte, error)
- func CacheExistingFile(initialpath string, cachepath string) error
- func CheckMainblockTransactions(pointertxs *[]utility.Transaction, root utility.Hash) bool
- func CheckNameBytes(name []byte) bool
- func FindRelativePath(firstpath string, secondpath string) (string, error)
- func GetContentIdWithUniformPieceSize(contentfilepath string, piecesize uint64) ([]byte, error)
- func GetMainblockReward(i uint32) uint64
- func InitLocalhost(tmpAppPath string)
- type ContentDirInfo
- type ContentFileInfo
- type Mainblock
- type Maincore
- func (mn *Maincore) AddBlockChunck(bytes []byte)
- func (mn *Maincore) AddInMemoryBlock(mb *Mainblock)
- func (mn *Maincore) AddToAddressBalance(addr utility.Hash, amount uint64) error
- func (mn *Maincore) AddTransactionToTxsPool(tx *utility.Transaction, fee uint64, priority uint64)
- func (mn *Maincore) AutoCheckMainblocks() bool
- func (mn *Maincore) AutoCheckMainheaders() bool
- func (mn *Maincore) CheckHeaderChain(pointerheaders *[]Mainheader) bool
- func (mn *Maincore) CheckPropagatingMainheader(header *Mainheader, height uint32) bool
- func (mn *Maincore) CleanMainblocks()
- func (mn *Maincore) CleanMainstate()
- func (mn *Maincore) ConfirmBlocks()
- func (mn *Maincore) ConfirmMainblock(mb *Mainblock)
- func (mn *Maincore) GetAddressBalanceState(addr utility.Hash) (uint32, uint64)
- func (mn *Maincore) GetConfirmationLayer() uint32
- func (mn *Maincore) GetConfirmedMainblock(i int) *Mainblock
- func (mn *Maincore) GetConfirmedMainchainLength() uint32
- func (mn *Maincore) GetLastConfirmedMainblockTimestamp() int64
- func (mn *Maincore) GetLastMainheader() *Mainheader
- func (mn *Maincore) GetMainblock(i int) *Mainblock
- func (mn *Maincore) GetMainblockState(height uint32) uint32
- func (mn *Maincore) GetMainchainLength() uint32
- func (mn *Maincore) GetMainheader(i int) *Mainheader
- func (mn *Maincore) GetNameState(name []byte) uint32
- func (mn *Maincore) GetPath() string
- func (mn *Maincore) GetRegistredNameCommitState(name []byte) ([]byte, error)
- func (mn *Maincore) GetSerializedMainblockTransactions(requestedblockheight uint32) []byte
- func (mn *Maincore) GetSerializedMainchainLength() []byte
- func (mn *Maincore) GetSerializedMainheaders(first uint32, last uint32) []byte
- func (mn *Maincore) GetTargetBits() uint32
- func (mn *Maincore) GetTxOutputState(txhash utility.Hash, index uint32) uint32
- func (mn *Maincore) GetTxState(txhash utility.Hash) (uint32, uint32, uint32)
- func (mn *Maincore) LoadMaincore()
- func (mn *Maincore) LoadUnconfirmedBroadcastedTxs(wlt *wallet.Wallet)
- func (mn *Maincore) Lock()
- func (mn *Maincore) Mine(miningaddress utility.Hash) (bool, *Mainblock)
- func (mn *Maincore) PushRegistredNameCommit(name []byte, contentid []byte)
- func (mn *Maincore) PutAddressBalanceState(addr utility.Hash, amount uint64) error
- func (mn *Maincore) PutMainblockState(height uint32, state uint32) error
- func (mn *Maincore) PutNameState(name []byte, stateidentifier uint32) error
- func (mn *Maincore) PutPath(path string)
- func (mn *Maincore) PutRegistredNameCommitState(name []byte, contentid []byte) error
- func (mn *Maincore) PutTxOutputState(txhash utility.Hash, index uint32, stateidentifier uint32) error
- func (mn *Maincore) PutTxState(txhash utility.Hash, height uint32, number uint32) error
- func (mn *Maincore) RebuildMainstate()
- func (mn *Maincore) ServeContent(name string) error
- func (mn *Maincore) SubtractFromAddressBalance(addr utility.Hash, amount uint64) error
- func (mn *Maincore) SyncWallet(wlt *wallet.Wallet)
- func (mn *Maincore) UnloadMaincore()
- func (mn *Maincore) Unlock()
- func (mn *Maincore) UnserializeMainblockTransactions(bytes []byte) (*[]utility.Transaction, error)
- func (mn *Maincore) UnserializeMainheaders(bytes []byte) (*[]Mainheader, error)
- func (mn *Maincore) UpdateMainstate(tx utility.Transaction, blockheight uint32)
- func (mn *Maincore) ValidateMainblockTransactions(height uint32, pointertxs *[]utility.Transaction) bool
- func (mn *Maincore) ValidateNameRegistration(name []byte) error
- func (mn *Maincore) ValidatePropagatingMainblock(mb *Mainblock) bool
- func (mn *Maincore) ValidateTransaction(tx *utility.Transaction) (bool, uint64)
- func (mn *Maincore) ValidateTxIn(signinghash utility.Hash, tmptxin utility.TxIn) (uint64, error)
- func (mn *Maincore) ValidateTxOut(tmptxout utility.TxOut) (uint64, error)
- type Mainheader
- type TxsPool
- func (txsp *TxsPool) AddTransaction(tx *utility.Transaction, txfee uint64, priority uint64)
- func (txsp *TxsPool) DeleteTransaction(txhash *utility.Hash)
- func (txsp *TxsPool) DisplayTxs()
- func (txsp *TxsPool) GetHighestPriorityTxs(mainchainlength uint32) (*[]utility.Transaction, uint64)
- func (txsp *TxsPool) GetTransaction(txhash *utility.Hash) (utility.Transaction, bool)
- func (txsp *TxsPool) GetTransactionPriority(txhash *utility.Hash) uint64
- func (txsp *TxsPool) SetTxInclusionHeight(txhash *utility.Hash, inclusionheight uint32)
Constants ¶
View Source
const ( ContentTypeUniformPieceSize = 1 ContentDefaultUniformPieceSize = 1024 ContentCurrentVersion = 1 )
View Source
const ( GENESIS_BLOCK_REWARD uint64 = 50000000000000 // 50 000 000 globals * 1 000 000 BLOCK_TIME uint32 = 600 //in seconds// ten minutes DIFFICULTY_TUNING_INTERVAL uint32 = 2016 //about two weeks BLOCK_REWARD_TUNING_INTERVAL uint32 = 210000 //blocks //BLOCK_CONFIRMATION_INTERVAL uint32=100//6//blocks ENGAGEMENT_REWARD_FINALIZATION_INTERVAL uint32 = 144 //24*6//about one day BLOCK_MAX_SEIZE uint32 = 1024 * 1024 //1 MO BLOCKTRANSACTIONS_MAX_SEIZE uint32 = BLOCK_MAX_SEIZE - 200 OBSTRUCTED_MINING_TIME int64 = 60 * 600 //10 hours //ENGAGEMENT_PUBLICPOST_MAXSTAKE uint64 = 1000000000 TRACKING_ADDRESSES = true )
View Source
const ( StateKeyIdentifierTxOutput = 1 StateKeyIdentifierTx = 2 StateKeyIdentifierMainblock = 3 StateKeyIdentifierNameRegistration = 4 StateKeyIdentifierRegistredNameCommit = 5 StateKeyIdentifierAddressBalance = 7 )
View Source
const ( StateValueIdentifierNotFound = 0 StateValueIdentifierUnspentTxOutput = 1001 StateValueIdentifierSpentTxOutput = 1002 StateValueIdentifierTx = 2001 StateValueIdentifierValidMainblock = 3001 StateValueIdentifierInvalidMainblock = 3002 StateValueIdentifierActifNameRegistration = 4001 StateValueIdentifierInactifNameRegistration = 4002 StateValueIdentifierRegistredNameCommit = 5001 StateValueIdentifierAddressBalance = 7001 )
Variables ¶
This section is empty.
Functions ¶
func CacheExistingDirectoryWithUniformPieceSize ¶ added in v0.2.3
func CacheExistingFile ¶ added in v0.2.3
func CheckMainblockTransactions ¶
func CheckMainblockTransactions(pointertxs *[]utility.Transaction, root utility.Hash) bool
func CheckNameBytes ¶
func FindRelativePath ¶ added in v0.2.3
func GetContentIdWithUniformPieceSize ¶ added in v0.2.3
func GetMainblockReward ¶
func InitLocalhost ¶ added in v0.2.3
func InitLocalhost(tmpAppPath string)
func HandleContent(w http.ResponseWriter, r *http.Request) { contentfilepath:= filepath.Join("Cache","Content",filepath.FromSlash(r.URL.Path[1:]))////filepath.FromSlash() for win compatibility fmt.Printf("Content file path %s loading ... url %s \n",contentfilepath,r.URL.Path) //os.Exit(0) doc, err := template.ParseFiles(contentfilepath) if err != nil { fmt.Fprint(w, err.Error()) return } doc.Execute(w, nil) }
func newRouter() *mux.Router { r := mux.NewRouter() r.HandleFunc("/index.html", HandleContent) //r.HandleFunc("/requestfreecoins", createRequestFreeCoinsHandler).Methods("POST") //r.HandleFunc("/requestfreecoinscaptcha", createRequestFreeCoinsCaptchaHandler).Methods("POST") return r }
Types ¶
type ContentDirInfo ¶ added in v0.2.3
type ContentDirInfo struct { Version uint32 ContentSubDirPathArray []string ContentFileInfoArray []ContentFileInfo }
type ContentFileInfo ¶ added in v0.2.3
type Mainblock ¶
type Mainblock struct { Height uint32 Header Mainheader Transactions []utility.Transaction }
func GenesisBlock ¶
func GenesisBlock() *Mainblock
func NewMainblock ¶
func NewMainblock() *Mainblock
func UnserializeMainblock ¶
func (*Mainblock) ComputeHash ¶
func (mb *Mainblock) ComputeHash()
func (*Mainblock) ComputeRoot ¶
func (mb *Mainblock) ComputeRoot()
type Maincore ¶
type Maincore struct { MissingContentArray []ContentFileInfo // contains filtered or unexported fields }
func NewMaincore ¶
func NewMaincore() *Maincore
func (*Maincore) AddBlockChunck ¶
func (*Maincore) AddInMemoryBlock ¶
func (*Maincore) AddToAddressBalance ¶ added in v0.2.3
////////////////////////////
func (*Maincore) AddTransactionToTxsPool ¶
func (mn *Maincore) AddTransactionToTxsPool(tx *utility.Transaction, fee uint64, priority uint64)
func (*Maincore) AutoCheckMainblocks ¶
func (*Maincore) AutoCheckMainheaders ¶
func (*Maincore) CheckHeaderChain ¶
func (mn *Maincore) CheckHeaderChain(pointerheaders *[]Mainheader) bool
func (*Maincore) CheckPropagatingMainheader ¶
func (mn *Maincore) CheckPropagatingMainheader(header *Mainheader, height uint32) bool
func (*Maincore) CleanMainblocks ¶
func (mn *Maincore) CleanMainblocks()
func (*Maincore) CleanMainstate ¶
func (mn *Maincore) CleanMainstate()
func (*Maincore) ConfirmBlocks ¶
func (mn *Maincore) ConfirmBlocks()
func (*Maincore) ConfirmMainblock ¶
func (*Maincore) GetAddressBalanceState ¶ added in v0.2.3
func (*Maincore) GetConfirmationLayer ¶
func (*Maincore) GetConfirmedMainblock ¶
func (*Maincore) GetConfirmedMainchainLength ¶
func (*Maincore) GetLastConfirmedMainblockTimestamp ¶
func (*Maincore) GetLastMainheader ¶
func (mn *Maincore) GetLastMainheader() *Mainheader
func (*Maincore) GetMainblock ¶
func (*Maincore) GetMainblockState ¶
func (*Maincore) GetMainchainLength ¶
func (*Maincore) GetMainheader ¶
func (mn *Maincore) GetMainheader(i int) *Mainheader
func (*Maincore) GetNameState ¶
func (*Maincore) GetRegistredNameCommitState ¶ added in v0.2.3
func (*Maincore) GetSerializedMainblockTransactions ¶
func (*Maincore) GetSerializedMainchainLength ¶
func (*Maincore) GetSerializedMainheaders ¶
func (*Maincore) GetTargetBits ¶
func (*Maincore) GetTxOutputState ¶
func (*Maincore) GetTxState ¶
func (*Maincore) LoadMaincore ¶
func (mn *Maincore) LoadMaincore()
func (*Maincore) LoadUnconfirmedBroadcastedTxs ¶
func (*Maincore) PushRegistredNameCommit ¶ added in v0.2.3
func (*Maincore) PutAddressBalanceState ¶ added in v0.2.3
func (*Maincore) PutMainblockState ¶
////////////////////////////
func (*Maincore) PutNameState ¶
func (*Maincore) PutRegistredNameCommitState ¶ added in v0.2.3
func (*Maincore) PutTxOutputState ¶
func (*Maincore) PutTxState ¶
func (*Maincore) RebuildMainstate ¶
func (mn *Maincore) RebuildMainstate()
func (*Maincore) ServeContent ¶ added in v0.2.3
func (*Maincore) SubtractFromAddressBalance ¶ added in v0.2.3
func (*Maincore) SyncWallet ¶
func (*Maincore) UnloadMaincore ¶
func (mn *Maincore) UnloadMaincore()
func (*Maincore) UnserializeMainblockTransactions ¶
func (mn *Maincore) UnserializeMainblockTransactions(bytes []byte) (*[]utility.Transaction, error)
func (*Maincore) UnserializeMainheaders ¶
func (mn *Maincore) UnserializeMainheaders(bytes []byte) (*[]Mainheader, error)
func (*Maincore) UpdateMainstate ¶
func (mn *Maincore) UpdateMainstate(tx utility.Transaction, blockheight uint32)
func (*Maincore) ValidateMainblockTransactions ¶
func (mn *Maincore) ValidateMainblockTransactions(height uint32, pointertxs *[]utility.Transaction) bool
func (*Maincore) ValidateNameRegistration ¶
func (*Maincore) ValidatePropagatingMainblock ¶
func (*Maincore) ValidateTransaction ¶
func (mn *Maincore) ValidateTransaction(tx *utility.Transaction) (bool, uint64)
func (*Maincore) ValidateTxIn ¶
type Mainheader ¶
type Mainheader struct { Version int32 Prevblockhash utility.Hash Roothash utility.Hash Timestamp int64 Bits uint32 Nonce uint32 Hash utility.Hash }
func JSONUnserializeMainheader ¶
func JSONUnserializeMainheader(bytes []byte) (*Mainheader, error)
func UnserializeMainheader ¶
func UnserializeMainheader(bytes []byte) (*Mainheader, error)
func (*Mainheader) JSONSerialize ¶
func (mh *Mainheader) JSONSerialize() []byte
func (*Mainheader) Serialize ¶
func (mh *Mainheader) Serialize() []byte
type TxsPool ¶
type TxsPool struct {
// contains filtered or unexported fields
}
func NewTxsPool ¶
func NewTxsPool() *TxsPool
func (*TxsPool) AddTransaction ¶
func (txsp *TxsPool) AddTransaction(tx *utility.Transaction, txfee uint64, priority uint64)
func (*TxsPool) DeleteTransaction ¶
func (*TxsPool) DisplayTxs ¶
func (txsp *TxsPool) DisplayTxs()
func (*TxsPool) GetHighestPriorityTxs ¶
func (txsp *TxsPool) GetHighestPriorityTxs(mainchainlength uint32) (*[]utility.Transaction, uint64)
func (*TxsPool) GetTransaction ¶
func (*TxsPool) GetTransactionPriority ¶
Click to show internal directories.
Click to hide internal directories.