Zilliqa launches Rust SDK

Zilliqa has launched a new SDK that allows developers to build dApps using Rust.

Zilliqa launches Rust SDK

The Zilliqa technical team has launched a new Rust Software Development Kit (SDK) that allows developers to build decentralised applications (dApps) on the Zilliqa blockchain using the Rust programming language.

Version 0.2.0 of the zilliqa-rs SDK is officially live, offering several features that make it easy for Rust developers to build and interact with Scilla contracts using the native Zilliqa API.

The SDK comprises built-in libraries that allow developers to easily interact with the Zilliqa API from within their Rust application, encompassing everything from transferring ZIL between addresses to interacting with complex contracts.

The new Rust SDK brings more flexibility and accessibility to the developer experience on Zilliqa, expanding the options for building applications and opening up the network to more developers across the world.

It is important to note that this initial release of the Zilliqa Rust SDK is subject to future improvement and we welcome any feedback from the community regarding bugs and other issues with the toolset.

As with many other Rust packages, documentation for the Zilliqa Rust SDK is available on crates.io.

Zilliqa Rust SDK features

Version 0.2.0 of the Zilliqa Rust SDK supports a number of important features, including all JSON-RPC endpoints for the Zilliqa API.

This means Rust developers can build applications that interact with the testnet and devnet in addition to the Zilliqa mainnet, allowing them to test out their applications before deploying or interacting with contracts on the mainnet.

The SDK also streamlines a number of functions related to creating and signing blockchain transactions. The toolkit includes a TransactionBuilder, which significantly simplifies the process of composing transactions for publication on the network.

When it comes to interacting with contracts, the Zilliqa Rust SDK generates corresponding Rust code for Scilla contracts. All contract transitions generate corresponding Rust functions, there are certain functions that allow developers to read the current state of the contract, and the built-in deploy function makes it impossible to accidentally deploy a contract with the incorrect parameters.

All data types in Scilla, including complex types, are converted to Rust in a type-safe manner, meaning incorrect data types can’t be passed into a function where a different type is required. This makes the powerful type-checking features of Rust available to developers when building or interacting with Scilla contracts.

For a breakdown of the features available in the Zilliqa Rust SDK, read the release notes on GitHub.

Using the new Rust SDK for Zilliqa

Before you get started using zilliqa-rs in your Rust application, you will need to create a new binary project and add both zilliqa-rs and tokio as dependencies for your project.

In order to call the Zilliqa API from your application, you must first create an HTTP provider using the URL of the Zilliqa network you wish to interact with. A list of URLs for the Zilliqa mainnet and test networks can be found on the Zilliqa Developer Portal.

Now that you have added zilliqa-rs as a dependency and set up an HTTP provider for the Zilliqa API endpoint, you are able to interact directly with the blockchain using the features included in the Rust SDK.

From within your Rust application, you are now able to complete operations such as reading the balance of a wallet address, creating a new wallet, and sending ZIL from your wallet to another on the Zilliqa network.

More complex contracts are also supported. By defining a path to a contract saved as a Scilla file, the Rust SDK automatically generates corresponding functions for the transitions in the Scilla contract you have pointed to.

This allows you to first deploy a contract on the network before reading its state and calling its transitions to update the state of the contract, all directly from within your Rust application.

Read more on GitHub for a detailed guide on how to use the Zilliqa Rust SDK.