Skip to main content

Overview

When interacting with on-chain yield protocols through the Yield API, transaction integrity is critical. Even a small modification can redirect funds or trigger unintended contract calls. Shield is a lightweight validation library that lets you verify unsigned transactions from the Yield API before presenting them for signing. It’s designed to be embedded directly into your integration — giving you full control over when and how validation occurs.

GitHub Repository

View source code

NPM Package

Install via npm

Key Features

Zero-trust verification

Every transaction must match a pre-audited pattern

Multi-chain support

Works across EVM, Solana, and Tron (Cosmos and other L2s coming soon)

Easy to integrate

Add one validation call before your signing logic — no extra middleware required

Clear error reporting

Immediate feedback on invalid or ambiguous transactions

Installation


Usage Example


How It Works

Shield uses pattern matching to analyze each transaction’s structure, function calls, and parameters, validating them against a verified template for the specified yield integration. If the transaction doesn’t match the safe pattern — for example, if an attacker modified a withdrawal address — Shield immediately flags it:
You can decide how to handle the result: block the signing flow, display a warning, or log it for review.

Supported Yield Integrations

More integrations (Cosmos, Polkadot, Bittensor, additional EVM yields) are being continuously added.
Check programmatically:

API Reference

shield.validate(request)

Validates a transaction by auto-detecting its type. Parameters:
Returns:

shield.isSupported(yieldId: string): boolean

Checks whether a given yield integration is supported.

shield.getSupportedYieldIds(): string[]

Returns a list of all supported Yield IDs.

Common Validation Errors


Decoding & Visualization

Shield allows clients to locally decode and visualize unsigned transactions before signing or broadcasting them. This feature enhances transparency and compliance by letting integrators inspect every on-chain instruction — including target addresses, function calls, and parameter values — directly on their own systems.

How It Works

1

Retrieve transaction

Get an unsigned transaction from the Yield API (e.g., /v1/actions/enter or /v1/actions/exit)
2

Decode locally

Pass the transaction into Shield’s decode() method
3

Inspect results

Shield returns a structured, human-readable view including target contract, function/method, parameters, token amounts, and associated accounts

Why It Matters

  • Transparency: Visually confirm every on-chain call before user signing
  • Security: Reduces man-in-the-middle or tampering attacks by verifying locally
  • Compliance: Log decoded transactions for audit trails or regulator review
  • Zero Trust: Decoding occurs entirely client-side — no external API calls needed

Shield — Go Package

For institutional and high-security deployments, Shield is also available as a Go package designed for hardware-secure, compiled environments (e.g., secure enclaves, HSMs, air-gapped systems) where TypeScript cannot be executed. Shield Go provides the same validation and decoding functionality as the TypeScript package.

Capability Comparison


Why Shield Matters

Each API layer in a DeFi integration increases potential attack surfaces. Shield enforces a zero-trust model, guaranteeing that the transaction users sign is exactly the one intended by Yield.xyz. By validating before signing, you:
  • Prevent tampering and phishing attempts
  • Maintain user trust through transparency
  • Add structural security without sacrificing UX

Next Steps

Security Overview

Full security architecture

HyperNative

Pre-transaction simulation

Security Tiers

Deployment models

Quickstart

Integrate Shield into your app