Example ABCI Applications

Documentation of Cosmos dApps (ABCI calls) in Landslide Core

This repo contains the ABCI application calls.

  1. Sample App Names: There are two sample apps provided in the LandslideCore: KVStoreApplication and PersistentKVStoreApplication.

  2. App Functionality: The KVStoreApplication is a simple merkle key-value store that allows transactions of the form key=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.

  3. Additional Features: The PersistentKVStoreApplication wraps the KVStoreApplication 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 and powerN is a new voting power for the validator with pubkeyN (possibly a new one). To remove a validator from the validator set, set power to 0. There is no sybil protection against new validators joining.

  4. 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.

  1. Package Name: The package name is main.

  2. 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 the counter 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.

  1. 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 to landslideCoreVM.NewVM.

  • Calls rpcchainvm.Serve to serve the virtual machine and start the RPC server.

  1. 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 using rpcchainvm.Serve.

Last updated

©2023 Gaia Labs LTD