Launch kwil
Blog/
Kwil v0.7: Open-Source PostgreSQL Appchains
Announcements
August 7, 2024

Kwil v0.7: Open-Source PostgreSQL Appchains

Kwil Team
Share:

Open-source. Postgres. Appchains.

Today, we are excited to announce Kwil’s next major release: Kwil v0.7 – The Postgres Release. This release dramatically improves on the functionality released at the end of 2023, introducing Postgres as the core database engine and unveiling a significantly more sophisticated extension system that allows Kwil networks to interoperate with other wallets, run built-in network oracles, and add precompiles that enhance Kwil’s smart contract language.

Even more exciting, this release marks the first point in Kwil’s history that the entire repository is open-source. Going open-source has always been a critical milestone in building the Kwil ecosystem, and we are excited to open the whole codebase to the community.

Let’s dive into everything launching today.

PostgreSQL: The database your mother wants you to use

The most significant upgrade in Kwil v0.7 is the upgrade to PostgreSQL as the underlying database engine. Previously, each node used SQLite as its underlying database. Upgrading the database engine to Postgres dramatically expands the functionality, performance, and security of Kwil networks.

Upgrading the database engine to Postgres offers several key advantages:

  1. Support for long-running migrations: A commonly requested feature in Kwil is the ability to upgrade SQL smart contracts. SQLite’s rudimentary table-level locking significantly constrains network resources during the migration process. Postgres’s multi-version concurrency control allows Kwil to support long-running migrations with minimal impact on network liveness and throughput.
  2. Cross-database composability: Kwil datasets are composable—they allow developers to build on other datasets like Lego bricks. To enable composability, Kwil needs the ability to execute transactions across multiple user databases at once atomically. Using Postgres schemas, Kwil is able to support transactionality across user databases.
  3. Expanding SQL Smart Contracts: With Postgres’s procedural language (PL/pgSQL), we can expand the logic and functionality available in Kuneiform, Kwil’s smart contract language. This will vastly expand what is possible with SQL smart contracts, allowing developers to embed complex logic directly in their database.
  4. Stronger Typing: Postgres is strongly typed, which improves the safety and security for building deterministic applications. SQLite’s lack of strong typing poses a security risk to network determinism. Postgres’s strong typing mitigates these risks, making Kwil a stable platform for building a database appchain.

Kwil will leverage many of Postgres’s advantages—such as schema migrations and improved SQL smart contracts—in future releases. Upgrading to Postgres lays the foundation for Kwil to continue becoming the most performant, scalable, and flexible decentralized database.

Extensions: Yes, you can build that on Kwil

Last July, we released an initial version of Kwil extensions. After nearly five months of watching teams use extensions, we realized that extensions are more than just a way to customize database behavior—they are a design space for building highly customizable appchains.

With this release, we are excited to unveil four types of extensions:

  1. Kuneiform Precompiles: Allow users to write logic that will be called in Kuneiform, Kwil’s smart contract language.
  2. Authenticators: Allow users to customize the cryptographic signatures used to sign and verify transactions on the Kwil Network. This allows Kwil appchains to interoperate with any number of ecosystem wallets simultaneously.
  3. Event Listeners: Allow nodes to listen for and agree on events outside the Kwil network. This allows for Kwil networks to agree on data from other sources, such as other blockchains.
  4. Resolutions: Allow nodes to agree to execute a state change. For example, Kwil nodes can use an event listener to agree on a user’s token balance on another blockchain and then use a resolution to adjust the user’s balance within Kwil.

These four types of extensions significantly increase Kwil’s flexibility, allowing builders to customize the networks for their use case. Some examples of extension in action include:

  1. The Truflation Stream Network: The Truflation Stream Network uses Kuneiform Precompiles to calculate inflation data on its own decentralized appchain. Truflation stores each asset in a SQL smart contract and uses Kuneiform Precompiles to compose the smart contracts into higher level indices.
  2. The idOS Network: The idOS Network uses Authenticators to make its network interoperable with Ethereum and NEAR Protocol wallets. This means that users from either ecosystem can use the idOS with their preferred wallets.
  3. Intergalactic Network: The Intergalactic Network uses Event Listeners and Resolutions to listen for token deposits into a Solana smart contract and Resolutions to change the validator state. This allows Intergalactic to make their network PoS using SPL tokens.

The possibilities with extensions are endless.

Open Source

With this release, we are excited to announce that Kwil is open-source! Going open-source means anyone can contribute to the success of the Kwil project. Openness and transparency are a part of the blockchain and Web3 ethos, and we believe that being open-source is a core to fulfilling that ethos.

Check out the repository.

Next Steps

Kwil v0.7 is live and ready for use. You can start building with v0.7 using the quickstart and dive into any of the extension docs to learn about the new extension system.

Additionally, with the release of Kwil v0.7, there is a new Kwil testnet. Details for connecting to the testnet are found here. The Kwil v0.6 testnet will sunset in 30 days.

Let’s build.