Deep Diving Into Blinks & Solana Actions

Deep Diving Into Blinks & Solana Actions

Introduction

The cryptocurrency space sometimes resembles a walled garden. Every exchange you use, every DeFi platform you like, every NFT marketplace you visit—they're all on their own little piece of the internet. They frequently need you to jump through hoops, navigate strange interfaces, and possibly compromise your security in order to interact with them. However, what if you could easily engage with everything related to cryptocurrencies right from the platforms you now use on a daily basis?

This is what Solana Blinks, a ground-breaking new feature for the Solana blockchain that attempts to close the divide between cryptocurrency and the internet at large, promises to do. Let's examine Blinks in more detail to see what they are, how they function, and why the cryptocurrency market could never be the same.

Solana Actions & Blinks

Solana Actions are specification-compliant APIs that return transactions on the Solana blockchain to be previewed, signed, and sent across a number of various contexts, including QR codes, buttons + widgets, and websites across the internet. Actions make it simple for developers to integrate the things you can do throughout the Solana ecosystem right into your environment, allowing you to perform blockchain transactions without needing to navigate away to a different app or webpage.

Blockchain links – or blinks – turn any Solana Action into a shareable, metadata-rich link. Blinks allow Action-aware clients (browser extension wallets, bots) to display additional capabilities for the user. On a website, a blink might immediately trigger a transaction preview in a wallet without going to a decentralized app; in Discord, a bot might expand the blink into an interactive set of buttons. This pushes the ability to interact on-chain to any web surface capable of displaying a URL.

Consider a scenario where a mere link could provide access to an array of encryption features. Blinks are basically shared links embedded with the ability to start different onchain transactions. Consider them as little portals linking Solana's decentralised universe with the outside world.

This is how it operates: "Solana Actions" are essentially APIs that specify particular on-chain transactions that developers can design. These actions could be anything from voting on a DAO proposal, purchasing an NFT, trading tokens, or even sending a cryptocurrency payment. Thus, blinks serve as an easy-to-use interface for these actions. They take an Action's intricate code and turn it into a straightforward, shareable link.

Solana Actions

The Solana Actions specification uses a set of standard APIs to deliver signable transactions (and eventually signable messages) from an application directly to a user. They are hosted at publicly accessible URLs and are therefore accessible by their URL for any client to interact with.

The Actions API consists of making simple GET and POST requests to an Action's URL endpoint and handling the responses that conform to the Actions interface.

  1. the GET request returns metadata that provides human-readable information to the client about what actions are available at this URL, and an optional list of related actions.

  2. the POST request returns a signable transaction or message that the client then prompts the user's wallet to sign and execute on the blockchain or in another off-chain service.

When receiving transactions from an Actions URL, clients should handle submission of these transactions to the blockchain and manage their state lifecycle.

Actions also support some level of invalidation before execution. The GET and POST request may return some metadata that states whether the action is capable of be taken (like with the disabled field).

For example, if there was an Action endpoint that facilitates voting on a DAO governance proposal whose voting window has closed, the initial GET request may return the error message "This proposal is no longer up for a vote" and the "Vote Yes" and "Vote No" buttons as "disabled".

Solana Blinks

Blinks (blockchain links) are client applications that introspect Action APIs and construct user interfaces around interacting with and executing Actions.

Client applications that support blinks simply detect Action-compatible URLs, parse them, and allow users to interact with them in standardized user interfaces.

A blink URL describes a client application that enables a user to complete the full lifecycle of executing an Action, including signing with their wallet.

https://example.domain/?action=<action_url>

For any client application to become a blink:

  • The blink URL must contain a query parameter of action whose value is a URL-encoded Action URL. This value must be URL-encoded to not conflict with any other protocol parameters.

  • The client application must URL-decode the action query parameter and introspect the Action API link provided (see Action URL scheme).

  • The client must render a rich user interface that enables a user to complete the full lifecycle of executing an Action, including signing with their wallet.

Practical Implementations

  • Social Media Swaps: Have you seen a friend gushing about a new DeFi token on Twitter? You might be able to easily exchange some of your possessions for it right there on the social networking network with a Blink. This encourages interacting with the cryptocurrency market in a more social and dynamic way.

  • In-App Purchases with Crypto: Just picture using a Blink to buy in-game goodies or exclusive content from your fave developer. This creates brand-new avenues for online communities and applications to be made profitable.

Get Started

To quickly get started with creating custom Solana Actions:

npm install @solana/actions
  • install the Solana Actions SDK in your application

  • build an API endpoint for the GET request that returns the metadata about your Action

  • create an API endpoint that accepts the POST request and returns the signable transaction for the user