The OP Stack Client SDK
The SDK is used when you write JavaScript or TypeScript code, either in the client or a Node.js server. In most ways Optimism is EVM equivalent (opens in a new tab). However, there are a few differences, which sometimes require decentralized applications to access Optimism-specific services.
Optimism-Specific Services
For example, decentralized applications might need to estimate gas costs. The standard Ethereum tooling assumes that gas cost is proportional to the gas used by the transaction, which is correct on L1, but not on Optimism. Our gas costs are predominately the cost of writing the transaction to L1, which depends on the transaction size, not the amount of processing required. This difference requires us to have separate methods to provide gas estimates.
Access Optimism Services
There are three ways to access Optimism services:
- Onchain contract calls (opens in a new tab). This is the way your contracts can get Optimism information or services directly.
- The JavaScript SDK (opens in a new tab). For use when you write JavaScript or TypeScript code, either in the client or a Node.js server.
- Offchain, using RPC, which is more complicated but usable from any development stack (Python, Rust, etc.).
SDK Chain Support
The SDK supports multiple OP Chains, such as OP, Base, etc. To see whether a specific OP Chain is supported directly, see the documentation (opens in a new tab). Chains that aren't officially supported just take a few extra steps. Get the L1 contract addresses, and provide them to the SDK. Once you do that, you can use the SDK normally.
Improve the SDK
If you find a bug, or if there's a feature you think we should add, there are several ways to inform us.
- Ask a question in our developer support forum (opens in a new tab).
- Submit an issue on Github (opens in a new tab).
Next Steps
These tutorials provide more information about using the SDK: