> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Intro to Tenderly SDK

> With the Tenderly SDK, simulate single transactions or bundles, manage contracts and wallets, and verify contracts from your code.

The Tenderly SDK is a TypeScript library that provides a set of useful utilities, enabling you to move faster through the different development stages using Tenderly.

It allows you to simulate transactions, simulate transaction bundles, manage contracts and wallets, and verify smart contracts from your code. The SDK is particularly useful for blockchain developers who want to integrate Tenderly's powerful tools into their dapp or development workflow.

### Introduction

The Tenderly SDK provides an easy-to-use interface for interacting with Tenderly via its API.

**Key features of the SDK include:**

* [Simulating transactions](/platform/sdk/simulating-transactions)
* [Managing and verifying contracts](/platform/sdk/managing-contracts)
* [Managing wallets](/platform/sdk/managing-wallets)

### Installation

The Tenderly SDK is available as an [npm package](https://www.npmjs.com/package/@tenderly/sdk). Install it by running the following command in your project directory:

**npm**

```bash title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @tenderly/sdk
```

**yarn**

```bash title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @tenderly/sdk
```

**pnpm**

```bash title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @tenderly/sdk
```

### Quickstart

The example below shows you how to do a simple simulation in less than 5 minutes. To learn more about the concepts behind the SDK, see [Tenderly SDK FAQs](/platform/sdk/concepts).

#### Initializing the SDK

To use the Tenderly SDK, you must first import the necessary libraries and create a new instance of the **`Tenderly`** class. This is where you pass in your Tenderly configuration details.

The configuration object should include your account name, project name, access key, and network.

```jsx title="example.jsx" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}

const tenderlyInstance = new Tenderly({
  accountName: 'my-account',
  projectName: 'my-project',
  accessKey: 'my-access-key',
  network: Network.MAINNET, // Replace with the appropriate network
});
```

If you don’t want to hardcode sensitive information like API keys, you can use environment variables to store this information, like so:

```jsx title="example.jsx" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}

const tenderlyInstance = new Tenderly({
  accountName: process.env.TENDERLY_ACCOUNT_NAME,
  projectName: process.env.TENDERLY_PROJECT_NAME,
  accessKey: process.env.TENDERLY_ACCESS_KEY,
  network: Network.MAINNET, // Replace with the appropriate network
});
```

<Note>
  The list of [supported networks](/platform/supported-networks) can be
  found here.
</Note>

#### How to get the account name, project slug, and secret key

Follow these step-by-step guides to obtain the necessary configuration details:

* [How to obtain the account name](/platform/account/projects/slug#username)
* [How to obtain the organization name](/platform/account/projects/slug#organization-name)
* [How to obtain the project slug/name](/platform/account/projects/slug#project-name-or-slug)
* [How to find, create, and manage API keys](/platform/account/projects/api-tokens)

### Example transaction simulation

The SDK provides a **`Simulator`** class for simulating transactions. To run a simulation, call the **`simulateTransaction`** method in the **`simulator`** namespace on the Tenderly instance:

```jsx title="example.jsx" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
const transaction = await tenderly.simulator.simulateTransaction({
  transaction: {
    from: callerAddress,
    to: counterContract,
    gas: 20000000,
    gas_price: '19419609232',
    value: 0,
    input: counterContractAbiInterface.encodeFunctionData('inc', []),
  },
  blockNumber: 3237677,
});
```

The code above produces the following result:

```js title="example.js" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  status: true,
  gasUsed: '46838',
  cumulativeGasUsed: undefined,
  blockNumber: '3237677',
  type: undefined,
  logsBloom: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAA==',
  logs: [ { raw: [Object] } ],
  trace: [
    {
      type: 'CALL',
      from: '0xDBcB6Db1FFEaA10cd157F985a8543261250eFA46',
      to: '0x93Cc0A80DE37EC4A4F97240B9807CDdfB4a19fB1',
      gas: '19978936',
      gas_used: '25774',
      value: '0',
      input: '0x371303c0',
      trace_address: [Array]
    }
  ]
}
```

### Next steps

For more guidance on running simulations with the Tenderly SDK, give these tutorials a go and learn how to simulate both individual and bundled transactions.

<CardGroup cols={2}>
  <Card title="How to Simulate Transactions with Tenderly SDK" href="/platform/sdk/tutorials/simulate-transactions" />

  <Card title="How to Perform Simulation Bundles with Tenderly SDK" href="/platform/sdk/tutorials/simulation-bundles" />
</CardGroup>

And as you continue learning how the Tenderly SDK works, we recommend taking at look at these helpful resources:

<CardGroup cols={3}>
  <Card title="How to manage wallets" href="/platform/sdk/managing-wallets" />

  <Card title="Practical examples and code snippets" href="/platform/sdk/examples" />

  <Card title="Basic Concepts" href="/platform/sdk/concepts" />
</CardGroup>
