Author: Aaron Milano, QuickNode; Translation: Golden Finance xiaozou
1. Introduction
Solana Actions and Blockchain Links (Blinks) are two major innovations of Solana that are expected to revolutionize the way users interact with the blockchain. They promise to enhance the overall user experience of various network platforms by enabling user-friendly and seamless integrated transactions. Whether it is sponsoring your favorite influencer, subscribing to premium content, or voting in a DAO, Actions and Blinks enable creators to connect with their audiences in effortless new ways anywhere on the web. Imagine a user could post a link on Twitter (e.g., donate.com/to/USER_ADDRESS) and the site renders a sponsorship widget directly in the tweet, like this:
The use cases and possibilities they bring are endless. In this article, we will explore what Solana Actions and Blinks are, how they work, and how to use them to enhance user interactions with the Solana blockchain.
No coding experience is required to understand this article, but it would be helpful if you have a basic understanding of Solana Pay, as Actions is actually an extension of Solana Pay. Let's get started now.
Please note that Solana Actions and Blinks are new technologies and the information provided in this article is based on the current state of their technical specifications. As the technology develops, new features and functionality may be introduced.
2. Solana Actions
Solana Actions provide a standardized way to pass signable transactions or messages from applications directly to users. These transactions can be executed on-chain. Here's how they work:
GET request: The client makes a GET request to the Action URL to get metadata about available actions. The metadata response includes information such as the application's program name, icon, and available actions. This is useful when presenting a user interface for the action.
POST request: After the user selects an action, the client makes a POST request to the Action URL to get a signable transaction or message. The user wallet then completes the signature and sends this transaction to the blockchain.
3. How Actions work
Initial GET request: The client obtains metadata about the available actions on the URL (the website can choose to do this, or the Chrome extension/wallet can do this when a known action URL is detected).
Display UI: The client application displays a user interface for performing actions based on the metadata obtained in the GET request.
User interaction: The user selects an action, triggering a POST request to obtain the transaction.
Transaction generation: The Action URL generates and returns an encoded transaction based on the user's selection.
Transaction signing: The wallet prompts the user to sign and send the transaction to the network.
Great! We now know how Solana Actions work, but how do clients support them? This is where Blockchain Links (Blinks) come in. Let's explore Blinks next.
4. Blockchain Links (Blinks)
Blinks is a client application that converts Solana Actions into a shareable, metadata-rich UI for interacting with and executing Actions. Blinks does this:
Detecting the Action URL: A Blink URL contains an action request parameter pointing to a Solana Action URL. Blinks detects this parameter.
Parsing the Action: The Blink client introspects the Action API link provided in the action query parameter.
User Interface: The client presents a rich user interface that enables users to complete the full lifecycle of an action (e.g., a sponsorship or voting button).
Executing Actions: Users can complete the full lifecycle of an action, including signing transactions with their wallets.
5. URL Scheme mechanism
The Solana Action URL scheme mechanism used by Blinks is as follows:
solana-action:<link>
Where <link> is the Action API URL. Links using query parameters must be URL encoded to avoid conflicts with other protocol parameters.
6. Blinks Action Detection
Blinks can detect actions in any of the following three ways:
7. Action Identity and Verification
Solana Actions can include an Action Identity, which is used to attribute on-chain activities to a specific verifiable provider. The identity is included in the transaction as a specially formatted message using the Memo instruction, allowing indexers and analysis platforms to track and verify the source of the action.
8. Summary
Solana Actions and Blinks are expected to simplify and enhance user interactions with blockchain transactions. They can seamlessly integrate blockchain functionality into a variety of applications and web interfaces, making blockchain interactions more accessible and user-friendly.
Here are some ideas that may help you think about how to use Solana Actions and Blinks in your projects:
Use Cases:
Sponsor/Pay Users: Share a "Donate to me" Blink on Twitter to enable fans to immediately donate SOL.
Subscribe to Premium Content: Users subscribe to premium content (e.g., purchase NFTs) via a Blink on a Discord channel. On-chain metadata can be updated to reflect the new subscription and can trigger a bot to grant access to an exclusive channel.
Jupiter Swap Tokens: Share an exchange link on YouTube or Twitch to allow users to exchange tokens directly through the video player.
DAO Voting: Share a DAO proposal link on Twitter and users vote after reading updates published by the DAO.