Skip to main content
You keep your keys and sign every transaction yourself. Before you do, Shield checks the transactions Yield.xyz builds against their verified pattern, down to the target contract, the receiver, the spender and the calldata. Shield is open source, so you can audit exactly what it checks. Yield.xyz recommends running Shield in your own app or backend for a zero-trust setup. It treats every unsigned transaction as untrusted, including the ones the Earn API builds, so you present a transaction for signing only once it passes. A small modification to a transaction can redirect funds to an attacker’s address, trigger unintended contract calls or drain token approvals, and Shield catches it before anything is signed. Defense Mode runs the same checks inside the Earn API as a second layer. Shield sits between transaction construction and signing: the Earn API builds an unsigned transaction, Shield validates it against the yield’s verified pattern, and only then do you sign. It decodes each transaction into a typed structure (ABI decoding for EVM, instruction parsing for Solana, TronWeb decoding for Tron), validates each decoded field against a verified template for the specified yield integration, and re-encodes EVM calldata to detect byte-level tampering. Anything that deviates from the verified pattern fails validation.

GitHub repository

Source code, issues, and release artifacts at stakekit/shield

npm package

TypeScript library: @yieldxyz/shield

What Shield checks

Shield covers EVM, Solana and Tron transactions for the yields it has validators for, including more than 1,600 ERC-4626 vaults across 18 networks. Check coverage per yield with isSupported(yieldId) or list it with getSupportedYieldIds(); see Shield features for the validator matrix. In the client library, unsupported or unrecognized transactions fail validation rather than passing; server-side, yields without a validator are currently skipped.

Where it runs

Client-side and server-side Shield check different things: client-side validation covers the path from the API to your signing flow, server-side validation covers the API itself. They can run together.
Shield flow: the Earn API builds an unsigned transaction and Shield checks it server-side in Defense Mode, then the unsigned transaction is sent to your app, where Shield checks it again; only a transaction that passes is signed and broadcast

Defense Mode

Defense Mode is Shield running inside the Earn API’s transaction pipeline, so every unsigned transaction the API builds for a supported yield is validated before it is returned. In Monitor mode, the default, a failed validation is logged and the transaction is returned as normal. In Block mode, the transaction is rejected and you receive an error instead. Yield.xyz enables Block for a project after a Monitor period on live traffic. Yields without a registered validator are currently skipped server-side rather than blocked. Defense Mode needs no changes to your integration code. In Block mode, a rejected transaction returns HTTP 500 with the message Transaction blocked by security validation. The detailed reason is logged server-side and not returned, so Shield’s logic can’t be probed through error messages. If you believe a block is incorrect, contact Yield.xyz with the request timestamp and your project.

What each layer covers

The call

validate returns isValid, a human-readable reason when it fails, optional details, and the detectedType it identified. Your integration decides what to do with a failure: block signing, warn the user, or log it for review.

Why zero trust

Every step between building a transaction and signing it is a point where the transaction could be altered. An attacker who changed an API response could, for example, point a deposit at their own address, and the transaction would still be a valid ERC-4626 call that executes on-chain. Shield checks each transaction independently of the system that built it, so a tampered transaction fails validation before anyone signs it.

Next steps

Security overview

How Shield fits into the wider security suite

Shield features

Coverage matrix, validators, decoding, and validation errors

Shield integration

TypeScript library, standalone binaries, and Go/Python/Rust guides