# Hanzo DeFi — Blockchain — Hanzo AI

> Modular DeFi infrastructure for staking, lending, swapping, and yield aggregation.

Available Now

# Hanzo DeFi

DeFi building blocks for any application

Modular DeFi infrastructure for staking, lending, swapping, and yield aggregation. Gasless transactions, stablecoin APIs, and pre-built strategies—all on the Lux Network.

### Staking APIs

Enable token staking with customizable lock periods and reward distributions.

### Lending & Borrowing

Integrate money market protocols for lending, borrowing, and collateralization.

### Swap Aggregation

Find best swap rates across DEXs with single API call.

### Yield Strategies

Pre-built yield optimization strategies. Auto-compound and rebalance.

[Back to Web3 Overview](https://hanzo.ai/blockchain)

## Get Your API Key

Start building in under 5 minutes

HA

Failover

<50ms

Latency

100+

Chains

Start Building Free

View Documentation

No credit card required. Free tier includes 300M compute units/month.

Trusted by developers building:

DeFiNFTsPaymentsGamingAI Agents

## Key Capabilities

Everything you need, nothing you don&#x27;t.

### Staking APIs

Enable token staking with customizable lock periods and reward distributions.

### Lending & Borrowing

Integrate money market protocols for lending, borrowing, and collateralization.

### Swap Aggregation

Find best swap rates across DEXs with single API call.

### Yield Strategies

Pre-built yield optimization strategies. Auto-compound and rebalance.

### Gasless Transactions

Sponsor gas for your users. Pay in stablecoins, settle on-chain.

### Risk Management

Position monitoring, liquidation alerts, and automated risk controls.

### Analytics

Track TVL, APY, user positions, and protocol health in real-time.

### Portfolio APIs

Query user positions, historical returns, and performance across protocols.

### Rewards Distribution

Distribute tokens, points, or NFTs as rewards. Merkle drop support.

## Simple to Integrate

Get started with just a few lines of code. SDKs for every language.

Solidity

Node

Python

Go

Rust

C

C++

Ruby

YieldVault.sol

```
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import "@hanzo/defi/IHanzoRouter.sol"; import "@hanzo/defi/IHanzoStaking.sol"; import "@hanzo/defi/IHanzoLending.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract YieldOptimizer { IHanzoRouter public router; IHanzoStaking public staking; IHanzoLending public lending; constructor(address _router, address _staking, address _lending) { router = IHanzoRouter(_router); staking = IHanzoStaking(_staking); lending = IHanzoLending(_lending); } // Swap tokens using best route function swap( address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut ) external returns (uint256 amountOut) { IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn); IERC20(tokenIn).approve(address(router), amountIn); amountOut = router.swapExactTokensForTokens( tokenIn, tokenOut, amountIn, minAmountOut, msg.sender ); } // Stake tokens for yield function stake(address pool, uint256 amount, uint256 lockPeriod) external { IERC20(staking.stakingToken(pool)).transferFrom(msg.sender, address(this), amount); staking.stake(pool, amount, lockPeriod, msg.sender); } // Supply to lending market function supply(address market, uint256 amount) external { address asset = lending.marketAsset(market); IERC20(asset).transferFrom(msg.sender, address(this), amount); IERC20(asset).approve(address(lending), amount); lending.supply(market, amount, msg.sender); } // Get best yield across protocols function getBestYield(address token) external view returns ( uint256 stakingAPY, uint256 lendingAPY ) { stakingAPY = staking.getAPY(token); lendingAPY = lending.getSupplyRate(token); } }
```

## Built For

### Yield Aggregators

Build auto-compounding vaults that find the best yield across DeFi protocols.

### Staking Platforms

Launch token staking with customizable rewards and governance integration.

### Trading Apps

Integrate swap and limit orders with best-execution routing.

### Portfolio Trackers

Show users their DeFi positions, earnings, and historical performance.

## Supported Chains

Lux

Ethereum

Polygon

Arbitrum

Avalanche

## Start Building with Hanzo DeFi

Get your free API key and ship your first request in under 5 minutes. No credit card required.

Get Your API Key

[Explore All Web3 Products](https://hanzo.ai/blockchain)

## Get Hanzo DeFi

Deploy in seconds or self-host with the open-source release.

[Deploy to Cloud](https://console.hanzo.ai/deploy)
