The wait is over – peaq is live.
The wait is over – peaq is live.
Read more

May 17, 2023

Introducing the peaq SDK | Launch dApps and DePINs with ease

peaq

Community

Introducing the peaq SDK | Launch dApps and DePINs with ease

What’s happening?

The first version of the peaq SDK (Software Development Kit) has been launched, making it easier for builders and founders to bring their project to peaq or create a new one from the ground up.

Why does this matter?

The SDK makes things simpler and faster for builders. From teams working on the peaq network itself to projects building on top of it, manufacturers looking to connect their devices off the shelf, and hobby-coders experimenting with peaq’s functions.

What does this mean for the community?

The SDK will speed up development time across the board, enabling projects building on peaq and migrating from other networks to move faster and bring more value to the ecosystem. This should speed up the rate at which projects can deploy on peaq, while attracting more projects to build on peaq.

The builder experience

More often than not, building a house out of LEGO takes a few hours of pure joy. Some tinkering with the parts, an excavation of that one tile that had to fall behind the sofa, and there we go, the last brick snaps into place with a satisfying click. Needless to say, building a real house to mimic the one made of LEGO would take a lot more time, and a ton more headache, and won’t be nearly as easy.

What does any of this have to do with the peaq Software Development Kit (SDK)? Well, it’s simple: With its release, founders and developers building on peaq as well as manufacturers bringing their devices to the network will find the experience to be a lot closer to building with LEGO. We are not promising an equally satisfying click, of course, but hey, at least you won’t have to dive under the sofa.

The building bricks for dApps and DePINs on peaq

Let’s take a step back and quickly get the uninitiated up to speed on what a software development kit is. As its name suggests, an SDK is a kit of tools meant to make it easier for projects to write software on a specific network or for a device. It usually includes a set of libraries — collections of pre-written code that anyone can use — as well as documentation and, often, code samples.

The above summarizes peaq SDK quite nicely, but there is an important note to get out of the way. First, let’s quickly go over an image you’ve likely seen in our other blogs — peaq ecosystem’s architecture, a bird’s eye view, if birds could look at a tech stack. Who knows, maybe, it’s not electric sheep that androids should have dreamt of? But we digressed.

A cross-section of the peaq ecosystem and its technological stack.

  

So here’s the thing: The upper layers here ^ , the ones that users interact with, like dApps, peaq console, peaq portal, are most often written in Javascript. Sure, there might be projects out there that prefer Python-based frameworks, but we most often see stuff in Javascript.

At the lower layers, where the magic happens behind the scenes, things are different. The peaq and krest networks are both built with the Substrate framework, where Rust is the work horse.

Sure, Substrate is an amazing framework for blockchain devs, and Rust is a powerful and versatile language. That said, it’s not Javascript, and those new to it may take some time to figure things out. 

When developing the peaq SDK, the goal was simple: To make it easy for those building in Javascript, the world’s most widespread coding language, to work with all the Rust-based stuff. Effectively, it’s a shortcut that saves you the time and effort needed to make sense of things and go through some of the essential first steps in just a few lines of code. 

This way, it enables anyone working pretty much on anything peaq-related to move faster, simplifying network migration for established projects, enabling new builders to build faster, and making it easier for device manufacturers to outfit their products with peaq IDs from the get-go. 

The one-two combo

This release version simplifies the first steps any builder would have to do to bring the dApp on peaq, whether part of an experienced crew or a lone enthusiast. Namely, connecting to the network and interacting with peaq IDs.

If you are a builder, you probably dived into the Docs entry for the SDK even before the LEGO part, but for everyone else — connecting to peaq normally takes installing several libraries and importing them into your code, which would enable it to interact with these networks. Normally, you’d have to do that separately, installing the libraries one by one, figuring out what exactly you need to import to your code, and how it all works. With peaq SDK, though, you just install and import the SDK itself, write a few lines of code creating its specific instance, and there you go, the connection with peaq is live.

With this instance up and running, you can also simplify another crucial step — creating a peaq ID, which is a machine’s self-sovereign ID on the peaq network. Doing so is, again, a matter of writing (or copy-pasting from the code samples) a few lines of code. To read a peaq ID, you’d just have to change a single word.

All of this ultimately helps a very wide range of builders, from a founder working on a DePIN or a manufacturer looking to outfit their devices with peaq IDs off the shelf to a hobbyist playing with the testnet. All of them can leverage the SDK to access some of peaq’s core functions without having to dive deep into the underlying tech stack. 

In other words, it’s all about making the process of building on peaq as easy as possible.

Features to come

Of course, this is not the limit. As a community-first project, peaq aspires to be as user-and developer-friendly as possible, to the point where we wouldn’t even have to distinguish between the two kinds of friendliness. 

So with that, here are a few features coming to the SDK with future updates:

  • Role-Based Access Control (RBAC). To use peaq’s RBAC function, which enables users to manage access to their devices based on assigned roles, such as driver and passenger for a vehicle, a builder would have to write some code in Rust. In a future version of the SDK, this will no longer be the case.
  • Asset Transfer. Transferring tokens from one wallet to another is a core feature for any blockchain, and peaq SDK will make it easier for builders to access.
  • peaq storage. To use peaq’s storage function, which enables builders to leverage decentralized platforms like the InterPlanetary File System for storing machine data for their dApps, developers would have to use the pallet in Rust. Future SDK releases will make it more accessible for Javascript-based dApps.
  • Smart Contracts Deployment. Smart contracts codify the business logic behind a dApp or a DePIN as executable computer code stored on-chain. As such, they are the lifeblood of any DeFi services and dApps, so making them easier to deploy on peaq is a must as the ecosystem expands.
  • On-chain Data Access. The future updates of the SDK will make it easier for builders to fetch data from the peaq blockchain for processing it within the dApp, resulting in faster development and better dApp performance.
  • AI Agent Integration. This SDK feature will help developers integrate Fetch.ai’s AI agents running on the blockchain. The agents running on the network could communicate with each other and help each other perform certain tasks, such as finding the optimal charging station or negotiating the price for sensor data. This feature will include cross-chain identity compatibility between Substrate (Polkadot) and Cosmos
  • Off-chain Data Access. Besides the IPFS, dApps may also need to fetch data from traditional databases like MongoDB, the world’s most popular no-SQL option. With future updates, dApps on peaq will be able to query off-chain databases through the SDK. 
  • Multiple Programming Language Support. Javascript may be the go-to language for most builders now, but we are planning to eventually add support for other popular languages as well, such as Python and Java.
  • NFTsMachine NFTs will be an important component of the peaq ecosystem, enabling fractionalized ownership over fleets of connected machines. With future updates, the SDK will enable builders to add NFT minting, management, and burning to their dApps on peaq with just a few lines of code. 

And there you have it — a set of functions meant to make building on peaq as easy as possible. We will make sure to keep the finger on the pulse with the feedback from the projects building on peaq and the community, so if there’s any other functions you’d like to see on this list, don’t be a stranger and let us know now.

Join the Economy of Things