Tornado Cash Official Logo

Tornado Cash Official

API for Tornado Cash Official

The Tornado Cash Official API allows developers to interact programmatically with the protocol for tasks such as deposits, withdrawals, and querying pool data. This page provides an overview of the API and how to use it.

Overview

The API exposes endpoints to interact with Tornado Cash Official’s smart contracts and off-chain services, enabling integration into custom applications or scripts.

Key Endpoints

Getting Started

To use the API:

  1. Access Documentation: Refer to the official API documentation on GitHub for detailed endpoint specifications.
  2. Set Up Environment: Use libraries like Ethers.js or Web3.js for Ethereum interaction, or HTTP clients for off-chain endpoints.
  3. Authenticate: Some endpoints may require signatures or API keys for rate limiting.
  4. Test: Use testnet pools to simulate deposits and withdrawals without risking funds.

Note: Always verify API endpoints and contract addresses to avoid phishing scams. Official resources are available on GitHub.

Example: Depositing via API

Below is a pseudocode example for depositing into a pool:

const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_PROJECT_ID');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
const tornadoContract = new ethers.Contract('TORNADO_POOL_ADDRESS', TORNADO_ABI, wallet);

async function deposit() {
    const amount = ethers.utils.parseEther('1.0'); // Deposit 1 ETH
    const tx = await tornadoContract.deposit({ value: amount });
    const receipt = await tx.wait();
    console.log('Deposit successful, note:', receipt.events[0].args.note);
}
deposit();
            

Security Considerations

When using the API:

Further Reading

Explore related topics: