Openfort Node SDK
npm install @openfort/openfort-node
Server-side SDK for managing EVM and Solana wallets, gas sponsorship, and blockchain interactions.




- Table of Contents
- Overview
- Installation
- Quickstart
- Features
- Wallet Management
- Signing
- Gas Sponsorship
- IAM \& Authentication
- Examples
- Documentation
- Support
- License
The Openfort Node.js SDK provides convenient access to the Openfort API for server-side applications. It enables developers to:
- Create and manage EVM and Solana backend wallets
- Sign messages, typed data, and transactions
- Execute gasless transactions with gas sponsorship policies
- Manage users, accounts, and transaction intents
- Integrate with smart contracts and token swaps
Requires Node.js 14 or higher.
``bash`
npm install @openfort/openfort-node
`bash`
yarn add @openfort/openfort-node
`bash`
pnpm add @openfort/openfort-node
Get your API key from the Openfort Dashboard.
`typescript
import Openfort from "@openfort/openfort-node";
const openfort = new Openfort("sk_test_...", {
walletSecret: "your-wallet-secret", // Required for signing operations
});
// Create an EVM backend account
const account = await openfort.accounts.evm.backend.create({
name: "MyWallet",
});
console.log("Account address:", account.address);
// Sign a message (methods are on the account object)
const signature = await account.signMessage({
message: "Hello, Openfort!",
});
console.log("Signature:", signature);
`
Create and manage wallets across EVM chains and Solana:
`typescript
// EVM backend accounts
const evmAccount = await openfort.accounts.evm.backend.create({
name: "MyEVMWallet",
});
// Solana backend accounts
const solanaAccount = await openfort.accounts.solana.backend.create({
name: "MySolanaWallet",
});
// Import existing wallet
const imported = await openfort.accounts.evm.backend.import({
privateKey: "0x...",
name: "ImportedWallet",
});
`
Sign messages, typed data, and transactions. Methods are called directly on the account object:
`typescript
// Sign message
const signature = await account.signMessage({
message: "Hello, Openfort!",
});
// Sign EIP-712 typed data
const typedSig = await account.signTypedData({
domain: { name: "MyApp", version: "1", chainId: 1 },
types: {
Person: [
{ name: "name", type: "string" },
{ name: "wallet", type: "address" },
],
},
primaryType: "Person",
message: { name: "Alice", wallet: "0x..." },
});
`
Sponsor gas fees for your users with policies:
`typescript
// Create a sponsorship policy
const policy = await openfort.policies.create({
name: "Free gas for users",
chainId: 80002,
strategy: { sponsorSchema: "pay_for_user" },
});
// Register a contract
const contract = await openfort.contracts.create({
name: "MyContract",
chainId: 80002,
address: "0x38090d1636069c0ff1af6bc1737fb996b7f63ac0",
});
// Add rules to control sponsorship
await openfort.policyRules.create({
policy: policy.id,
type: "account_functions",
contract: contract.id,
functionName: "mint",
});
`
Manage users and verify sessions:
`typescript
// List authenticated users
const users = await openfort.iam.users.list({ limit: 10 });
// Verify session from access token
const session = await openfort.iam.getSession({ accessToken });
console.log("User ID:", session.user.id);
console.log("Session expires:", session.session.expiresAt);
`
The SDK includes comprehensive examples for all features. See the examples directory for runnable code.
| Category | Examples |
| -------------- | -------------------------------------------------- |
| EVM Wallets | Create, import, export, sign messages/transactions |
| Solana Wallets | Create, import, export, sign messages/transactions |
| Policies | Gas sponsorship, policy rules, enable/disable |
| Transactions | Create intents, estimate gas, read contracts |
| Exchange | Token swap quotes and execution |
| IAM | User management, session verification |
Run examples:
`bash``
cd examples
cp .env.example .envEdit .env with your API key
pnpm example evm/accounts/createAccount.ts
- Official Documentation
- API Reference
- Dashboard
- GitHub Issues - Report bugs and request features
- Twitter - Follow for updates
- Website - Learn more about Openfort
New features and bug fixes are released on the latest major version. We recommend upgrading to the latest version for security updates and new functionality.
This project is licensed under the MIT License.