Skip to main content

Anchor

Welcome to your first Solana Anchor smart contract experience using the Código platform.


1️⃣ Create a Workspace

Step 1: Open Código Hub
Step 2: Click the green NEW button to create a new workspace.
You’ll be asked to enter:

  • A workspace name (e.g. my-first-workspace)
  • A smart contract name (e.g. counter)

Step 3: Wait a few seconds while Código initializes everything for you.

Workspace creation

2️⃣ Prompt Your Idea

Once inside your workspace, tell the AI what you want to build.

generate a counter solana program with create_counter and increment instructions
Prompt counter

Código will respond with a full plan and architecture.
If you're happy with the proposed structure, confirm and choose between native or Anchor framework :

yes generate this code with anchor
Anchor selection

Once selected, your program is ready with all the files generated! 🎉

counter

3️⃣ Implement the Instructions

The generated files come with scaffolding, but the instruction logic is left for you to implement.

implement the file create_counter.rs

Review the AI implementation by clicking on the Review button.
If it looks good, just click Apply and it will automatically update your file code with the new changes.

Repeat this process for each instruction file.

counter

4️⃣ Build & Deploy

Once all your logic is implemented, build and deploy your smart contract:

Open a terminal and do :

cd <repo_name>
anchor build
anchor deploy

✅ Código already sets up a local solana-test-validator and provides you with a preconfigured wallet keypair.


✅ Next Steps

🎉 Congratulations! You just built and deployed your first Solana program with Código.

To recap, you've learned how to:

  • Set up a new project with zero config
  • Prompt the AI to generate your smart contract
  • Customize business logic instruction by instruction
  • Build and deploy using the terminal

🚀 Ready to Go Further?

👉 Browse Features
👉 Check Guides and Examples