Quickstart
This guide walks you through creating an account and earning yield on Compound — the most common integration flow. By the end, you’ll have a working sub-account earning USDC yield on Base.Prerequisites
- A Legend Prime Account with a query key (contact us to get set up)
- Node.js 18+ or Python 3.9+
1. Install the SDK
2. Generate a signer key
Each sub-account needs a signer — an Ethereum key that authorizes fund movements. For this quickstart, we’ll generate a fresh EOA key:3. Initialize the client
4. Create a sub-account
Pass the signer’s address to create a sub-account. Legend creates a Quark Wallet — an on-chain smart wallet — for the account.signer_address— Your signing key’s address (what you generated in step 2)legend_wallet_address— The on-chain smart wallet Legend created for this account
5. Create an earn plan
Once the wallet is funded, create a plan. Legend generates the on-chain transaction details and returns an EIP-712 digest for signing.Plans expire after 2 minutes. Sign and execute before
expires_at or create a new plan.6. Sign the plan
The signer approves the plan by signing the EIP-712 digest. This happens locally — the private key never leaves your infrastructure.7. Execute the plan
Send the signature back to Legend. This triggers the on-chain transaction.8. Verify the result
Poll the activities endpoint to confirm the transaction landed.Full example
Here’s the complete flow in one script:Next steps
- Withdraw funds from a DeFi position
- Transfer assets to another wallet
- Monitor activities with events and long-polling
- API Reference for all available endpoints