Documentation ¶
Index ¶
- Constants
- func EmptyPool(mgr *ChainManager)
- func GenesisKeys() crypto.Keypair
- func GenesisTx() block.Tx
- func HandleTx(mgr *ChainManager, tx block.Tx) string
- func MakeBlock(mgr *ChainManager)
- func MakeBlockLoop(mgr *ChainManager, blocktime time.Duration)
- func MakeGenesisBlock() block.Block
- func ReadGenBlock() block.Block
- func ReadState()
- func ShowAccount(mgr *ChainManager, account string)
- func TxValid(mgr *ChainManager, tx block.Tx) bool
- func WriteGenBlock(block block.Block)
- func WriteState()
- type ChainManager
- func (mgr *ChainManager) AppendBlock(new_block block.Block)
- func (mgr *ChainManager) ApplyBlock(block block.Block)
- func (mgr *ChainManager) ApplyBlocks(blocks []block.Block)
- func (mgr *ChainManager) BlockHeight() int
- func (mgr *ChainManager) InitAccounts()
- func (mgr *ChainManager) IsTreasury(account block.Account) bool
- func (mgr *ChainManager) LastBlock() block.Block
- func (mgr *ChainManager) RandomAccount() string
- func (mgr *ChainManager) ReadChain() bool
- func (mgr *ChainManager) ResetBlocks()
- func (mgr *ChainManager) SetAccount(account string, balance int)
- func (mgr *ChainManager) WriteChain()
Constants ¶
View Source
const ChainStorageFile = "data/chain.json"
View Source
const GenblockStorageFile = "data/genesis.json"
View Source
const ( //Treasury_Address string = "P0614579c42f2" Treasury_Address string = "P2e2bfb58c9db" )
Variables ¶
This section is empty.
Functions ¶
func MakeBlock ¶
func MakeBlock(mgr *ChainManager)
function to create blocks, called periodically currently assumes we can create blocks at will and we don't sync
func MakeBlockLoop ¶
func MakeBlockLoop(mgr *ChainManager, blocktime time.Duration)
func MakeGenesisBlock ¶
func ReadGenBlock ¶
func ShowAccount ¶
func ShowAccount(mgr *ChainManager, account string)
func TxValid ¶
func TxValid(mgr *ChainManager, tx block.Tx) bool
valid cash transaction instead of needing to evluate bytecode like Bitcoin or Ethereum this is hardcoded cash transaction, no multisig, no timelocks * sufficient balance of sender (the sender has the cash, no credit as of now) * the sender is who he says he is (authorized access to funds) speed of evaluation should be way less than 1 msec TODO check nonce
func WriteGenBlock ¶
func WriteState ¶
func WriteState()
Types ¶
type ChainManager ¶
func CreateManager ¶
func CreateManager() ChainManager
func (*ChainManager) AppendBlock ¶
func (mgr *ChainManager) AppendBlock(new_block block.Block)
append block to chain of blocks
func (*ChainManager) ApplyBlock ¶
func (mgr *ChainManager) ApplyBlock(block block.Block)
apply block to the state
func (*ChainManager) ApplyBlocks ¶
func (mgr *ChainManager) ApplyBlocks(blocks []block.Block)
func (*ChainManager) BlockHeight ¶
func (mgr *ChainManager) BlockHeight() int
func (*ChainManager) IsTreasury ¶
func (mgr *ChainManager) IsTreasury(account block.Account) bool
func (*ChainManager) LastBlock ¶
func (mgr *ChainManager) LastBlock() block.Block
func (*ChainManager) RandomAccount ¶
func (mgr *ChainManager) RandomAccount() string
func (*ChainManager) SetAccount ¶
func (mgr *ChainManager) SetAccount(account string, balance int)
Click to show internal directories.
Click to hide internal directories.