Разработка платформы крипто-бухгалтерии

Проектируем и разрабатываем блокчейн-решения полного цикла: от архитектуры смарт-контрактов до запуска DeFi-протоколов, NFT-маркетплейсов и криптобирж. Аудит безопасности, токеномика, интеграция с существующей инфраструктурой.
Показано 1 из 1 услугВсе 1306 услуг
Разработка платформы крипто-бухгалтерии
Сложная
от 1 недели до 3 месяцев
Часто задаваемые вопросы
Направления блокчейн-разработки
Этапы блокчейн-разработки
Последние работы
  • image_website-b2b-advance_0.png
    Разработка сайта компании B2B ADVANCE
    1258
  • image_web-applications_feedme_466_0.webp
    Разработка веб-приложения для компании FEEDME
    1170
  • image_websites_belfingroup_462_0.webp
    Разработка веб-сайта для компании БЕЛФИНГРУПП
    873
  • image_ecommerce_furnoro_435_0.webp
    Разработка интернет магазина для компании FURNORO
    1092
  • image_logo-advance_0.png
    Разработка логотипа компании B2B Advance
    563
  • image_crm_enviok_479_0.webp
    Разработка веб-приложения для компании Enviok
    830

Разработка платформы крипто-бухгалтерии

Крипто-бухгалтерия — сложнее обычной из-за специфики активов: токены не имеют единой биржи, DeFi операции нестандартны, и каждая транзакция требует fair market value в момент события. Платформа должна автоматизировать весь цикл: импорт транзакций → классификация → расчёт cost basis → формирование отчётности.

Архитектура платформы

Многоисточниковый импорт

class TransactionImportService {
  async importFromSource(source: DataSource, accountId: string): Promise<ImportResult> {
    switch (source.type) {
      case "exchange_api":
        return this.importFromExchangeAPI(source, accountId);
      case "wallet_address":
        return this.importFromBlockchain(source.address, source.blockchain, accountId);
      case "csv_file":
        return this.importFromCSV(source.file, source.format, accountId);
      case "hardware_wallet":
        return this.importFromHardwareWallet(source, accountId);
    }
  }
  
  private async importFromExchangeAPI(source: ExchangeSource, accountId: string) {
    const connector = this.getExchangeConnector(source.exchange);
    
    // Получаем все транзакции начиная с последнего импорта
    const lastImport = await db.getLastImportTime(accountId, source.exchange);
    const transactions = await connector.getTransactions({ since: lastImport });
    
    // Нормализуем к единому формату
    const normalized = transactions.map(tx => this.normalizeTransaction(tx, source.exchange));
    
    await db.saveTransactions(accountId, normalized);
    return { imported: normalized.length, source: source.exchange };
  }
  
  private async importFromBlockchain(
    address: string,
    blockchain: string,
    accountId: string
  ): Promise<ImportResult> {
    // Используем The Graph или Moralis для индексированных данных
    const indexer = this.getBlockchainIndexer(blockchain);
    const transactions = await indexer.getAddressTransactions(address);
    
    // DeFi специфика: decode calldata для понимания что произошло
    const decoded = await Promise.all(
      transactions.map(tx => this.decodeDeFiTransaction(tx, blockchain))
    );
    
    await db.saveTransactions(accountId, decoded.flat());
    return { imported: decoded.flat().length };
  }
}

Коннекторы бирж

class BinanceConnector implements ExchangeConnector {
  async getTransactions(params: { since: Date }): Promise<RawTransaction[]> {
    const results: RawTransaction[] = [];
    
    // Binance имеет разные endpoints для разных типов
    const [spot, futures, staking, savings] = await Promise.all([
      this.binance.getSpotTrades(params.since),
      this.binance.getFuturesTrades(params.since),
      this.binance.getStakingHistory(params.since),
      this.binance.getSavingsHistory(params.since),
    ]);
    
    return [...spot, ...futures, ...staking, ...savings];
  }
}

// Единый нормализованный формат
function normalizeBinanceTrade(trade: BinanceTrade): UnifiedTransaction {
  return {
    id: trade.id.toString(),
    timestamp: new Date(trade.time),
    type: trade.isBuyer ? TransactionType.BUY : TransactionType.SELL,
    assetIn: trade.isBuyer ? trade.symbol.replace("USDT", "") : "USDT",
    amountIn: trade.isBuyer ? parseFloat(trade.qty) : parseFloat(trade.quoteQty),
    assetOut: trade.isBuyer ? "USDT" : trade.symbol.replace("USDT", ""),
    amountOut: trade.isBuyer ? parseFloat(trade.quoteQty) : parseFloat(trade.qty),
    fee: parseFloat(trade.commission),
    feeCurrency: trade.commissionAsset,
    exchange: "BINANCE",
  };
}

