Example ABCI Applications
Documentation of Cosmos dApps (ABCI calls) in Landslide Core
This repo contains the ABCI application calls.
Sample App Names: There are two sample apps provided in the LandslideCore:
KVStoreApplication
andPersistentKVStoreApplication
.App Functionality: The
KVStoreApplication
is a simple merkle key-value store that allows transactions of the formkey=value
to be stored as key-value pairs in the tree. Transactions without an=
sign set the value to the key. The app has no replay protection other than what the mempool provides.Additional Features: The
PersistentKVStoreApplication
wraps theKVStoreApplication
and provides two additional features: persistence of state across app restarts using Tendermint's ABCI-Handshake mechanism, and validator set changes. The state is persisted in leveldb along with the last block committed, and the Handshake allows any necessary blocks to be replayed. Validator set changes are effected using a specific transaction format:"val:pubkey1!power1,pubkey2!power2,pubkey3!power3"
. In this format,pubkeyN
is a base64-encoded 32-byte ed25519 key andpowerN
is a new voting power for the validator withpubkeyN
(possibly a new one). To remove a validator from the validator set, setpower
to 0. There is no sybil protection against new validators joining.Location: The sample apps can be found in the LandslideCore/abci/example/ directory of the Landslide SDK.
These sample apps provide developers with a starting point for building custom dApps on the Avalanche network using the Landslide SDK. Developers can use these sample apps as a reference for building their own merkle key-value store or for implementing more advanced features like persistence of state and validator set changes.
Package Name: The package name is
main
.Imported Packages: The following packages are imported:
context
: This package provides functions for working with contexts, which carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.fmt
: This package implements formatted I/O with functions analogous to C's printf and scanf.github.com/consideritdone/landslidecore/abci/example/counter
: This package contains the implementation for thecounter
application used by the Landslide SDK.github.com/consideritdone/landslidecore/vm
: This package contains the implementation for the virtual machine used by the Landslide SDK.github.com/ava-labs/avalanchego/utils/logging
: This package provides logging utilities for the AvalancheGo node.github.com/ava-labs/avalanchego/utils/ulimit
: This package provides utilities for managing file descriptor limits.github.com/ava-labs/avalanchego/vms/rpcchainvm
: This package provides the implementation for the RPC ChainVM.
Main Function: The
main
function is the entry point for the LandslideCore executable. It performs the following tasks:
Sets the file descriptor limit using
ulimit.Set
.Creates a new virtual machine using
landslideCoreVM.NewVM
.Passes the
counter.NewApplication
as a parameter tolandslideCoreVM.NewVM
.Calls
rpcchainvm.Serve
to serve the virtual machine and start the RPC server.
Example Usage: An example usage of this code might be to build and deploy a custom dApp, like an Osmosis outpost, or the Helix DEX on the Avalanche network using the Landslide SDK. The
counter.NewApplication
function can be replaced with a custom application implementation, and the resulting executable can be deployed on the network usingrpcchainvm.Serve
.
Last updated