Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE

Better DevEx, Fewer Dependencies: Meet the New Stacks Connect

With the help of many ecosystem partners, we’ve shipped a major release of Stacks Connect, which streamlines your app code and makes it much easier for wallets to add new functionality.

Type
Product update
Topic(s)
Product
Stacks
Published
February 27, 2025
Author(s)
Software Engineer
A browser that reads Stacks Connect
Contents

This latest release modernizes Stacks Connect and is the first major release for the library since the Blockstack days. Working with partners like Leather, Xverse, Sats Connect, and Fordefi, we’ve streamlined the process of how wallets connect to applications on Stacks.

Now Stacks Connect uses a simple protocol that focuses on common RPC methods that enable wallets to connect with applications. This brings 2 major benefits:

  1. This allows you to integrate Stacks Connect without relying on heavy dependencies.
  2. This provides a more extendable interface for wallets that makes it much easier for wallets to add new functionality in the future.

Moving the ecosystem in this direction also makes it easier for apps to build their own Connect alternatives or use wallet RPCs directly, without dependencies at all.

Why the Change?

The previous Connect library, while stable, was also outdated. It had unnecessary dependencies and complexity, and it also lacked clear definitions in wallet connectivity. For example, Connect wrapped RPC payloads in jsontokens and had a complicated serialization process for payloads — making it unfeasible for app developers to use wallets without dependencies.

Along with those issues, the growing popularity of Ordinals, Runes, and sBTC mean that wallets would benefit from a standardized extendable Bitcoin-first wallet RPC protocol. This protocol allows new ideas, protocols, and layers to re-use the same standard and be quickly adopted by both wallets and apps.

To that end, we’ve adopted an existing standard created by WBIPs to streamline and simplify how wallets and apps connect. You can learn more about this context in SIP-030.

What’s New?

This release fundamentally changes how Stacks Connect works. Moving forward, JSON-RPC 2.0 is the underlying protocol for wallet interaction, and RPC methods specify how wallets and apps can interact. Beginning today, you can access:

  • A standardized wallet interface: You no longer need to maintain different logic for different wallets. Instead, they can interact with all wallets complying with this RPC interface.
  • Enhanced developer experience: Wallets and apps can seamlessly connect and interact, reducing friction in the development process. The reduced complexity of this library also means you can build faster and with more confidence.
  • Future-proofed integrations: This standardized interface can easily be updated to meet future use cases and needs.
  • More control: Since the Connect dependency does less work (you simply call an RPC method and get a response), it’s easier to reason about what’s going on.

Alongside this RPC interface, Connect still provides some additional related functionality, including checking whether a user has connected, adding aliases for common methods, providing a UI for selecting which wallet to use, and overrides to align wallets with mismatching schemas.

Note: as part of this release, the core library “Auth”, which exists within the Stacks Connect Library, as well as separately as <code-rich-text>@stacks/auth<code-rich-text> on npm, is now deprecated.

Install the Latest Version

To start using the latest release, simply install the latest version of Stacks Connect:


npm install @stacks/connect@latest

Once installed, reference the Stacks Connect Guide for details on switching to the new wallet interface using the <code-rich-text>request<code-rich-text> method.


import { request } from ‘@stacks/connect’;
const response = await request(“getAddresses”);

Breaking Changes

Note: This change is technically a breaking change. We provide semi-backwards compatibility where possible, even when related functions are marked as deprecated.

Previously, Connect would use UserSessions to manage addresses and the user's profile. This additional configuration step was removed in favor of manual response management. If you’re looking for a similar experience to UserSessions, we recommend the following methods:

  • <code-rich-text>await connect()<code-rich-text>: Initiate a wallet connection and get addresses.
  • <code-rich-text>disconnect()<code-rich-text>: Clear the wallet selection and local storage.
  • <code-rich-text>isConnected()<code-rich-text>: Check whether a user has connected and you have their address.
  • <code-rich-text>getLocalStorage()<code-rich-text>: Access the addresses returned from an initial connect step.

We hope you find this new library useful. If you have feedback, please reach out to us in #stacks-js in the Hiro Developer Tool channels on the Stacks Discord.

Product updates & dev resources straight to your inbox
Your Email is in an invalid format
Checkbox is required.
Thanks for
subscribing.
Oops! Something went wrong while submitting the form.
Copy link
Mailbox
Hiro news & product updates straight to your inbox
Only relevant communications. We promise we won’t spam.

Related stories