ChainFeedback Loop
Collect and verify editorial feedback on video edits onchain to improve collaboration.
Rootstock testnet smart contract· onchain logic
Section · Onchain
full primer →The primitive.
The onchain primitive runs at the right moment in the flow and surfaces a clear, verifiable result that videographers can act on without web3 jargon.
Why this primitiveRootstock testnet contracts provide permanent, auditable records of feedback and approvals.
Kernel
a Solidity contract deployed to Rootstock testnet via MetaMask private key, then verified on Rootstock Explorer
Drives the UI as
a 'verified onchain' badge with the live contract address and an Rootstock Explorer link
Required keys.
METAMASK_PRIVATE_KEY
Exported from MetaMask. Fund on Rootstock testnet via the Google Cloud faucet.
open ↗ROOTSTOCK_TESTNET_RPC_URL
Alchemy Rootstock testnet HTTPS endpoint. Create a free app → copy the HTTPS URL.
open ↗Add these in your Lovable project under Settings → Secrets before pasting the prompt below.
Appendix · Mega-prompt
The build prompt.
budget · 1 message
Paste into a fresh Lovable project. Make sure all five secrets above are set first. read the build strategy →
Build "ChainFeedback Loop" in ONE Lovable message. Single-page demo.
CONCEPT
Collect and verify editorial feedback on video edits onchain to improve collaboration.
Discipline: Videography & Film (editorial feedback).
Onchain primitive: Rootstock testnet smart contract. Why this primitive: Rootstock testnet contracts provide permanent, auditable records of feedback and approvals.
5-CREDIT BUDGET (HARD LIMIT):
- ONE single-page app. No router, no Lovable Cloud, no database, no auth flows beyond Privy drop-in.
- ONE Solidity contract, <=80 lines, deployed to Rootstock testnet, verified on Rootstock Explorer.
- Privy is always the auth + sponsored-tx layer (Google login, embedded wallet).
- Pinata/IPFS only if the idea genuinely needs to store a file or metadata.
- At most ONE AI call per user action (use Lovable AI Gateway with LOVABLE_API_KEY if AI is part of the idea).
- Skip tests, skip CI, skip docs pages. Ship the demo, nothing else.
STACK
- React + Vite single page (the index route).
- SSR-safe Privy mount is mandatory. Never import @privy-io/react-auth at
module scope of a route file — it crashes SSR. Use
lazy(() => import('./privy-client-entry')) inside <ClientOnly> + <Suspense>,
and put <PrivyProvider> only inside privy-client-entry.tsx.
- PrivyProvider config (do NOT stub defaultChain as { id, name } — omit it
or pass viem's `rootstock testnet`; chainId is passed per-call):
<PrivyProvider appId={import.meta.env.VITE_PRIVY_APP_ID}
config={{ loginMethods:['google','email'],
embeddedWallets:{ ethereum:{ createOnLogin:'users-without-wallets' } },
appearance:{ theme:'dark' } }}>
- Read the embedded wallet from useWallets, not user.wallet:
const embedded = wallets.find(w => w.walletClientType === 'privy');
- Every send goes through Privy `useSendTransaction` with BOTH `address`
and `sponsor`, wrapped in a 45s Promise.race timeout whose reject message
names the exact dashboard toggles:
await Promise.race([
sendTransaction(
{ to, data, chainId: 31 },
{ address: embedded.address, sponsor: true }
),
new Promise((_, r) => setTimeout(() => r(new Error(
"Privy sendTransaction timed out after 45s. Enable Gas sponsorship -> App pays -> Rootstock testnet -> Allow transactions from the client."
)), 45_000)),
]);
- Do NOT pass uiOptions:{ showWalletUIs:false } — it aborts with
"signal is aborted without reason". The approval sheet still shows on
the embedded-EOA path; the fee reads US$0.00.
- Do NOT add ZeroDev / SmartWalletsProvider / a paymaster URL. Native
Privy sponsorship on Rootstock testnet works with the toggles above and nothing else.
- DASHBOARD PREREQUISITE (one-time): Privy dashboard -> Gas sponsorship
-> App pays -> add "Rootstock testnet" -> toggle "Allow transactions
from the client" ON. Without this, sendTransaction hangs silently.
- Hardhat in /contracts (kept outside the Vite bundle). Install
`@nomicfoundation/hardhat-toolbox` AND `@nomicfoundation/hardhat-verify@latest`
(>=3.x — older versions still hit Rootstock Explorer v1 and fail with
"You are using a deprecated V1 endpoint, switch to Rootstock Explorer API V2").
- hardhat.config.cjs MUST use the Rootstock Explorer v2 single-key shape (NOT the per-network map):
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-verify");
module.exports = {
solidity: { version: "0.8.24", settings: { optimizer: { enabled: true, runs: 200 } } },
networks: { rootstock testnet: {
url: process.env.ROOTSTOCK_TESTNET_RPC_URL || "https://ethereum-rootstock testnet-rpc.publicnode.com",
accounts: [process.env.METAMASK_PRIVATE_KEY.startsWith("0x")
? process.env.METAMASK_PRIVATE_KEY : "0x" + process.env.METAMASK_PRIVATE_KEY],
chainId: 31,
} },
rootstock explorer: { apiKey: process.env.ROOTSTOCK_EXPLORER_API_KEY }, // single string, NOT { rootstock testnet: ... }
sourcify: { enabled: false }, // silences the v2.x prompt
};
- Deploy: `npx hardhat run scripts/deploy.cjs --network rootstock testnet`.
- Verify (run RIGHT AFTER deploy, no constructor args for these contracts):
`npx hardhat verify --network rootstock testnet <address>`
On success Rootstock Explorer returns "Successfully verified contract … on the block explorer"
and the source becomes readable at
`https://rootstock testnet.rootstock explorer.io/address/<address>#code`.
- Write the deployed address to `src/data/contract.json` so the UI links to
`https://rootstock testnet.rootstock explorer.io/address/<address>`.
CONTRACT (contracts/ChainFeedbackLoop.sol):
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title ChainFeedbackLoop
/// @notice Collect and verify editorial feedback on video edits onchain to improve collaboration.
/// @notice Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
contract ChainFeedbackLoop {
event Logged(address indexed author, string cid, uint256 at);
/// @notice Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
function log(string calldata cid) external {
emit Logged(msg.sender, cid, block.timestamp);
}
}
```
USER FLOW
1. Land on page -> 'Sign in with Google' (Privy) -> embedded wallet auto-provisioned.
2. User performs a editorial feedback action; the app calls `log(payload)` on the contract via Privy sponsored tx and shows the Rootstock Explorer link as proof.
3. Footer renders: "Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14"
REQUIRED SECRETS (Lovable -> Project Settings -> Secrets):
- METAMASK_PRIVATE_KEY Rootstock testnet deployer key. Fund it: https://faucet.rootstock.io
- ROOTSTOCK_TESTNET_RPC_URL Alchemy Rootstock testnet HTTPS endpoint (https://eth-rootstock testnet.g.alchemy.com/v2/<key>). Create a free app at https://dashboard.alchemy.com/ -> copy the HTTPS URL. Public RPCs throttle/fail under hackathon load — Alchemy is required.
- ROOTSTOCK_EXPLORER_API_KEY For `npx hardhat verify`. Get: https://rootstock explorer.io/myapikey
- PRIVY_APP_ID Google sign-in + sponsored tx. Docs: https://docs.privy.io/llms-full.txt
- PINATA_JWT IPFS uploads (only if app pins media). Docs: https://docs.pinata.cloud/llms-full.txt
CREDIT (must appear in UI footer AND as NatSpec on every deployed contract):
Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
Market sizing.
TAM
$1.1B
video editing software
SAM
$80M
editorial collaboration tools
SOM
$10M
freelance editors and directors
Indicative figures for hackathon pitches — refine with your own research before raising.
Adjacent entries.
video copyright
FrameChain Auth
Verify and timestamp original video frames onchain to prove authentic content ownership instantly.
edit historyEditVersion Ledger
Track and verify every edit version of a video project transparently on the blockchain.
licensed assetsClipLicense Swap
Facilitate secure, onchain licensing and transfer of video clips between creators.
color gradingColorGrade NFT
Create and trade unique onchain color grade presets as NFTs for creative reuse.