Ask Deep Thought any question for 0.042 ETH.
Most of the time, the answer is 42.
Sometimes, it is DON'T PANIC, Bring a Towel, Heart of Gold, Infinite Improbability, or the ultra-rare The Question.
Every question becomes a potential fully on-chain artifact:
- the question is stored onchain
- the answer is derived onchain
- the SVG is generated onchain
- the metadata is generated onchain
- the NFT is minted onchain
This repository is prepared for deployment to Base Sepolia.
- Project Summary
- Core Features
- How The Protocol Works
- Contract Layout
- Repository Layout
- Quick Start
- Environment Variables
- Compile, Test, Coverage
- Deploy To Base Sepolia
- Verification
- Documentation Map
- Roadmap
42 Protocol is a themed onchain experience inspired by The Hitchhiker's Guide to the Galaxy.
The protocol does one thing very clearly:
- a user asks a question
- Deep Thought answers it
- the answer is immortalized as a fully on-chain NFT
The project is intentionally simple at the interaction layer, but richer under the hood:
- deterministic seed generation
- rarity-based answers
- free-question mechanic when
The Questionappears - modular renderer architecture
- ERC-721 NFT issuance per question
- Base64 metadata and Base64 SVG images served entirely onchain
Users call DeepThought.ask(string) and either:
- pay
0.042 ETH, or - consume a previously earned free-question credit
The protocol maps a deterministic seed to one of several answers:
42DON'T PANICBring a TowelHeart of GoldInfinite ImprobabilityThe Question
Each successful question can mint an NFT that includes:
- a generated SVG image
- on-chain JSON metadata
- rarity traits
- edition number
- question id
- block number
- timestamp
- deterministic galaxy seed
If a user hits the rare The Question result, the protocol awards a free future ask through freeQuestions[address].
That means the rarest answer is not just cosmetic. It changes future user behavior and gives the protocol a small game loop.
- The user calls
DeepThought.ask(question). - The contract checks whether the user has a free question credit.
- If not, the call must include at least
0.042 ETH. - The contract derives a deterministic seed from caller and block data.
- The seed is mapped to an
AnswerType. - The full question record is stored onchain.
- If the answer is
The Question, the user earns one free future ask. - If linked contracts are initialized, the protocol mints an NFT through
FortyTwoNFT.
- A wallet or marketplace asks
FortyTwoNFT.tokenURI(tokenId). FortyTwoNFTloads the linked question record fromDeepThought.FortyTwoNFTcallsMetadataRenderer.generateTokenURI(...).MetadataRenderercallsSVGRenderer.generateSVG(...).- The final output is returned as:
data:application/json;base64,...
The rendering is split on purpose:
SVGRendererhandles image generationMetadataRendererhandles JSON generationFortyTwoNFThandles token ownershipDeepThoughthandles protocol logic
That separation makes the repo easier to reason about, easier to test, and less bloated than a single monolithic contract.
DeepThought.solMain protocol contract. Price, storage, answer generation, free asks, initialization, withdraw.FortyTwoNFT.solERC-721 contract. One NFT per question. Delegates metadata rendering.MetadataRenderer.solBuilds Base64 JSON metadata and traits.SVGRenderer.solBuilds fully on-chain SVG artwork.
Detailed documentation:
42-protocol/
├── contracts/
│ ├── DeepThought.sol
│ ├── FortyTwoNFT.sol
│ ├── MetadataRenderer.sol
│ ├── SVGRenderer.sol
│ └── mocks/
├── docs/
├── scripts/
├── tasks/
├── test/
├── hardhat.config.ts
├── package.json
└── .env.example
npm install
npm run compile
npm testCreate .env from .env.example.
Required for Base Sepolia deployment:
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
DEPLOYER_KEY=
BASESCAN_API_KEY=Local development:
LOCAL_RPC_URL=http://127.0.0.1:8545Compile:
npm run compileRun tests:
npm testRun coverage:
npx hardhat test --coverageCurrent status:
29passing tests98.03%line coverage96.98%statement coverage
npm run deploy:base-sepoliaThe deploy script does:
- deploy
SVGRenderer - deploy
MetadataRenderer - deploy
DeepThought - deploy
FortyTwoNFT - call
DeepThought.setContracts(...)
Local dry-run:
npm run deployBase Sepolia verification command:
npm run verify:base-sepolia -- <contract-address> <constructor-args...>See the full guide in docs/DEPLOYMENT.md.
