- Generated and verified a Solidity smart contract for the bank logic.
- Deployed the contract to your live appchain.
- Scaffolded and connected a React frontend.
- Verified the on-chain functionality.
Your Project Structure
The following steps will instruct your AI agent to create these directories inside yourmy-initia-project folder:
Project Structure
Prerequisite: Ensure you have an EVM-compatible appchain running
locally. If you haven’t launched one yet, complete the
Step-by-Step Guide first.
Readiness Check
Before you start, verify that your local infrastructure is healthy. Prompt:Step 1: Create and Unit Test the Smart Contract
Instruct your AI agent to create the Solidity contract using theinitia-appchain-dev skill. Your AI agent will generate the contract and
automatically run unit tests to ensure the logic is sound.
Example Prompt:
minibank project and confirm that the tests
(likely using Foundry or Hardhat) pass successfully.
Manual Approach: The Solidity Contract
Manual Approach: The Solidity Contract
Initialize a Foundry project first:If you prefer to create the contract manually, here is the Solidity code your AI agent would generate. Save this as MiniBank.sol in your Run your tests:
Initialize Foundry Project
minibank/src directory.src/MiniBank.sol
Unit Testing with Foundry
To verify your contract’s logic, create a test file namedMiniBank.t.sol in
the test directory.test/MiniBank.t.sol
Run Foundry Tests
Step 2: Deploy to your Appchain
Now that the logic is verified, build and publish the contract to your live appchain using the Gas Station account. Prompt:Manual Approach: Deploy via CLI
Manual Approach: Deploy via CLI
First, compile your contract and extract the hex bytecode:Then deploy the binary. Find your Chain ID first if you don’t know it:Now deploy:Retrieve your contract address: The output will provide a
Compile And Extract Bytecode
Get Chain ID
Deploy Contract
txhash. Wait a
few seconds for indexing, then find your contract address:Get Contract Address
Step 3: Smoke Test the Deployed Contract On-Chain
Before moving to frontend integration, smoke test the deployed contract directly on chain from the CLI. This isolates contract-level issues before UI work. Example Prompt:Manual Approach: On-Chain Interaction
Manual Approach: On-Chain Interaction
Call Query Call Query
deposit() and send exactly 1 token in base units (1e18 wei).Deposit 1 Token
myBalance() as your sender account so msg.sender resolves correctly.Query Balance
withdraw(uint256) with 0.5 token in base units (5e17 wei).Withdraw 0.5 Tokens
myBalance() again to confirm the post-withdraw balance.Query Balance Again
Step 4: Create a Frontend
Let’s create a simple UI to interact with our bank. 1. Scaffold the Frontend:Manual Approach: Scaffold and Connect
Manual Approach: Scaffold and Connect
If you prefer to set up the frontend manually, follow these steps:1. Create the Project and Install Dependencies:2. Verify 3. Configure Vite Polyfills: Update 4. Gather Runtime Values for Frontend Config: Before creating 5. Create 6. Set up Providers in 7. Create the 8. Create the
Create React App
index.html: Vite scaffolding already creates index.html.
Confirm it has this minimal structure in the root of your
minibank-frontend directory:index.html
vite.config.js to include the Node
polyfills:vite.config.js
.env,
collect the values you will use:Gather Frontend Values
.env from Runtime Values:Create Frontend Env
main.jsx:src/main.jsx
App.jsx Layout:src/App.jsx
Bank.jsx Component: Create src/Bank.jsx and add the
contract interaction logic.src/Bank.jsx
Step 5: Wallet Funding and UI Verification
Ask your AI agent to fund your browser wallet, then verify frontend behavior manually in the browser:- Start the frontend:
Start Vite Dev Server
- Open your browser wallet and copy your address (
init1...). - Give this prompt to your AI agent, replacing
<YOUR_WALLET_ADDRESS>with the address you just copied:
- Connect your wallet in
minibank-frontend. - Test the full flow by depositing and withdrawing from the UI, then confirm the displayed savings state updates correctly after each action.
⚡ Power-Up: Interwoven Bridge
Adding bridge support allows users to bring liquidity from the broader Initia ecosystem into your rollup. This transforms your appchain from an isolated sandbox into a connected part of the Interwoven Stack, providing users with a seamless UI to bridge tokens into your application for use.Step 6: Update the Frontend
TheuseInterwovenKit() hook provides openBridge, which opens the bridge
modal for moving assets between chains.
Example Prompt:
Manual Approach: Bridge Integration
Manual Approach: Bridge Integration
To implement this, update your
src/Bank.jsx to include the bridge logic and
UI:Bridge Logic
Manual Approach: Final Frontend Reference
Manual Approach: Final Frontend Reference
This reference combines:src/main.jsxsrc/App.jsxsrc/Bank.jsxThis reference assumes:
- runtime config from
.env, - InterwovenKit provider wiring in
main.jsx, - wallet connect/display in
App.jsx, and - live MiniBank interactions plus bridge entry point in
Bank.jsx.
.env
src/main.jsx
src/App.jsx
src/Bank.jsx
- the deployed contract address is stored in
.envasVITE_MINIBANK_CONTRACT, senderinMsgCalluses bech32 (initiaAddress) lowercased,- EVM balance reads use JSON-RPC
eth_callwith afromhex address, and - the Vite dev server is restarted after any
.envchange.
Power-Up Verification
- Connect your wallet in
minibank-frontend. - Click
Bridge Funds. - Confirm the Interwoven Bridge modal opens.