System Requirements

Before installing Treeship, ensure your environment meets these requirements:
  • Node.js: Version 16.0 or higher (for JavaScript/TypeScript)
  • Python: Version 3.8 or higher (for Python SDK)
  • Operating System: macOS, Linux, or Windows
  • Memory: Minimum 4GB RAM for proof generation

JavaScript/TypeScript Installation

Using npm

npm install @treeship/sdk

Using yarn

yarn add @treeship/sdk

Using pnpm

pnpm add @treeship/sdk

Python Installation

Using pip

pip install treeship-sdk

Using poetry

poetry add treeship-sdk

Configuration

1. Get Your API Key

Sign up at treeship.dev and generate an API key from your dashboard.

2. Set Environment Variables

Create a .env file in your project root:
# .env
TREESHIP_API_KEY=your_api_key_here
TREESHIP_ENVIRONMENT=production  # or "sandbox" for testing
Never commit your .env file to version control. Add it to your .gitignore:
echo ".env" >> .gitignore

3. Initialize the SDK

import { Treeship } from '@treeship/sdk';

const treeship = new Treeship({
  apiKey: process.env.TREESHIP_API_KEY,
  environment: process.env.TREESHIP_ENVIRONMENT || 'production'
});

// Test your connection
try {
  const status = await treeship.health.check();
  console.log('Connected to Treeship:', status);
} catch (error) {
  console.error('Connection failed:', error);
}

Advanced Configuration

Custom API Endpoint

For enterprise or self-hosted deployments:
const treeship = new Treeship({
  apiKey: process.env.TREESHIP_API_KEY,
  baseUrl: 'https://api.your-domain.com/v1',
  timeout: 30000, // 30 seconds
  retries: 3
});

Proxy Configuration

If you’re behind a corporate proxy:
const treeship = new Treeship({
  apiKey: process.env.TREESHIP_API_KEY,
  httpAgent: new HttpsProxyAgent('http://proxy.company.com:8080')
});

Verify Installation

Run this test script to verify everything is working:
const { Treeship } = require('@treeship/sdk');

async function verifyInstallation() {
  try {
    const treeship = new Treeship({
      apiKey: process.env.TREESHIP_API_KEY
    });
    
    // Check API connection
    const health = await treeship.health.check();
    console.log('✅ API Connection:', health.status);
    
    // Check ZK proof generation capability
    const zkTest = await treeship.proofs.test();
    console.log('✅ ZK Proof Generation:', zkTest.status);
    
    console.log('\n🎉 Treeship SDK installed successfully!');
  } catch (error) {
    console.error('❌ Installation verification failed:', error.message);
  }
}

verifyInstallation();

Troubleshooting

Common Issues

Next Steps