# JustLend Documentation > JustLend is the largest lending protocol on TRON, based on the Compound V2 architecture. Users supply TRX and TRC20 assets as collateral to earn interest, borrow against that collateral, stake TRX for sTRX (liquid staking), or rent TRON Energy at a discount. This site documents the protocol for users, integrators, and AI agents. > Site `Last-Modified` and per-page commit dates are published via HTTP headers and the page footer. For documentation change history see [CHANGELOG.md](https://github.com/justlend/justlend-docs/blob/main/CHANGELOG.md). ## Authoritative machine-readable sources - [OpenAPI 3.1 specification](https://docs.justlend.org/developers/apis/justlend_apis.yaml): Machine-readable contract for the public read-only HTTP API at `https://openapi.just.network`. Importable into Swagger UI, Postman, or any LLM tool. - [API reference (rendered)](https://docs.justlend.org/developers/apis): Swagger UI rendering of the OpenAPI spec. - [sitemap.xml](https://docs.justlend.org/sitemap.xml): Full list of indexable documentation pages. - [JustLend CLI](https://github.com/justlend/justlend-cli) (v1.0.1): Source-installable terminal automation with versioned JSON output, stable exit codes, dry-run simulation, and explicit write safeguards. - [JustLend V2 Utils](https://github.com/justlend/justlend-utils-v2) (v1.0.0): Source-installable browser/Node.js utility library for embedded V2 contract integrations; requires explicit `TronWeb` injection. ## Getting started - [Overview](https://docs.justlend.org/getting_started/overview): Protocol model — suppliers, borrowers, jTokens, interest rates, liquidation. - [Whitepaper (PDF)](https://justlend.org/docs/justlend_whitepaper_en.pdf): Full protocol design. - [Supply concept](https://docs.justlend.org/getting_started/concepts/supply) - [Borrow concept](https://docs.justlend.org/getting_started/concepts/borrow) - [Withdraw concept](https://docs.justlend.org/getting_started/concepts/withdraw) - [Repay concept](https://docs.justlend.org/getting_started/concepts/repay) - [Liquidations](https://docs.justlend.org/getting_started/concepts/liquidations) - [Risks](https://docs.justlend.org/getting_started/concepts/risks) - [Staked TRX (sTRX)](https://docs.justlend.org/getting_started/concepts/staked_trx) - [Energy Rental](https://docs.justlend.org/getting_started/concepts/energy_rental) ## Governance - [JIPs (JustLend Improvement Proposals)](https://docs.justlend.org/governance/jips) - [Tokenomics (JST)](https://docs.justlend.org/governance/tokenomics) - [Community Forum](https://forum.justlend.org) ## Developer reference - [Contracts Overview](https://docs.justlend.org/developers/contracts_overview): Architecture across SBM, interest rate models, oracle, governance, comptroller. - [Supply and Borrow Market (SBM)](https://docs.justlend.org/developers/supply_and_borrow_market/sbm): Function signatures for `mint`, `borrow`, `repayBorrow`, `redeem`, `borrowBalanceCurrent`, etc. - [Interest Rate Model](https://docs.justlend.org/developers/supply_and_borrow_market/interest_rate_model) - [Governance contracts](https://docs.justlend.org/developers/supply_and_borrow_market/governance) - [Price Oracle](https://docs.justlend.org/developers/supply_and_borrow_market/price_oracle) - [Comptroller](https://docs.justlend.org/developers/supply_and_borrow_market/comptroller) - [Staked TRX contracts](https://docs.justlend.org/developers/staked_trx) - [Energy Rental contracts](https://docs.justlend.org/developers/energy_rental) - [Deployed Contracts](https://docs.justlend.org/developers/deployed_contracts): Mainnet and Nile addresses for jTokens, interest rate models, oracle, governance, comptroller, sTRX, and Energy Rental. - [Machine-readable contract directory](https://docs.justlend.org/developers/contracts.json): JSON address book with `base58`, `hex_evm`, `hex_tron`, and Tronscan links for Mainnet and Nile. Each jToken entry includes a `status: "active" | "legacy"` field, so consumers can filter the 18 active markets from the 6 legacy ones without parsing prose. - [JSON Schema for the contract directory](https://docs.justlend.org/developers/contracts.schema.json): Draft 2020-12 schema (`$id` = its own URL). Validates `contracts.json` end-to-end, including TRON Base58 / EVM `0x` / TRON `41`-hex address regexes and the per-network category enum. - [Machine-readable ABI catalog](https://docs.justlend.org/developers/abis/): Discoverable index for every JSON ABI under `/developers/abis/`, with contract purpose and usage notes. - Direct ABI JSON: [jToken](https://docs.justlend.org/developers/abis/jtoken.json) · [jTRX mint](https://docs.justlend.org/developers/abis/jtrx-mint.json) · [jTRX repay](https://docs.justlend.org/developers/abis/jtrx-repay.json) · [Comptroller](https://docs.justlend.org/developers/abis/comptroller.json) · [Interest Rate Model](https://docs.justlend.org/developers/abis/interest-rate-model.json) · [Price Oracle](https://docs.justlend.org/developers/abis/price-oracle.json) · [GovernorAlpha](https://docs.justlend.org/developers/abis/governor-alpha.json) · [JST voting / Poly](https://docs.justlend.org/developers/abis/poly.json) · [sTRX](https://docs.justlend.org/developers/abis/strx.json) · [WJST](https://docs.justlend.org/developers/abis/wjst.json) · [TRC20](https://docs.justlend.org/developers/abis/trc20.json) · [Energy Market](https://docs.justlend.org/developers/abis/energy-market.json) · [Energy Rate Model](https://docs.justlend.org/developers/abis/energy-rate-model.json). ## AI-optimized retrieval docs - [AI Docs Index](https://docs.justlend.org/documents/aidocs): Compact RAG-oriented documentation map for agents. - [Source of Truth](https://docs.justlend.org/documents/aidocs/source_of_truth): Which JustLend source to trust for OpenAPI, MCP, contracts, ABIs, and human explanations. - [Market Data for Agents](https://docs.justlend.org/documents/aidocs/market_data): Market list, APY, TVL, utilization, active/legacy status, and jToken metadata. - [Account Position Queries](https://docs.justlend.org/documents/aidocs/account_position): Health factor, borrow limit, supplied/borrowed value, liquidation risk, and rewards. - [Lending Workflows](https://docs.justlend.org/documents/aidocs/supply_borrow_repay_withdraw): Safe supply, borrow, repay, and withdraw workflows. - [sTRX Staking](https://docs.justlend.org/documents/aidocs/strx_staking): Stake, unstake, exchange rate, rewards, and unbonding guidance. - [Energy Rental](https://docs.justlend.org/documents/aidocs/energy_rental): Price estimation, order flow, prepayment, return/cancel guidance. - [MCP Safety Policy](https://docs.justlend.org/documents/aidocs/mcp_safety): Read-only vs write tools, wallet modes, private-key handling, and HITL confirmation. - [Common Questions](https://docs.justlend.org/documents/aidocs/common_questions): English and Chinese user questions mapped to tools and API sources. - [AI Glossary](https://docs.justlend.org/documents/aidocs/glossary): Compact definitions for JustLend / Compound V2 terms. - [MCP Tool Catalog](https://docs.justlend.org/documents/aidocs/mcp_tools): Full generated catalog of all 104 MCP tools with schemas and safety annotations. ## AI Agent integration - [AI / LLMs](https://docs.justlend.org/ai_support/ai_llms): Human-readable directory for `llms.txt`, `llms-full.txt`, OpenAPI, contract JSON, and ABI JSON endpoints. - [JustLend Skills](https://docs.justlend.org/ai_support/justlend_skills) (v1.1.1): GitHub-distributed workflow skills project (**6 modules**) plus a bundled read-only MCP server (**9 query tools**) with versioned `outputSchema`, `structuredContent`, and machine-readable retry errors. Write workflows route to the full MCP server and require confirmation. Clone and run `bash install.sh`; the local identifier `@justlend/justlend-skills` is **not published to npm**. - [CLI and V2 SDK integration guide](https://docs.justlend.org/ai_support/cli_and_sdk): Choose terminal/CI automation or embedded application integration; includes installation, version, output contract, signing, and broadcast safety rules. - [Full MCP Server](https://docs.justlend.org/ai_support/mcp_server) (`@justlend/mcp-server-justlend`, v1.1.3, **104 tools**): Full read/write MCP server for JustLend V1 and V2, including quote-bound energy direct purchase with public payer-history and payer-scoped recovery. Every tool declares `outputSchema`; successful calls expose `{schemaVersion, tool, result}` in `structuredContent` while preserving legacy text. Writes use encrypted agent-wallet; the legacy unauthenticated browser bridge is disabled. Source: . - [MCP machine-readable tool catalog](https://github.com/justlend/mcp-server-justlend/blob/main/mcp-api-list.md) (`mcp-api-list.md`): Offline-loadable list of all 104 tools with input/output schemas, side-effect class (read-only vs on-chain write/destructive), and HITL guidance. Generated from source, so it never drifts from the tool definitions. - [MCP source ABIs and network config](https://github.com/justlend/mcp-server-justlend): Upstream TypeScript definitions used to generate the docs JSON ABI and address files. ## API endpoints (read-only HTTP API) Base URL: `https://openapi.just.network`. Schema in [justlend_apis.yaml](https://docs.justlend.org/developers/apis/justlend_apis.yaml). Endpoints include: - `GET /lend/jtoken` — All jToken markets with supply/borrow APY, mining rewards, TVL (aggregate for protocol-level totals). - `GET /lend/jtoken` — Fetch the full market list and select `data.tokenList` by jToken `address` client-side; an `address` query parameter is not a supported server filter. - `GET /lend/account?addresses={address}` — Account SBM positions, health factor, rewards (paginated). - `GET /mining/reward?address={jToken}` · `GET /mining/apy` · `GET /mining/distributions?addr={address}` — Mining reward config / per-market APY / distribution snapshots. Refer to the OpenAPI spec for the full endpoint list, request parameters, response schemas, units, and error responses. ## Resources - [Common Pitfalls (developer reference)](https://docs.justlend.org/developers/common_pitfalls): The 10 most common foot-guns when integrating with JustLend — USDT-style `approve()` race, `enterMarkets` requirement, `mint()` overload between jTRX and jTRC20, `redeem` vs `redeemUnderlying`, 8-decimal jToken vs underlying decimals, `liquidateBorrow` close-factor cap, `uint256(-1)` repay sentinel, TRON energy/bandwidth model, oracle freshness, legacy-market policy. - [Glossary](https://docs.justlend.org/resources/glossary): Precise definitions and on-chain encoding of mantissa, kink, utilization, sun, borrow index, collateral / close / reserve factor, exchange rate, liquidation incentive, and other JustLend / Compound V2 terms. - [Audits — Supply & Borrow (PDF)](https://justlend.org/docs/justlend_audit_en.pdf) - [Audits — Staked TRX (PDF)](https://justlend.org/docs/justlend_strx_audit_en.pdf) - [Risk Warning](https://docs.justlend.org/resources/risk_warning) - [Wallet Integration Cooperation](https://docs.justlend.org/resources/community/wallet_integration_cooperation) - [Community Links](https://docs.justlend.org/resources/community/links) - [Terms of Service (PDF)](https://justlend.org/docs/JustLend_Terms_of_Use_en.pdf) - [Privacy Policy (PDF)](https://justlend.org/docs/JustLend_Privacy_Policy_en.pdf) ## Notes for AI agents - [ABI scope and provenance](https://docs.justlend.org/developers/abis/#scope-and-provenance) — interface targets, verification dates, compiler/source distinctions and coverage limits. [Address verification](https://docs.justlend.org/developers/deployed_contracts/#address-verification) explains the Mainnet pointer getters. - **Networks**: Rendered contract tables are **TRON Mainnet** unless a section says otherwise. Use Nile testnet (`NETWORK=nile`) for testing, and fetch [`/developers/contracts.json`](https://docs.justlend.org/developers/contracts.json) for Mainnet + Nile addresses. - **Address formats**: `contracts.json` includes Base58, EVM `0x` hex, and TRON-internal `41` hex. Rendered tables may show Base58 only. - **Precision**: jToken balances are returned in jToken units (8 decimals). Underlying token amounts use that token's own decimals (TRX = 6, USDT = 6, USDC = 6, BTC = 8, ETH = 18, etc.). Always check the underlying token's `decimals()` before submitting transactions. - **Rate limits**: The public OpenAPI service is unauthenticated and may throttle abusive clients. Keep `pageSize <= 1000`, cache market metadata, avoid tight polling loops, and retry `429` / `5xx` with exponential backoff. - **Recommended source-of-truth priority**: (1) OpenAPI/live API for public HTTP data → (2) MCP for schema-discoverable agent workflows → (3) CLI for deterministic terminal automation → (4) V2 Utils for embedded application code → (5) rendered docs for concepts. The HTML docs are for human reading; for programmatic use prefer the OpenAPI spec and MCP server. - **Read-only vs. write**: The HTTP API and bundled JustLend Skills MCP server are read-only. The full MCP server, CLI, and V2 Utils expose write paths. Inspect side-effect metadata or command classification, simulate first, and require explicit human intent before signing or broadcasting. ## Optional - [llms-full.txt](https://docs.justlend.org/llms-full.txt) — Condensed full-text snapshot of the documentation for single-fetch LLM consumption.