Автоматическая классификация

class TransactionClassifier {
  async classify(tx: UnifiedTransaction): Promise<ClassifiedTransaction> {
    // Простые случаи
    if (tx.assetOut === "USD" || tx.assetOut === "USDT" || tx.assetOut === "USDC") {
      return { ...tx, taxCategory: TaxCategory.DISPOSAL, confidence: 0.95 };
    }
    
    if (tx.type === TransactionType.STAKING_REWARD || tx.type === TransactionType.INTEREST) {
      return { ...tx, taxCategory: TaxCategory.INCOME, confidence: 0.95 };
    }
    
    if (tx.type === TransactionType.TRANSFER && await this.isSelfTransfer(tx)) {
      return { ...tx, taxCategory: TaxCategory.NON_TAXABLE, confidence: 0.90 };
    }
    
    // DeFi операции — нужен дополнительный анализ
    if (tx.source === "defi") {
      return this.classifyDeFiTransaction(tx);
    }
    
    // Swap crypto-to-crypto
    if (this.isCryptoSwap(tx)) {
      return { ...tx, taxCategory: TaxCategory.DISPOSAL, subType: "SWAP", confidence: 0.85 };
    }
    
    // Требует ручной классификации
    return { ...tx, taxCategory: TaxCategory.UNCLASSIFIED, confidence: 0, requiresReview: true };
  }
  
  private async isSelfTransfer(tx: UnifiedTransaction): Promise<boolean> {
    // Проверяем принадлежат ли адреса отправителя и получателя одному пользователю
    if (!tx.fromAddress || !tx.toAddress) return false;
    const user = tx.userId;
    const [fromOwned, toOwned] = await Promise.all([
      db.isUserAddress(user, tx.fromAddress),
      db.isUserAddress(user, tx.toAddress),
    ]);
    return fromOwned && toOwned;
  }
}

DeFi декодирование

async function decodeDeFiTransaction(tx: BlockchainTx): Promise<UnifiedTransaction[]> {
  // Декодируем input data для известных протоколов
  const protocol = identifyProtocol(tx.to);
  
  switch (protocol) {
    case "UNISWAP_V3": {
      const decoded = uniswapV3Interface.parseTransaction({ data: tx.data });
      if (decoded.name === "exactInputSingle" || decoded.name === "exactInput") {
        return [createSwapTransaction(tx, decoded)];
      }
      break;
    }
    
    case "AAVE_V3": {
      const decoded = aaveV3Interface.parseTransaction({ data: tx.data });
      if (decoded.name === "supply") {
        return [createLendingDeposit(tx, decoded)];
      }
      if (decoded.name === "withdraw") {
        return [createLendingWithdraw(tx, decoded), createInterestIncome(tx, decoded)];
      }
      break;
    }
    
    case "CURVE": {
      return decodeCurveSwap(tx);
    }
  }
  
  // Неизвестный протокол — возвращаем raw
  return [createRawTransaction(tx)];
}

Мультиюрисдикционная отчётность

class TaxReportGenerator {
  async generateReport(
    accountId: string,
    taxYear: number,
    jurisdiction: string
  ): Promise<TaxReport> {
    
    const events = await this.getTaxEvents(accountId, taxYear);
    
    switch (jurisdiction) {
      case "US": return this.generateUS8949(events, taxYear);
      case "UK": return this.generateUKCGT(events, taxYear);
      case "DE": return this.generateGermanReport(events, taxYear);
      case "AU": return this.generateAUCGT(events, taxYear);
      default: return this.generateGenericReport(events, taxYear);
    }
  }
  
  private async generateUS8949(events: TaxEvent[], taxYear: number): Promise<TaxReport> {
    // IRS Form 8949 формат
    const shortTerm = events.filter(e => !e.isLongTerm);
    const longTerm = events.filter(e => e.isLongTerm);
    
    return {
      format: "IRS-8949",
      year: taxYear,
      shortTermGains: shortTerm.reduce((sum, e) => sum + e.gainOrLoss, 0),
      longTermGains: longTerm.reduce((sum, e) => sum + e.gainOrLoss, 0),
      transactions: events.map(this.formatFor8949),
      summary: this.generateScheduleD(shortTerm, longTerm),
    };
  }
}

Стек

Компонент Технология
Exchange connectors Node.js + official SDKs
Blockchain indexing The Graph + Moralis
Cost basis engine PostgreSQL + TimescaleDB
Price history CoinGecko API + собственный кеш
Report generation PDFKit + ExcelJS + CSV
Frontend React + Recharts (charts)
Queue BullMQ (async import jobs)

Полная крипто-бухгалтерская платформа с поддержкой 10+ бирж, DeFi декодированием и мультиюрисдикционными отчётами: 3-4 месяца разработки.