build strategy · onchain

Real onchain, five secrets, one build.

Every mega-prompt in this repo uses the same pattern, because it's the only pattern that lets a Lovable account ship a verifiable Monad Testnet demo in one shot.

Why Monad Testnet?

Monad is a high-throughput EVM chain — same Solidity, same wallets, same Etherscan-family explorer (MonadScan). Every contract you deploy is publicly inspectable on MonadExplorer and MonadScan, but you never spend real money — and because Privy natively sponsors gas on Monad, your signed-in users transact without ever touching MON.

The recipe

recipe
# 1. In your Lovable project, add five secrets (Settings -> Secrets):
METAMASK_PRIVATE_KEY=0x...
ETHERSCAN_API_KEY=...            # Etherscan v2 key — covers MonadScan too
PRIVY_APP_ID=...
PINATA_JWT=eyJhbGciOi...
MONAD_RPC_URL=https://testnet-rpc.monad.xyz   # default; swap for a provider endpoint if you get throttled

# 2. Fund the MetaMask deployer account on Monad Testnet (deploy only — user gas is sponsored):
open https://faucet.monad.xyz

# 3. One-time Privy dashboard step (Gas sponsorship → App pays):
#    - Add "Monad Testnet" to the sponsored chains list
#    - Toggle "Allow transactions from the client" ON

# 4. Copy a mega-prompt from this repo into Lovable. One paste:
#    - scaffolds the React app
#    - writes the Solidity contract (with hackathon credit in NatSpec)
#    - deploys to Monad Testnet and verifies on MonadScan + MonadVision (Sourcify)
#    - wires Privy social login; runtime txs are sponsored — users never touch MON
#    - pins generated assets to IPFS via Pinata
#    - exposes the contract address + MonadExplorer link in the UI

# 5. Open the live MonadExplorer link. Your demo is provably onchain.

1. The contract — credit baked in

Every Solidity file deployed from a Creative Blockchain prompt MUST carry the hackathon credit in NatSpec, so provenance lives onchain alongside the bytecode.

contracts/Provenance.sol
// contracts/Provenance.sol — every contract carries the hackathon credit in NatSpec
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title Provenance
/// @notice Built during the Creative AI & Quantum Hackathon
/// @notice organised by StreetKode Fam during Indian Krump Festival 14
contract Provenance {
    event Logged(address indexed author, string cid, uint256 at);

    function log(string calldata cid) external {
        emit Logged(msg.sender, cid, block.timestamp);
    }
}

2. Deploy + verify on MonadScan

scripts/deploy.ts
// scripts/deploy.ts — reads METAMASK_PRIVATE_KEY + ETHERSCAN_API_KEY from process.env
import { ethers, run } from "hardhat";

async function main() {
  const F = await ethers.getContractFactory("Provenance");
  const c = await F.deploy();
  await c.waitForDeployment();
  const addr = await c.getAddress();
  console.log("deployed:", addr);

  // verify on MonadScan (Etherscan v2) + Sourcify (MonadVision)
  await run("verify:verify", { address: addr, constructorArguments: [] });
}
main();

3. Pin assets to IPFS via Pinata

src/lib/pinata.ts
// src/lib/pinata.ts — pin a Blob to IPFS via Pinata JWT
export async function pinToIPFS(file: Blob, name = "artifact") {
  const fd = new FormData();
  fd.append("file", file, name);
  const r = await fetch("https://api.pinata.cloud/pinning/pinFileToIPFS", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.PINATA_JWT}` },
    body: fd,
  });
  const { IpfsHash } = await r.json();
  return IpfsHash as string; // the CID
}

4. Sign in with Google via Privy

src/main.tsx
// src/main.tsx — Privy social login on Monad Testnet (sponsored gas)
import { PrivyProvider } from "@privy-io/react-auth";
import { defineChain } from "viem";

const monadTestnet = defineChain({
  id: 10143,
  name: "Monad Testnet",
  nativeCurrency: { name: "Monad", symbol: "MON", decimals: 18 },
  rpcUrls: { default: { http: ["https://testnet-rpc.monad.xyz"] } },
  blockExplorers: { default: { name: "MonadExplorer", url: "https://testnet.monadexplorer.com" } },
});

<PrivyProvider
  appId={import.meta.env.VITE_PRIVY_APP_ID}
  config={{
    loginMethods: ["google", "email"],
    embeddedWallets: { ethereum: { createOnLogin: "users-without-wallets" } },
    defaultChain: monadTestnet,
    supportedChains: [monadTestnet],
  }}
>
  <App />
</PrivyProvider>

// Every send passes { address, sponsor: true }. One-time dashboard step:
// Privy dashboard → Gas sponsorship → App pays → add "Monad Testnet" →
// toggle "Allow transactions from the client" ON.

Hackathon rules of thumb

  • · One mega-prompt = one build message. Don't iterate the architecture, iterate the UI.
  • · Always show the live MonadExplorer link in the UI — that's your proof.
  • · Privy natively sponsors gas on Monad — flip the dashboard toggle (Gas sponsorship → App pays → Monad Testnet + "Allow transactions from the client") and users transact without touching MON.
  • · Pin every user-generated asset to IPFS the moment it's created.
  • · Add a "Built during the Creative AI & Quantum Hackathon — StreetKode Fam · Indian Krump Festival 14" line to your footer.