Blockchain in C#/.NET for on-chain, decentralized gaming
LGPL-2.1 License
Bot releases are hidden (Show)
Published by dahlia over 1 year ago
Released on March 6, 2023.
Published by dahlia over 1 year ago
Released on February 27, 2023.
Message.Content
property. [#2772, #2831]
Message
class are removed and moved to MessageContent
class. [#2772, #2831]
Message.Type
property.Message.DateField
property.Message.MessageType
enum.ITransport
interface and its implementations overhauled. [#2772, #2831]
ITransport.SendMessageAsync(BoundPeer, Message, TimeSpan?, CancellationToken)
method has changed to ITransport.SendMessageAsync(BoundPeer, MessageContent, TimeSpan?, int, bool, CancellationToken)
.ITransport.SendMessageAsync(BoundPeer, Message, TimeSpan?, CancellationToken)
method has changed to ITransport.SendMessageAsync(BoundPeer, MessageContent, TimeSpan?, int, bool, CancellationToken)
.ITransport.BroadcastMessage(IEnumerable<BoundPeer>, Message)
method has changed to ITransport.BroadcastMessage(IEnumerable<BoundPeer>, MessageContent)
.ITransport.ReplyMessageAsync(Message, CancellationToken)
method has changed to ITransport.ReplyMessageAsync(MessageContent, byte[], CancellationToken)
.InvalidMessageException
class. Instead, added InvalidMessageContentException
class. [#2772, #2831]
MessageContent
class. [#2772, #2831]
PingMsg
) became to inherit MessageContent
(were Message
).IBlockPolicy
is no longer enforced for genesis Block<T>
s. [#2845]
Published by dahlia over 5 years ago
Released on May 31, 2019.
IAction.Render(IActionContext, IAccountStateDelta)
method. [#31, #212]IAction.Unrender(IActionContext, IAccountStateDelta)
method. [#31, #212]BlockChain<T>.Validate()
method became to receiveIReadOnlyList<Block<<T>>
instead of IEnumerable<Block<T>>
. [#205]IBlockPolicy<T>.GetNextBlockDifficulty()
method became to receive IReadOnlyList<Block<<T>>
instead of IEnumerable<Block<T>>
. [#205]IBlockPolicy<T>.ValidateNextBlock(IReadOnlyList<Block<T>>, Block<T>)
method. [#210]IBlockPolicy<T>.ValidateBlocks()
method. [#210]BlockChain<T>[int]
became to throw ArgumentOutOfRangeException
instead of IndexOutOfRangeException
. [#210]KeyEquals()
methods from all classes and structs. [#216]Swarm
class now does not implement IEquatable<Swarm>
anymore and its Equals(object)
method and GetHashCode()
method became to have default behavior of object
class. [#216]Swarm
class now does not implement IDisposable
too. Thus Swarm.Dispose()
was removed too. [#218]Swarm
became to use a queue to maintain internal messages. [#218]
async
, so they are renamed as below.
Swarm.BroadcastBlocksAsync()
→ Swarm.BroadcastBlocks()
Swarm.BroadcastTxsAsync()
→ Swarm.BroadcastTxs()
Block<T>.Difficulty
is changed to long
instead of int
, and related classes method parameters and field types have changed accordingly.HashDigest.HasLeadingZeroBits()
method. [#213]IStore.PutBlock<T>(Block<T>)
method was changed to PutBlock<T>(Block<T>, Address)
. [[#189], #197]Block<T>.Hash
is no longer calculated using the full data of the Transaction<T>
, but is calculated using only the Transaction<T>.Id
. [#234]IStore.LookupStateReference<T>(string, Address, Block<T>)
method. [#232]IStore.StoreStateReference<T>(string, Block<T>)
method. [#232]IStore.ForkStateReferences<T>(string, string, Block<T>, IImmutableSet<Address>
method. [#232]Block<T>.Validate()
and Block<T>.EvaluateActions()
method. [#243]Transaction<T>.Nonce
and RawTransaction.Nonce
properties. [#246]IStore.GetTxNonce(string, Address)
method. [#246]IStore.IncreaseTxNonce<T>(string, Block<T>)
method. [#246]IStore.ForkTxNonce<T>(string, string, Block<T>, IImmutableSet<Address>
method. [#246]BlockChain<T>
became to implement IReadOnlyList<Block<T>>
. [#205]Swarm.DifferentVersionPeerEncountered
event handler that can handle events when a different version of a peer is discovered. [[#167]], [#185]Peer.AppProtocolVersion
property. [#185]Swarm.PreloadAsync()
method to explicitly and preemptively download initial blocks before Swarm.StartAsync<T>()
being called. [#204], [#206]BlockDownloadState
class to represent a block downloading state. [#204], [#206]BlockPolicyExtension.ValidateBlocks<T>(IBlockPolicy<T>, IReadOnlyList<Block<T>>, DateTimeOffset)
method. [#210]Transaction<T>.EvaluateActionsGradually(HashDigest<SHA256>, long, IAccountStateDelta, Address, bool)
method. [#31, #212]Block<T>.EvaluateActionsPerTx(AccountStateGetter)
method. [#31, #212]HashDigest.Satisfies()
method. [#213]BlockPolicy<T>
constructor became to receive the minimumDifficulty
and the mining difficultyBoundDivisor
. [#213]BlockChain<T>.UnstageTransactions()
method. [#223]Swarm
constructor became to receive a linger
(or millisecondsLinger
) parameter. This purposes to determine how long to wait for pending messages when a Swarm
instance is requested to terminate.NamespaceNotFoundException
class. [#232]Block<T>.Evaluate()
method. [#243]InvalidBlockTimestampException
class public
so that it can be caught. [#133, #251]InvalidTxNonceException
class. [#246]Swarm.StartAsync()
now receives the height of blocks (tip Index
) from other known peers and synchronizes the blocks if necessary before propagating/receiving pinpointed recent blocks to prevent inefficient round-trips. [#187, #190]BlockPolicy<T>.GetNextBlockDifficulty()
method was changed to the Ethereum Homestead algorithm except for the difficulty bomb. [#213]BlockSet<T>[int]
changed so as not to validate a block. [#231]Block<T>.Hash
and Transaction<T>.Id
. [#228, #234]Swarm.StartAsync()
now does not call Swarm.StopAsync()
anymore, therefore Swarm.StopAsync()
should be explicitly called. [#236]Transaction<T>.EvaluateActionsGradually()
became to record IAccountStateDelta.SetState()
calls even if its argument is the same to the previous state. [#241]Block<T>.Validate()
and Block<T>.EvaluateActions()
are integrated into Block<T>.Evaluate()
. [#243]BlockChain<T>.Append()
became to execute Action.Execute()
only once per action in the Block<T>
. [#243]BlockChain<T>.Append()
method became to throw InvalidTxNonceException
when the Transaction<T>.Nonce
does not correspond to its Signer
's current nonce. [#246]Swarm
became to enforce ForceDotNet.Force()
in AsyncIO while it's running on Mono runtime. [#247]Swarm
had attempted to use TURN relay even if the host
argument was given. [#198]BlockChain<T>.Append()
.BlockChain<T>
while blocks are being mined by BlockChain<T>.MineBlock()
. [#191]TurnClientException
had been thrown by Swarm when a STUN nonce is stale. [#193]BlockChain<T>.GetStates()
had descended to the bottom (i.e., the genesis block) where a given Address
refers to a nonexistent account (i.e., never used before). [[#189], #192]BlockChain<T>.Append()
method became to validate only the next block to be appended. [#210]BlockChain<T>.Fork()
performance by avoiding double validation of already validated blocks. [#215]BlockChain<T>.StageTransactions()
. [#217]BlockChain<T>.Append()
method by removing unnecessary race conditions. [#217]Swarm
could not properly communicate with Peer
behind NAT. [#240]BlockChain<T>.FindNextHashes()
throws ArgumentOutOfRangeException
when chain is empty.TurnClient.AcceptRelayedStreamAsync()
didn't handle concurrent connections correctly. [#256]Published by libplanet over 5 years ago
Published by libplanet over 5 years ago
Released on April 7, 2019.
This version purposes to entirely replace 0.2.0, because a wrong .nupkg file was uploaded to 0.2.0 on NuGet Gallery. Note that 0.2.0 on NuGet Gallery was unlisted.
Published by libplanet over 5 years ago
Released on April 5, 2019.
PrivateKey.Decrypt()
now throws an InvalidCiphertextException
instead of returning null
when cipherText
is invalid. [#140]
Transaction<T>
's Sender
–Recipient
model was replaced by Signer
–UpdatedAddresses
model. Unlike cryptocurrencies, transactions in games are not necessarily a transfer of assets, so it is difficult to determine what type of asset is transferred or who will receives the asset. A more useful perspective is, like what kind of transformation is performed, or what states are changed. To be close to this perspective, we decided to get rid of Transaction<T>.Recipient
(which is singular) and have Transaction<T>.UpdatedAddresses
(which is plural) instead. As there is no more asset to transfer, the term Sender
was also renamed to Signer
, which fits more to the new perspective. [#121]
Transaction<T>.Sender
, RawTransaction.Signer
, and IActionContext.From
properties to Signer
. The corresponding parameter names on constructors and methods were also renamed too.Transaction<T>.Make()
factory method is replaced by new Transaction<T>.Create()
factory method. The timestamp
parameter became optional, and the new optional updatedAddresses
parameter was added.IActionContext.To
property.Transaction<T>.Recipient
and RawTransaction.Recipient
properties were replaced by Transaction<T>.UpdatedAddresses
and RawTransaction.UpdatedAddresses
properties. The corresponding parameter names on constructors and methods were replaced too.RawTransaction
class was changed, the serialization format of transactions and blocks were also changed. It affects to the way to generate Transaction<T>.Signature
, Transaction<T>.Id
, and Block.Hash
values as well.InvalidTxUpdatedAddressesException
exception class.Block<T>.Validate()
method was gone so that the block validation API is always time-wise. Instead, Block<T>.Validate()
method now has only one overload: Validate(DateTimeOffset, AccountStateGetter)
returning IAccountStateDelta
.Block<T>.Validate()
and BlockChain<T>.Validate()
methods now can throw an InvalidTxUpdateAddressesException
.The Address
es IAction
tries to update no more need to be manually coded using IAction.RequestStates()
method. That method was removed at all, and updated Address
es became automatically determined (for the most cases) by track "dirties" on rehearsal mode. This mode dry-runs IAction
s with empty IActionContext.PreviousStates
. [#121]
AccountStateGetter
delegate to provide a read-only view to account states.IAccountStateDelta
interface to replace AddressStateMap
. The interface purposes to provide a read-write view to account states with maintaining UpdatedAddresses
(so-called "dirty"). [#98]
IActionContext.PreviousStates
property was changed from AddressStateMap
to IAccountStateDelta
.IActionContext.Rehearsal
property. [#131, #135]
UnexpectedlyTerminatedTxRehearsalException
class. [#132, #136]
IAction.Execute()
method was changed from AddressStateMap
to IAccountStateDelta
.IAction.RequestStates()
method because there is no need for it and thus it is not used anymore.Transaction<T>.EvaluateActions()
method.Block<T>.EvaluateActions()
generator method.The built-in subtype polymorphism of IAction
and Transaction<T>
was moved to a separated new PolymorphicAction<T>
abstract class. Polymorphic actions now should be wrapped by PolymorphicAction<T>
. For example, the following code:
public abstract class AbstractAction : IAction { ... }
[ActionType("attack")]
public sealed class Attack : AbstractAction { ... }
[ActionType("sleep")]
public sealed class Sleep : AbstractAction { ... }
var tx = Transaction<AbstractAction>.Create(
...,
actions: new[] { new Attack(...), ... }
);
should be changed to like:
var tx = Transaction<PolymorphicAction<AbstractAction>>.Create(
...,
actions: new[] {
new PolymorphicAction<AbstractAction>(new Attack(...)),
...
}
);
It can be simpler by implicit casting:
var tx = Transaction<PolymorphicAction<AbstractAction>>.Create(
...,
actions: new PolymorphicAction<AbstractAction>[] { new Attack(...), }
);
[#169]
T
of Transaction<T>
, Block<T>
, and BlockChain<T>
became to require having a public
parameterless constructor (i.e., new()
) besides implementing IAction
interface. This means an abstract class
or an interface
no more can be passed to T
, but only a concrete class
or a struct
can be passed.Fixed a bug that mutating a collection of IAction
s passed to constructors or factory methods of Transaction<T>
had affected made instances as well. The type of Transaction<T>.Actions
property was changed from IList<T>
to IImmutableList<T>
. The corresponding parameters on constructors and factory methods also were changed to take IEnumerable<T>
instead of IList<T>
.
InvalidTxException
and its subclasses became to have TxId
property and the corresponding constructor parameter. This can be useful when multiple Transaction<T>
objects are validated at once.
Added Address.Size
constant, which is fixed to the Int32
20.
Fixed a bug that Block<T>.Validate()
had not thrown InvalidTxException
even if there is any integrity error on its Transactions
.
Improved the write throughput of BlockChain<T>
while polling BlockChain<T>.GetStates()
Swarm.AddPeersAsync()
was fixed so that unreachable Peer
s are ignored. [#128]
Swarm
became able to relay their connection via TURN (RFC 5766) to NAT traversal. To enable this, its constructor (Swarm()
) takes the newly added IceServer
s as configuration.
Since we decided to depend on TURN (RFC 5766) and STUN (RFC 5389) to work around NAT so that Peer
's endpoints don't have to be multiple, Peer.Urls
was renamed to Peer.EndPoint
and its type also was changed from IImmutableList<Uri>
to DnsEndPoint
. [#120, #123 by Yang Chun Ung, #126, #127, #165, #166]
Swarm
became to ignore tip blocks of the same height (Index
) that it already has and deal with only longer (higher) blocks.
Fixed a bug that occured when Swarm
was handling multiple responses at the same time.
Fixed a bug that the Swarm
constructor had hanged in certain runtimes like Unity engine.
Removed AddressTransactionSet
which handles handle Address
to IEnumerable<TxId>
indices, and the following methods in IStore
:
IStore.IterateAddresses()
IStore.GetAddressTransactionIds()
IStore.AppendAddressTransactionId()
IStore.CountAddresses()
Added IStore.ListNamespaces()
method.
IStore.CountBlocks()
and IStore.CountTransactions()
became to return long
.
Block/tx-related methods in IStore
and BaseIndex<T>
no longer accepts @namespace
parameter. It means that even if a forking occurs, the same block/tx files are shared.
Fixed a bug that made unnecessary fork when receiving blocks from other peer.
Action classes that implement IAction
but lack ActionTypeAttribute
became reported by PolymorphicAction<T>
throwing MissingActionTypeException
at runtime. [#28, #144, #169]
Turn into parameter in BlockPolicy
's constructor to milliseconds. [#151]
BencodexFormatter
became able to serialize BigInteger
. [#159]
Made Swarm
possible to configure its network appProtocolVersion
and, to ignore peers if their version is different. [#167], [#170]
Renamed Block<T>.RewardBeneficiary
to Block<T>.Miner
. [#174]
Added BlockChain<T>.Blocks
property. [#176]
Added BlockChain<T>.Transactions
property. [#176]
Published by libplanet over 5 years ago
Released on March 5, 2019.
Swarm
and SwarmTest
.Published by libplanet over 5 years ago
Initial release. Released on February 26, 2019.