Intro to Solana Blinks: Enhancing User Interaction with Solana Actions
Welcome, developers! In today's article, we'll explore an innovative feature of the Solana blockchain ecosystem known as Solana Blinks.
Solana Labs in collaboration with Dialect hit a breakthrough with the newly introduced Solana Actions and Blinks. Actions and Blinks revolutionize the way we interact with the Solana blockchain and greatly progresses the integration of the Web3 ecosystem.
Blinks are client applications that leverage Solana Actions APIs to create seamless, standardized user interfaces for interacting with blockchain transactions directly from web browsers, dApps, and other platforms even Twitter posts or your WhatsApp chats.
Solana Blinks serve as bridges between users and Solana Actions, enabling streamlined execution of blockchain transactions without the need to navigate away to different applications or pages. They detect Action-compatible URLs, parse them, and provide rich, intuitive interfaces for users to interact with and sign transactions using their blockchain wallets.
Before we delve into Blinks, let's first understand Solana Actions.
Understanding Solana Actions
Solana Actions are specification-compliant APIs that facilitate the preview, signing, and execution of transactions on the Solana blockchain. These APIs allow developers to integrate blockchain transaction capabilities into their applications, enabling users to interact with decentralized finance (DeFi) protocols, NFT marketplaces, and other blockchain-based services without leaving their current environment.
Solana Actions utilize a set of standard APIs accessible via publicly hosted URLs. These APIs primarily support two types of HTTP requests:
GET Requests: Fetch metadata about available Actions at a given URL, providing human-readable information such as application titles, icons, and lists of related actions.
POST Requests: Retrieve signable transactions or messages from the Action's API URL. This allows connected client applications to prompt users to sign transactions directly with their blockchain wallets, facilitating seamless interaction with the Solana blockchain.
Developers integrate Solana Actions by hosting APIs that conform to the Actions specification. Clients, such as web browsers, mobile wallets, or chat bots, interact with these APIs to offer users intuitive interfaces for executing blockchain transactions. This approach enhances user experience by eliminating the need for users to navigate across multiple apps or pages to complete transactions.
You can build your own custom Solana action by installing the Solana Actions SDK (npm install @solana/actions
) in your application (provided its REST API compliant), and following the steps and specifications mentioned here. This is a great tutorial in building Solana actions by the Solana foundation.
You can easily register your action here (Dialect's action registry) to make the unfurling of your Blink possible.
Introduction to Blinks
Now that we have a grasp of Solana Actions, let's explore how Solana Blinks build upon this foundation to further streamline and enhance user interactions with blockchain transactions. Solana Blinks serve as specialized client applications that introspect Solana Actions APIs and construct user interfaces around executing Actions. They detect Action-compatible URLs, parse them, and provide users with standardized interfaces for seamlessly interacting with and signing transactions directly from supported platforms.
How Blinks Work
Solana Blinks extends the functionality of Solana Actions by providing a user-friendly interface layer that simplifies the process of interacting with blockchain transactions. Here’s how Blinks operate:
Action Detection: Blinks detect Action-compatible URLs embedded within their environment, such as in web pages, social media posts, or chatbot interactions.
URL Parsing: When a Blink detects an Action-compatible URL (e.g.,
solana-action:
https://actions.alice.com/donate
), it decodes the URL to extract the Action's API link (based on the specification here).User Interface Construction: Using the extracted API link, the Blink (action client as shown in the diagram below) constructs a rich user interface (UI) that guides the user through the transaction process. This UI typically includes options for the user to review transaction details, confirm actions (e.g., "Donate"), and sign transactions with their Solana blockchain wallet.
Transaction Execution: Once the user confirms the transaction and signs it using their wallet, the Blink facilitates the submission of the signed transaction to the Solana blockchain for processing and confirmation.
Image Source: Solana Actions Execution and Lifecycle, Solana action docs
Blinks can be integrated into various client applications, such as web browsers, mobile wallets, or chat bots. They provide a standardized method for users to interact with Solana Actions across different platforms, ensuring a consistent user experience regardless of the application used.
Getting a unique URL for any solana blockchain interaction just became this easy. All you have to do is:
Build and Test your Action
Deploy your Action
Register you action on the Dialect's Registry
Link your action to any site and build the UI around it
More information on each of the above steps is availablehere.
Some cool open-source examples of actions are availablehere.
Hereis a community-curated repo of some cool actions and blinks projects.
Use Cases and Examples of Blinks
Donations: Imagine a website allowing users to donate to causes via Solana. A blink integrated with this Action URL could immediately trigger a donation transaction preview in a wallet.
Social Media Integration: Blinks can be shared on platforms like Twitter, where supported clients unfurl Action URLs registered in public registries like Dialect's. This enables direct interaction with blockchain actions from social media feeds.
Developers can leverage Solana Blinks to enhance user engagement by:
Providing seamless transaction experiences within their applications.
Expanding reach by enabling transactions directly from websites, social media posts, or chatbot interactions.
Enhancing security with options to use verified public registries like Dialect's for Action URLs.
As of the time of writing this article, Solana blinks can only be used on browser-based applications when the appropriate blinks-compatible wallet has the setting turned on. But I hope that soon all wallets will support this feature and it becomes just as easy to build and use on mobile applications.
Solana Blinks represent a significant advancement in user-centric blockchain interaction, empowering developers to create intuitive and accessible transaction experiences across various platforms within the Solana ecosystem. By leveraging Blinks, developers can innovate and expand the usability of decentralized applications (dApps) and blockchain services, driving broader adoption and engagement among users.