Join our community of builders on Discord!

Using Lightchain Studio

Everything Lightchain in Studio is in four places:
  • The status bar (bottom left): your active account, your credits and the network. Click it for the wallet menu.
  • The Lightchain side bar (right): Deployed Programs above, the Lightchain AI panel below. It opens by itself the first time you start Studio.
  • The Command Palette: every command below is under the Lightchain or Lightchain Wallet category.
  • The Start page, shown when no editor is open: New Project, Open Folder, Clone Repository, recent projects, and links such as the testnet faucet.

Wallet

Click the status bar item (it reads Connect Wallet until you have an account) to open the wallet menu.

Local accounts

ActionWhat happens
Create AccountGenerates a new private key.
Import Private Key64 hex characters, with or without 0x.
Import Recovery Phrase12, 15, 18, 21 or 24 words. You pick one of the first five accounts (m/44'/60'/0'/0/0 to /4, the order MetaMask uses). Only that account's key is stored, never the phrase.
Export Private Key…After a warning, copies the key to your clipboard.
Export to Foundry Keystore…Writes an encrypted keystore (Web3 Secret Storage v3, the format cast wallet import writes) to ~/.foundry/keystores/<name>, protected by a password of at least 8 characters. Use it from any terminal with forge script … --account <name>.
Remove Account…Deletes the key from this machine.
Private keys are kept in the IDE's secret storage, which is encrypted with your operating system's key store (the Keychain on macOS). Account names and addresses are stored separately and are not secret. A key never reaches a web view or forge.

Browser wallet

Connect Browser Wallet opens a Lightchain Studio page in your default browser, served by Studio itself from your own machine. Pick your wallet there (MetaMask, Rabby, Coinbase Wallet, Brave Wallet, or any wallet extension that announces itself). No WalletConnect project ID is involved.
  • Keep that tab open. Every request from Studio (a sign-in, a top-up, a deploy, a contract call) appears in the tab's Activity list and in your wallet. If the tab is closed when a request comes in, Studio opens it again.
  • Before sending a transaction, the page switches your wallet to the Lightchain network, and adds the network to the wallet if it is missing.
  • The wallet must be on the account Studio has connected. If you switched accounts in the wallet, the page asks you to switch back.
  • A request you don't answer within 5 minutes fails.
  • Disconnect Wallet in the wallet menu forgets the browser wallet.
The page is served from http://localhost:3000 when nothing else is using port 3000. Otherwise it uses http://127.0.0.1 on a port Studio picks once and keeps, so your wallet's site permissions survive restarts.

Mainnet

On mainnet, every transaction Studio sends (from either kind of account) first shows a confirmation with what it does, the sending account, the value and the estimated network fee. Nothing is sent until you click Send on Mainnet.

Credits

Lightchain AI is paid from your credits: your prepaid LCAI balance in the network's JobRegistry contract. It is the same balance the Lightchain AI chat and the Developer API spend from.
ActionTransaction
Top Up CreditsJobRegistry.deposit() with the LCAI amount you enter.
Withdraw CreditsJobRegistry.withdrawBalance(amount).
Allow (in the Lightchain AI panel, once)JobRegistry.setDelegateAuthorization(delegate, true) if not already set, then JobRegistry.setDelegateAllowance(delegate, balance).
delegate is the address the Lightchain AI server submits jobs from; Studio reads it from the server. The allowance is set to your prepaid balance at the moment you click Allow. It caps what the server can spend from your credits, and it does not grow by itself when you top up later. Withdrawing never needs the server: it is your wallet calling the contract. The status bar shows your credits; its tooltip also shows your wallet's LCAI balance.

Lightchain AI

The Lightchain AI panel is a coding agent. It reads your project, proposes file changes and commands, and you approve each one. Every reply from the model is one inference job on the Lightchain network.

Before your first prompt

  • Open a folder, and trust it when Studio asks: the agent does not run in Restricted Mode.
  • Connect a wallet and top up credits. The panel won't send a prompt while your credits are below 0.02 LCAI. That is the lowest fee per job; the actual fee depends on the model (set per model in AIConfig, for example 0.02 LCAI for llama3-8b and 0.15 LCAI for llama3-70b).
  • Sign-in. The first prompt signs you in to Lightchain AI with a Sign-In with Ethereum message. It sends no transaction and costs no gas. The sign-in lasts one hour and is shared by every chat; a local account signs by itself, a browser wallet asks you.
  • Allow. If your wallet has not yet authorized the Lightchain AI server, the panel shows an Allow card. Approving it sends the transactions in Credits and then sends your prompt.
On testnet the panel can also claim test LCAI from the faucet for the active account.

Models

The model menu lists the coding models the network serves right now, with a dot for each model's worker availability: qwen3-coder-next, glm-4.7-flash, llama3-70b, qwen3.6:27b, deepseek-r1:32b, mistral-small:24b, gemma4:26b, llama3-8b Studio keeps the model you picked as long as the network serves it. Until you pick one, it takes the first available model in the order above. Other models the network serves (very small models, vision, speech and embedding models) are not offered, because they cannot drive the agent's tools reliably. Changing the model starts a new chat, because a Lightchain session is bound to one model.

What the agent sees

Each prompt carries context from the editor:
  • the file you are looking at, and your selection in it;
  • files you mention with @ (up to 8);
  • the errors and warnings in those files (up to 20).
Files are sent line-numbered, up to 12,000 characters each and 30,000 in total; the agent reads the rest itself if it needs it.

What the agent can do

ToolApproval
list_dir, read_file, searchNone: reading and searching the project.
forge_buildNone: runs forge build.
write_fileYou approve a diff.
run_commandYou approve the exact command line, which then runs in the project root.
The file tools only reach files inside the project folder, symbolic links included. Every file change is a complete new version of the file, shown to you as a diff:
  • Accept (⌘/Ctrl+Enter) or Reject (⌘/Ctrl+Backspace) the whole proposal.
  • When a proposal has more than one change, each change has a Keep toggle. Switch some off and Accept: only the kept changes are written, and the agent is told which ones you declined.
  • Click the file name to open the proposal in the full diff editor.
When the agent has written Solidity files and finishes, Studio runs forge build. If the build fails, it gives the errors back to the agent to fix, up to two rounds. The agent takes at most 12 steps per request, and stops early after 3 steps in a row in which every tool call failed, so a confused model doesn't keep spending credits.

Undo

After a turn that changed files, the panel shows the files with an Undo button. Undo puts every file back the way it was before that turn and moves files the turn created to the trash. If you edited a file after the agent wrote it, Studio asks before discarding your edits.

Chats

Chats are saved per project, up to 30, and shown again when you reopen Studio; older chats are under History. Continuing a saved chat starts a new session with a worker, and the first prompt carries a short recap of the chat's last turns.

When a worker stalls

  • If no answer starts within 45 seconds of the job being submitted, the panel offers to send the same prompt to up to three other models with free workers, or to keep waiting.
  • If a worker fails or stops answering, Studio retries once by itself, on another model with free workers or on a new session (and usually a new worker) for the same model.
  • If the network fails to submit the job on chain, Studio tries once more. If that fails too, nothing is charged and you can send the prompt again.
A job whose worker accepted it and never answered keeps its fee in escrow until JobRegistry lets it be settled: 48 hours after the job's deadline (the AIConfig resolution timeout, 172,800 s on both networks today). Studio remembers such jobs; once they can be settled, the panel offers to reclaim their fees, with one settleStuckJob(jobId) transaction per job. The fee goes back to your credits.

In the editor

ActionHowWhat it does
Ask Lightchain AI about Selection⌘L / Ctrl+L, or the editor context menuOpens the panel with the selection attached. Nothing is sent until you type and send.
Edit with Lightchain AI⌘I / Ctrl+I, or the editor context menuRewrites the selection (or the current line) from an instruction you type. The new code is applied and highlighted; choose Keep or Undo. If the file changes while the model works, the edit is not applied.
Fix with Lightchain AIThe lightbulb on an error or warningSends the problems and the code around them to the panel.
Ask Lightchain AI about thisThe lightbulb on a selectionSame as Ask about Selection.
Submission failures and worker error reports (job id and error code, with the encrypted payload left out) are logged to the Lightchain AI output channel.

Foundry

The build commands need a Foundry project: a folder with foundry.toml. Studio finds forge at the path in lightchain.foundry.path, else ~/.foundry/bin/forge, else on your PATH. If it isn't installed, Studio offers to install Foundry with foundryup.
CommandRuns
Lightchain: Buildforge build
Lightchain: Testforge test -vvv
Lightchain: Deploy Scriptforge script on a *.s.sol script (see below)
Lightchain: Deploy Contract…Deploys one contract without a script (see below)
Compiler errors and warnings from Build and Test appear in the Problems panel.

Deploy Script

Run it from the Command Palette, from the deploy button in the title bar of an open *.s.sol file, or from the Explorer context menu on one. Without a script open, Studio lets you pick one from script/. It shows the network and the signing account, then offers Deploy or Deploy & Verify, and runs:
CodeBASH
Forge never gets a private key. Its RPC is a local proxy started for this deploy, and every transaction forge sends is signed by your active Studio account: by the IDE for a local account, in your wallet for a browser wallet. See Architecture. To deploy from a terminal instead, export the account to a Foundry keystore and pass --account <name>.

Deploy Contract

Deploy Contract… (also the rocket in the Deployed Programs header, and Deploy above each contract in a Solidity file under src/) builds the project, lists the deployable contracts compiled from src/, asks for each constructor argument (arrays and tuples as JSON) and for an LCAI value if the constructor is payable, confirms, and sends the deployment from your active account. The new contract is added to Deployed Programs, and you can open Interact or Lightscan from the result.

New Lightchain Project

New Lightchain Project (Start page or Command Palette) asks for a template, a parent folder and a name:
TemplateContract
StarterCounter: a minimal counter.
ERC-20 tokenToken: the deployer receives the initial supply.
NFT collection (ERC-721)Collection: the owner mints, with a base URI for metadata.
Two-player coin flipCoinFlip: a 50/50 game between two players with no house cut (commit–reveal).
EscrowEscrow: a buyer funds a payment that an arbiter releases to the seller or refunds.
Each template is self-contained Solidity (pragma solidity ^0.8.24) with src/, a test in test/ and script/Deploy.s.sol. Studio also writes a README.md, a .gitignore, and a foundry.toml with both networks set up:
CodeTOML
When forge is installed, Studio runs git init and forge install foundry-rs/forge-std in the new project, then opens it.

Deployed Programs

The Deployed Programs view lists contracts on the current network, for the open project. It merges three sources:
SourceWhere it comes from
Foundry deploymentbroadcast/**/<chainId>/run-latest.json: every contract created by your scripts, with its name. Updates as soon as a broadcast is written.
Deployer addressContracts created by the deployer address, from Lightscan. The deployer is your active account unless you set another with Set Deployer Address.
Added manuallyAdd Contract (+ in the header), and contracts deployed with Deploy Contract.
A filled check means the contract's address appears somewhere in your project's files (folders in lightchain.programs.scanExclude are skipped); expand it to jump to each place. An empty circle means it isn't referenced. On each contract: Interact, Open in Lightscan, Copy Address, Find in Project, and Remove for contracts you added by hand. The header has Deploy Contract, the network switch, Add Contract and Refresh; its menu has Deploy Script and Set Deployer Address.

Switching networks

Use the switch in the Deployed Programs header, or Lightchain: Switch to Mainnet / Switch to Testnet. The choice is saved per project and applies to the whole IDE: the status bar, credits, Lightchain AI, deploys and Deployed Programs.

Interact

Interact opens a tab with the contract's functions, split into Read and Write. Studio finds the ABI in this order: a Foundry artifact named like the contract; a Foundry artifact whose runtime bytecode matches the code on chain; the verified source on Lightscan; otherwise it asks you for an ABI file (a JSON array, or a Foundry artifact).
  • Reads are free calls. Reads without arguments show their value as soon as the tab opens.
  • Writes are simulated first, so a revert shows its reason before anything is signed. Then a local account confirms in a dialog (on mainnet, in the mainnet confirmation), and a browser wallet confirms in the wallet. After a write, the reads refresh.

Extensions

The Extensions view has a Lightchain Marketplace section: Lightchain's own extensions (Lightchain Studio, Lightchain Themes) and recommended ones (Solidity by Nomic Foundation, Solidity by Juan Blanco, Even Better TOML). Every other extension comes from Open VSX. Extensions in the AI and Chat categories, and other known AI assistants, are left out of search results unless you search for their exact ID.

Commands

CommandCategory
Wallet · Top Up Credits · Withdraw CreditsLightchain
Create Account · Import Private Key · Import Recovery Phrase · Connect Browser Wallet · Disconnect Wallet · Select Account · Copy Active Address · Export Private Key · Export to Foundry Keystore · Remove Account · Open Wallet PageLightchain Wallet
Build · Test · Deploy Script · Deploy Contract…Lightchain
New Lightchain Project · Start PageLightchain
Switch to Mainnet · Switch to TestnetLightchain
Refresh Deployed Programs · Add Contract · Set Deployer AddressLightchain
Ask Lightchain AI about Selection (⌘/Ctrl+L) · Edit with Lightchain AI (⌘/Ctrl+I)Lightchain
Refresh Lightchain MarketplaceLightchain

Settings

SettingDefaultWhat it does
lightchain.foundry.path""Path to forge. Empty: ~/.foundry/bin/forge, else PATH.
lightchain.programs.scanExcludenode_modules, .git, out, cache, broadcast, lib, artifacts, distGlobs skipped when checking which deployed programs your project references.
lightchain.startPage.showOnStartuptrueShow the Start page when no editor is open at startup.
lightchain.marketplace.catalogUrl""A JSON catalog for the Lightchain Marketplace section. Empty: the catalog built into Studio.