Hello Everyone! We have released the ninth minor version of Libplanet, Version 0.9.
Libplanet is a common library that solves game implementation problems such as P2P communication and data synchronization when creating online multiplayer games that run on distributed P2P.
From this version, Libplanet will be distributed in several NuGet packages. This is because Libplanet’s externalities have expanded, making it too heavy to include some of the dependent libraries across all applications.
This piece introduces the new NuGet packages and addresses key major changes in Version 0.9.
A newly added Nuget package, Libplanet.RocksDBStore includes
RocksDBStore class, which is Lipblanet’s
IStore interface implemented as RocksDB backend. Through internal testing,
RocksDBStore has shown to be about 10 times faster to write, 2 times faster to read, and thanks to compression, takes 15% less storage space than
Despite the advantages mentioned above, it might be difficult to use
RocksDBStore on some platforms because the RocksDB native binary, written in C++, needs to be distributed together with an application.
RocksDBStore class is not distributed as a Libplanet package, but as a separate NuGet package called Libplanet.RocksDBStore.
DefaultStore is still available in the Libplanet package. And so when developing, you can first use
DefaultStore that’s easy to install and use
RocksDBStore only for testing and actual deployment. Or, for platforms that are difficult to provide RocksDB binaries, you can just go with the
For more information, see Applying RocksDB to Libplanet written by Seunghun Lee.
Receiving Blocks from Multiple Peers
Up to this version,
StartAsync() method of
Swarm<T> class requested and received all blocks from a single peer to catch up with blocks piled up on the network. But unfortunately, if there were many piles of blocks, it would take a long time to get them from just one peer.
And if you were unlucky, you might request blocks from a peer with a very slow connection which would take extra longer time. It also put a lot of pressure on the peer that’s sending the blocks and it was especially hard to ignore the burden for seed nodes that were set by default for deployed applications.
So starting with this version, block downloads are improved to be evenly distributed across multiple peers and even when there’s a slow peer among the senders, the downloading speed has been significantly reduced.
Signed App Protocol Version
Last year, Libplanet 0.3 added
appProtocolVersion parameter in the
Swarm<T() constructor. This allowed nodes with compatible protocols to communicate with each other and adequately handled nodes without compatible protocols according to the application.
Our team also took advantage of this feature and used it for software updates when encountering a higher version of the node. But with this use, we realized that a modulated software could be used to maliciously display high-version numbers (which have never been reported) and attack other nodes to attempt false software updates.
To avoid this, the application protocol version that used to be described as
System.Int32 is now changed to
AppProtocolVersion type, which includes multiple metadata such as signatures and signers. The app protocol version must be signed, and each node will individually determine which signer’s version of the app protocol it will trust using the
trustedAppProtocolVersionSigners parameter in the
This approach protects each node from unintended (modified) software updates, while also giving each node the freedom to choose a different application roadmap that is freely forked if desired.
Last year, Libplanet added a
ProtectedPrivateKey class to safely store
PrivateKey in Version 0.7. However, because
ProtectedPrivateKey deals with only one key, handling multiple keys required a separate implementation for the application to create a directory, set a file name, and write the file.
So from this version,
Web3KeyStore class, which physically preserves and manages keys, are now available, eliminating the need to implement these features separately. In addition to the
Web3KeyStore that preserves keys in Web3 Secret Storage Definition format, we have also introduced
IKeyStore Interface, which abstracts specific preservation methods (implementation details).
planet: CLI Utility
Swarm<T>() constructor has assumed a specific genesis block since last version and from this version, it signs the app protocol version. Because these values include the results of cryptographic algorithm, it is impossible for a human to randomly generate the value. However, since the development process does require a lot of filling up random values, it was definitely a hassle to call up Libplanet APIs from C# interactive shells or PowerShell to calculate the desired values.
To make this easier, we are deploying a CLI utility called
planet from this version. The
planet command contains multiple subcommands, and currently provides key storage management and app protocol version signing feature. In the future, features such as creating a random genesis block will be added. Please check the
planet --help command for detailed instructions.
planet command is distributed in a NuGet package called Libplanet.Tools, which can be installed on systems with .NET Core SDK using the following command:
dotnet tool install -g Libplanet.Tools
If the .NET Core SDK is not installed, you can also download and install the official binary uploaded on the Release Page. The official binary is available in three versions: Linux (x64), macOS (x64), and Windows (x64).
You can learn more about additional changes in our release notes.
If you’re interested, install and try it out! And as always, if you have any questions about the new release or Libplanet in general, please visit our Discord chatroom and let’s chat!