Landslide
Ask or search…
K

Functions

Documentation of functions in Landslide Core

Initialize the Avalanche Virtual Machine

Initialize
Context: An example usage of this function might be to initialize the Avalanche virtual machine before deploying a custom dApp on the Avalanche network.
Parameters: The function takes the following parameters:
  • context.Context: The context object for the operation.
  • *snow.Context: The context object for the Avalanche network.
  • manager.Manager: The manager object for the Avalanche database.
  • []byte: The Genesis bytes for the Avalanche network.
  • []byte: The Upgrade bytes for the Avalanche network.
  • []byte: The Config bytes for the Avalanche network.
  • chan<- common.Message: The channel used to send messages to the Avalanche engine.
  • []*common.Fx: A slice of the Fx objects used on the Avalanche network.
  • common.AppSender: The application sender object used on the Avalanche network.
Return Type: The function returns an error.
Functionality: This function initializes the Avalanche virtual machine by setting up various databases and stores, loading the genesis state, creating the proxy app and establishing connections to the ABCI app, creating the event bus, and initializing the transaction and block indexers. It returns an error if any of these operations fail.
NewVM
  1. 1.
    Function Name: The name of the function is NewVM.
  2. 2.
    Parameters: The function takes the following parameter:
  • abciTypes.Application: The application object used by the Avalanche network.
  1. 3.
    Return Type: The function returns a pointer to a VM struct.
  2. 4.
    Functionality: This function creates a new VM struct with the provided application object and returns a pointer to it. The VM struct represents the Avalanche virtual machine and is used to initialize and run dApps on the Avalanche network.
  3. 5.
    Example Usage: An example usage of this function might be to create a new VM object before calling the Initialize function to set up the virtual machine and deploy a custom dApp on the Avalanche network.
The abciTypes.Application interface is a key component of the Tendermint consensus engine used by the Avalanche virtual machine. It is used to allow the user to pass any ABCI application that follows this interface via Tendermint, which then works together with the virtual machine.
The ABCI (Application BlockChain Interface) is an interface between Tendermint and the application layer of the blockchain. It defines the methods and protocols for communication between the Tendermint consensus engine and the application layer, allowing the two layers to work together seamlessly.
The abciTypes.Application interface is implemented by the ABCI application layer of the blockchain. By implementing this interface, an application can be plugged into the Tendermint consensus engine, allowing it to interact with the blockchain at a low level.
When the NewVM function is called with an abciTypes.Application object as a parameter, it creates a new VM struct that includes a reference to the provided Application object. This Application object is then used by the Tendermint consensus engine to communicate with the application layer of the blockchain, allowing the two layers to work together in harmony.
Overall, the abciTypes.Application interface is a key component of the Tendermint consensus engine used by the Avalanche virtual machine, allowing developers to plug in any ABCI-compliant application and use it to build custom dApps on the Avalanche network.