Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address string
func ParseAddress ¶
func (Address) MarshalJSON ¶
func (*Address) UnmarshalJSON ¶
type Block ¶
type Block struct { Parent *cid.Cid // could use a hamt for these, really only need a set. a merkle patricia // trie (or radix trie, to be technically correct, thanks @wanderer) is // inefficient due to all the branch nodes // the important thing here is minizing the number of intermediate nodes // the simplest thing might just be to use a sorted list of cids for now. // A simple array can fit over 5000 cids in a single 256k block. //Txs *cid.Cid Txs []*Transaction // structure should probably mirror the transactions Receipts []*Receipt // Height is the chain height of this block Height uint64 // StateRoot should be a HAMT, its a very efficient KV store StateRoot *cid.Cid TickLimit *big.Int TicksUsed *big.Int }
func DecodeBlock ¶
type Signature ¶
Signature over a transaction, like how ethereum does it TODO: think about how the signature could be an object that wraps the base transaction. This might make content addressing a little bit simpler
type Transaction ¶
type Transaction struct { To Address // address of contract to invoke From Address Nonce uint64 TickCost *big.Int Ticks *big.Int Method string Params []interface{} Signature *Signature }
Transaction is the equivalent of an ethereum transaction. But since ethereum transactions arent really transactions, theyre more just sending information from A to B, I (along with wanderer) want to call it a message. At the same time, we want to rename gas to ticks, since what the hell is gas anyways? TODO: ensure that transactions are not malleable *at all*, this is very important
func (*Transaction) Cid ¶
func (tx *Transaction) Cid() (*cid.Cid, error)
TODO: we could control creation of transaction instances to guarantee this never errors. Pretty annoying to do though
func (*Transaction) Marshal ¶
func (tx *Transaction) Marshal() ([]byte, error)
func (*Transaction) Unmarshal ¶
func (tx *Transaction) Unmarshal(b []byte) error
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
func NewTransactionPool ¶
func NewTransactionPool() *TransactionPool
func (*TransactionPool) Add ¶
func (txp *TransactionPool) Add(tx *Transaction) error
func (*TransactionPool) ClearTx ¶
func (txp *TransactionPool) ClearTx(c *cid.Cid)
func (*TransactionPool) GetBestTxs ¶
func (txp *TransactionPool) GetBestTxs() []*Transaction