Skip to main content

Package Installation

Install the AttestProtocol SDK using your preferred package manager:
npm install @attestprotocol/sdk

Peer Dependencies

Install blockchain-specific dependencies based on your target chains:
npm install @stellar/stellar-sdk
Installing all dependencies is recommended if you plan to support multiple blockchains or are unsure which chain you’ll use.

Requirements

RequirementVersion
Node.js>= 16.0
TypeScript>= 4.5
npm/pnpm/yarnLatest stable

Module Formats

The SDK supports multiple module formats for different environments:
import { AttestSDK } from '@attestprotocol/sdk';

TypeScript Configuration

TypeScript is recommended for better type safety and developer experience.
Add these settings to your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["ES2020", "DOM"],
    "module": "ESNext",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true
  }
}

Browser Configuration

Browser environments require polyfills for Node.js crypto and buffer modules.
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (config) => {
    config.resolve.fallback = {
      ...config.resolve.fallback,
      crypto: false,
      stream: false,
      buffer: false,
    };
    return config;
  },
};

module.exports = nextConfig;

Verification

Verify your installation is working correctly:
import { AttestSDK } from '@attestprotocol/sdk';

// Should log without errors
console.log('SDK loaded successfully');

// Check version
console.log('SDK version:', AttestSDK.VERSION);
Check installed version via CLI:
npm list @attestprotocol/sdk

Build Outputs

The SDK provides multiple build outputs for different use cases:
FormatPathUsage
CommonJSdist/main/index.jsNode.js applications
ES Modulesdist/module/index.jsModern bundlers
UMDdist/umd/attestprotocol.jsBrowser/CDN usage
TypeScriptdist/index.d.tsType definitions

Environment Setup

Create a .env file in your project root:
.env
# Stellar Configuration
STELLAR_SECRET_KEY=SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STELLAR_PUBLIC_KEY=GXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STELLAR_RPC_URL=https://soroban-testnet.stellar.org

# Solana Configuration
SOLANA_SECRET_KEY=[1,2,3,...]
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_PROGRAM_ID=BMr9aui54YuxtpBzWXiFNmnr2iH6etRu7rMFJnKxjtpY

# Environment
NODE_ENV=development
Never commit private keys to version control. Use environment variables in production.

Troubleshooting

Clear your cache and reinstall:
rm -rf node_modules package-lock.json
npm install
  • Ensure TypeScript version >= 4.5
  • Verify tsconfig.json settings match recommendations
  • Install Node.js types: npm install -D @types/node
  • Configure polyfills as shown above
  • Check for conflicting global definitions
  • Ensure bundler supports ES modules
Install missing peer dependencies:
npm install @stellar/stellar-sdk @coral-xyz/anchor @solana/web3.js

Version Compatibility

SDK VersionStellar SDKAnchorNode.js
1.x^12.0.0^0.30.0>=16
2.x^13.0.0^0.30.0>=18
Always use the latest stable version for the best performance and security updates.

Next Steps