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 Aptos Testnet demo in one shot.

Why Aptos Testnet and not mainnet?

Aptos Testnet runs the same Move VM, the same Aptos Explorer and the same Petra wallet as mainnet — but it's funded by a free faucet. Every module you publish ships its source, so judges can read it without a verification step, and you never spend real APT. Move to mainnet after the hackathon by swapping the network in your config.

The recipe

recipe
# 1. In your Lovable project, add four secrets (Settings -> Secrets):
APTOS_DEPLOYER_PRIVATE_KEY=0x...   # Petra "classic" account, network = Testnet
APTOS_RPC_URL=https://aptos-testnet.g.alchemy.com/v2/<key>/v1
PRIVY_APP_ID=...
PRIVY_APP_SECRET=...               # server-side raw signing for Aptos
PINATA_JWT=eyJhbGciOi...           # only if the demo pins media

# 2. Fund the deployer account with testnet APT:
open https://aptos.dev/network/faucet

# 3. Copy a mega-prompt from this repo into Lovable. One paste:
#    - scaffolds the React app
#    - writes the Move module (with hackathon credit in the doc comment)
#    - publishes it to Aptos Testnet with the Aptos CLI
#    - wires Privy Google login + server-side Aptos signing
#    - pins generated assets to IPFS via Pinata
#    - exposes the module address + Aptos Explorer link in the UI

# 4. Open the live Aptos Explorer link. Your demo is provably onchain.

1. The contract — credit baked in

Every Move module published from a Creative Blockchain prompt MUST carry the hackathon credit in its doc comment — Aptos publishes source with bytecode, so provenance is readable onchain.

move/provenance/sources/provenance.move
// move/provenance/sources/provenance.move — credit lives in the published source
/// Provenance
/// Built during the Creative AI & Quantum Hackathon
/// organised by StreetKode Fam during Indian Krump Festival 14
module app::provenance {
    use std::signer;
    use std::string::String;
    use aptos_framework::event;
    use aptos_framework::timestamp;

    #[event]
    struct Logged has drop, store { author: address, cid: String, at: u64 }

    public entry fun log(author: &signer, cid: String) {
        event::emit(Logged {
            author: signer::address_of(author),
            cid,
            at: timestamp::now_seconds(),
        });
    }
}

2. Publish to Aptos Testnet

aptos move publish
# publish with the Aptos CLI — no Hardhat, no ABI, no verify step
# reads APTOS_DEPLOYER_PRIVATE_KEY (Petra "classic" account, network = Testnet)
aptos init --network testnet --private-key $APTOS_DEPLOYER_PRIVATE_KEY

aptos move publish \
  --package-dir move/provenance \
  --named-addresses app=<deployer-address>

# Move source is published alongside the bytecode — it is readable at
# https://explorer.aptoslabs.com/account/<address>/modules?network=testnet

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 (Aptos embedded wallet)
import { PrivyProvider } from "@privy-io/react-auth";

<PrivyProvider
  appId={import.meta.env.VITE_PRIVY_APP_ID}
  config={{ loginMethods: ["google", "email"], appearance: { theme: "dark" } }}
>
  <App />
</PrivyProvider>

// Aptos is a Tier-2 chain in Privy: the browser SDK cannot sign it.
// Signing happens server-side with @privy-io/node raw signing —
// build the tx, hash it with generateSigningMessageForTransaction(),
// rawSign it with the user's wallet id, submit with @aptos-labs/ts-sdk.

Hackathon rules of thumb

  • · One mega-prompt = one build message. Don't iterate the architecture, iterate the UI.
  • · Always show the live Aptos Explorer link in the UI — that's your proof.
  • · Use Privy Google sign-in so judges don't need Petra installed to try the demo.
  • · 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.