Class BlockChain<T>
Inheritance
BlockChain<T>
Assembly: Libplanet.dll
Syntax
public class BlockChain<T> : IReadOnlyList<Block<T>>, IReadOnlyCollection<Block<T>>, IEnumerable<Block<T>>, IEnumerable where T : IAction, new()
Type Parameters
Constructors
|
Improve this Doc
View Source
BlockChain(IBlockPolicy<T>, IStore)
Declaration
public BlockChain(IBlockPolicy<T> policy, IStore store)
Parameters
|
Improve this Doc
View Source
BlockChain(IBlockPolicy<T>, IStore, Guid)
Declaration
public BlockChain(IBlockPolicy<T> policy, IStore store, Guid id)
Parameters
Properties
|
Improve this Doc
View Source
Blocks
Declaration
public IDictionary<HashDigest<SHA256>, Block<T>> Blocks { get; }
Property Value
|
Improve this Doc
View Source
Id
Declaration
Property Value
|
Improve this Doc
View Source
Item[Int32]
Declaration
public Block<T> this[int index] { get; }
Parameters
| Type |
Name |
Description |
| Int32 |
index |
|
Property Value
| Type |
Description |
| Block<T> |
|
|
Improve this Doc
View Source
Item[Int64]
Declaration
public Block<T> this[long index] { get; }
Parameters
| Type |
Name |
Description |
| Int64 |
index |
|
Property Value
| Type |
Description |
| Block<T> |
|
|
Improve this Doc
View Source
Policy
Declaration
public IBlockPolicy<T> Policy { get; }
Property Value
|
Improve this Doc
View Source
Tip
Declaration
public Block<T> Tip { get; }
Property Value
| Type |
Description |
| Block<T> |
|
|
Improve this Doc
View Source
Transactions
Declaration
public IDictionary<TxId, Transaction<T>> Transactions { get; }
Property Value
Methods
|
Improve this Doc
View Source
Append(Block<T>)
Adds a block to the end of this chain.
Note that Render(IActionContext, IAccountStateDelta) methods of
all IAction objects that belong
to the block are called right after
the block is confirmed (and thus all states
reflect changes in the block).
Declaration
public void Append(Block<T> block)
Parameters
| Type |
Name |
Description |
| Block<T> |
block |
A next Block<T>, which is mined,
to add.
|
Exceptions
|
Improve this Doc
View Source
Append(Block<T>, DateTimeOffset)
Adds a block to the end of this chain.
Note that Render(IActionContext, IAccountStateDelta) methods of
all IAction objects that belong
to the block are called right after
the block is confirmed (and thus all states
reflect changes in the block).
Declaration
public void Append(Block<T> block, DateTimeOffset currentTime)
Parameters
Exceptions
|
Improve this Doc
View Source
Finalize()
Declaration
protected void Finalize()
|
Improve this Doc
View Source
GetEnumerator()
Declaration
public IEnumerator<Block<T>> GetEnumerator()
Returns
|
Improve this Doc
View Source
GetNonce(Address)
Declaration
public long GetNonce(Address address)
Parameters
| Type |
Name |
Description |
| Address |
address |
|
Returns
|
Improve this Doc
View Source
GetStates(IEnumerable<Address>, Nullable<HashDigest<SHA256>>)
Gets the state of the given addresses in the
BlockChain<T> from offset.
Declaration
public AddressStateMap GetStates(IEnumerable<Address> addresses, HashDigest<SHA256>? offset = default(HashDigest<SHA256>? ))
Parameters
Returns
|
Improve this Doc
View Source
MineBlock(Address)
Declaration
public Block<T> MineBlock(Address miner)
Parameters
| Type |
Name |
Description |
| Address |
miner |
|
Returns
| Type |
Description |
| Block<T> |
|
|
Improve this Doc
View Source
MineBlock(Address, DateTimeOffset)
Declaration
public Block<T> MineBlock(Address miner, DateTimeOffset currentTime)
Parameters
Returns
| Type |
Description |
| Block<T> |
|
|
Improve this Doc
View Source
StageTransactions(ISet<Transaction<T>>)
Adds transactions to the pending list so that
a next Block<T> to be mined contains these
transactions.
Declaration
public void StageTransactions(ISet<Transaction<T>> transactions)
Parameters
|
Improve this Doc
View Source
UnstageTransactions(ISet<Transaction<T>>)
Removes transactions from the pending list.
Declaration
public void UnstageTransactions(ISet<Transaction<T>> transactions)
Parameters
See Also
|
Improve this Doc
View Source
Validate(IReadOnlyList<Block<T>>, DateTimeOffset)
Declaration
public void Validate(IReadOnlyList<Block<T>> blocks, DateTimeOffset currentTime)
Parameters
Explicit Interface Implementations
|
Improve this Doc
View Source
IReadOnlyCollection<Block<T>>.Count
Declaration
int IReadOnlyCollection<Block<T>>.Count { get; }
Returns
|
Improve this Doc
View Source
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements