Extensions
Extensions are designed to allow developers to customize their Kwil network to fit their specific use case. Within the main Kwil implementation, there are exposed interfaces that can be implemented to customize the behavior of the node. Extensions are written in Go, and are compiled into the Kwil binary.
Developers must take care to ensure that extensions are implemented properly. There are certain guidelines and restrictions that must be followed when implementing an extension. These are outlined in each extension types page. Failure to do so may result in node instability, consensus issues, or other problems.
Types of Extensions
There are six types of extensions. Each extension has its own set of interfaces that must be implemented, as well as their own set of rules and restrictions that must be followed.
Authenticators
Authenticators allow custom cryptographic signatures for signing and verifying transactions. By implementing custom authenticators, developers can add support for new asymmetric signatures to their Kwil network. Any wallet with a corresponding authenticator can be used to deploy schemas, hold and transfer native gas tokens, or perform any other action that requires a signed transaction.
Kuneiform Precompiles
Kuneiform precompiles are custom libraries that are imported and called in Kuneiform schemas. By implementing precompiles, developers can add new Kuneiform functionality to their Kwil network. These functionalities are wide ranging, and can include anything from hashing algorithms to directly calling the active Postgres connection.
Resolutions
Resolutions are custom governance proposals that can be implemented in a Kwil network. Custom resolutions allow developers to build types of governance proposals that can be proposed and voted on by all stakeholders in the network. Implementations can specify the required voting threshold, the maximum duration of the proposal, and the subsequent state changes that will be applied if the proposal is approved.
Event Listeners
Event Listeners allow nodes to listen to external systems and automatically create and vote on resolutions. This is primarily used for syncing data from external event-driven systems, such as Ethereum. It can also be used to poll external APIs for data, as long as the exact data can eventually be agreed upon by the requisite threshold for the resolution to pass.
Hooks
Hooks are functions that are called at specific points in the Kwil node's lifecycle. By implementing hooks, developers can add custom functionality to their Kwil node. Hooks can be used to add network-level schemas, periodic tasks, custom logging, or other functionality that is not provided by the default Kwil implementation.
Coordinated Upgrades
Coordinates Upgrades allow users to make breaking changes to their network functionality without starting a new network. Typically, if a user modifies an extension, they are unable to run it on an existing network because their new node will fail to reach consensus with the existing nodes. Coordinated upgrades allow users to specify a block height at which the new extension will be activated, and the network will automatically upgrade to the new functionality at that block height.