Getting Started
To get started, install the required dependencies into your TypeScript (or JavaScript) project.
- Existing Projects
- New Projects
npm install @thirdweb-dev/sdk @ethers^5
npx thirdweb create app
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)
"ethereum",
);
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 SDK’s 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 contract.call("myFunctionName");