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

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)

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();