Installing Stacks.js Packages
Stacks.js is separated into many smaller packages, which can be installed individually.
Most packages are published to npm under the @stacks scope.
Let's install the @stacks/network package:
npm install @stacks/network
Packages
Full list of available packages
Connecting Wallets
@stacks/connectConnect web application to Stacks wallet browser extensions.
Stacks Primitives
@stacks/transactionsConstruct, decode transactions and work with Clarity smart contracts on the Stacks blockchain.@stacks/wallet-sdkLibrary for building wallets, managing accounts, and handling keys for the Stacks blockchain.@stacks/storageStore and fetch files with Gaia, the decentralized storage system.@stacks/encryptionEncryption functions used by stacks.js packages.@stacks/authConstruct and decode authentication requests for Stacks apps.@stacks/profileFunctions for manipulating user profiles.@stacks/networkNetwork and API library for working with Stacks blockchain nodes.@stacks/commonCommon utilities used by stacks.js packages.
Native Smart Contract Interaction
@stacks/bnsLibrary for interacting with the BNS contract.@stacks/stackingLibrary for PoX stacking.
Others
@stacks/cliCommand line interface to interact with auth, storage, and Stacks transactions.@stacks/blockchain-api-clientAuto-generated REST and websocket API for all endpoints provided by the Stacks Blockchain API.@stacks/keychainDEPRECATED, replaced by@stacks/wallet-sdk
The most commonly used packages are:
@stacks/connect— Stacks Connect, for building Stacks-ready web applications@stacks/network— Network configuration (used together with other packages)@stacks/transactions— Transaction construction, serialization, Clarity helpers, and more@stacks/blockchain-api-client— Auto-generated API client (with websocket support) for all Stacks Blockchain API endpoints.
The source-code for most packages live in the Stacks.js monorepo or the Stacks Connect monorepo on GitHub.