Private keys

Learn how to manage private keys with Stacks.js.

There are two main ways developers build applications on the Stacks blockchain:

Without direct private key access

For example, a web app that allows users to interact with the Stacks blockchain using their Stacks wallet (whether a browser extension or mobile/desktop app).

Most users interact with apps via their favorite Stacks wallet. Keeping that flow in mind, developers can build web apps that prompt the user for an action (e.g. sign a transaction), and then the wallet will handle the rest.

The wallet will act in the security, and best interest of the user, and the user will be able to review the transaction before signing. Read more.

With private key access

For example, managing funds with the Stacks.js CLI or building a backend (which can sign transactions directly).

While building without direct private key access is most common, there are use cases where devs need direct private key access.

In those instances, developers can build simple scripts and tools intended for "offline" use. Users may use the Stacks.js CLI directly to send a transaction, and backends may need to automate signing without direct user interaction.

In these cases, developers can use the same libraries used by Stacks wallets for account handling and transaction signing. Read more.