Skip to main content

Getting Started

To get started, install the required dependencies into your TypeScript (or JavaScript) project.

npm install @thirdweb-dev/sdk ethers@^5


You will require an API key to use thirdweb’s infrastructure services with the SDK. If you haven’t created a key yet you can do so for free from the thirdweb dashboard.

Instantiate the SDK using your private key to enable both read and write operations.

import { ThirdwebSDK } from "@thirdweb-dev/sdk";

const sdk = ThirdwebSDK.fromPrivateKey(
process.env.PRIVATE_KEY, // Your wallet's private key (only required for write operations)
clientId: "YOUR_CLIENT_ID", // Use client id if using on the client side, get it from dashboard settings
secretKey: "YOUR_SECRET_KEY", // Use secret key if using on the server, get it from dashboard settings

Examples templates: Node.js Express.js

With the SDK instantiated, you can now deploy smart contracts, interact with them, and much more.

To connect to your contract, use the SDKs getContract method and the call method to read/write data.

Functions are called automatically from the wallet you instantiated the SDK with.

// Connect to your smart contract using the contract address
const contract = await sdk.getContract("{{contract_address}}");

// Call a function on your smart contract using the function name
const name = await"myFunctionName");

// Or Using the extensions API matching your contract extensions
const allNFTs = await contract.erc721.getAll();
const tokenSupply = await contract.erc20.totalSupply();