Part V · Evidence and wrap-up
Appendix B · Accounts, credentials and API keys
Study material should only teach where to apply and how to store keys. Never put a real API key, private key or seed phrase into notes, screenshots, chats or a Git repository.
This appendix is based on the official Etherscan and Sourcify documentation as read on 2026-11-12. Button names and free quotas may change; trust the official page you see when you open it.
First, tell these apart
| Name | What it is | If it leaks | How the lab handled it |
|---|---|---|---|
| Wallet private key | A hexadecimal secret for one address | Someone can spend everything at that address | Kept only in a local ignored folder; never printed or written to reports |
| Seed phrase | Usually 12 or 24 English words that restore a whole wallet | The whole wallet is taken over | No real wallet seed phrase was used; no mainnet wallet was imported |
| API key | An access token issued by a website | Usually cannot move coins, but your quota can be used up or abused in your name | Kept only in an environment variable; never in chat, source or Git |
| RPC URL | The address you use to “talk to” a node | Public RPCs are not secret; a paid RPC URL with a key can have its quota consumed | Used a free public node; no node API key |
| Contract address | A contract’s “house number” on-chain | Not a secret; being misled to a fake address is the risk | All public, each with an Etherscan link |
Remember one sentence: private keys and seed phrases can move money; an API key usually only calls a website’s service; contract addresses are public. Store each according to that risk.
Etherscan and “verifying source code”
A block explorer turns on-chain data into searchable web pages. Sepolia Etherscan is the one used throughout this book.
After deployment, what lives on-chain is bytecode, not your Solidity source. Verifying source means submitting the source and compiler settings to the explorer, which recompiles it the same way; if the result matches the chain, the source is published and marked verified. Keep three things apart: verifying an implementation, verifying the proxy itself, and “linking” the proxy to its current implementation. Doing one does not automatically do the others.
Verification usually costs nothing and sends no transaction: no SepETH, no nonce, no wallet signature. But once published, source stays visible for a long time, so only submit code you are happy to make public.
Getting an Etherscan account and API key
- Open the official sign-up page etherscan.io/register (check that the address bar says
etherscan.io; do not click unknown ads). - Choose a username, email and a separate password (never a private key or seed phrase), complete the human check and submit.
- Click the verification link in your email to activate, then log in at etherscan.io/login.
- Open the API Dashboard, click Add and give it a name (for example
Web3-Sandbox-Learning; this is only a label, not the key). - The page shows a new API key. Copy it and store it safely straight away.
Signing up is free; for learning you can ignore prompts to upgrade to a paid plan. The official docs (read 2026-11-12) say the free plan allows 3 requests per second and up to 100,000 per day on most chains, counted across all keys on the account: plenty for a handful of source verifications.
One key, many chains
Etherscan now uses API V2: one endpoint, with a chainid parameter that selects the network. Sepolia’s chain ID is:
11155111
So the key you created on etherscan.io works for Sepolia directly: set chainid to 11155111. You do not need a separate “testnet key”. Mainnet’s chainid is 1, so double-check you picked Sepolia before submitting. Verifying on one chain does not verify the same address on any other chain.
Storing it safely
- Keep it in a password manager or a local environment variable.
- Do not post it in any group chat, paste it into GitHub, reports, slides or screenshots, or write it into contract or front-end code.
- If it leaks: delete it in the API Dashboard and create a new one (rotate).
Set it in the current terminal (after replacing the placeholder, never share this line):
export ETHERSCAN_API_KEY='paste-your-key-here'
To check that it is set without printing it:
if [ -n "$ETHERSCAN_API_KEY" ]; then echo present; else echo absent; fi
Do not “check” with echo $ETHERSCAN_API_KEY, which prints the secret to the screen and into your shell history, and do not pass the key as a command-line argument. Programs should read process.env.ETHERSCAN_API_KEY (Node.js) or os.environ["ETHERSCAN_API_KEY"] (Python).
What the lab actually did: the key was handed to the assistant through a secure input field and stored only as an environment variable. The lab notebook, reports, Git history and this book do not contain it.
What the key can and cannot do
- Can: read public chain data; submit source for verification and check the result; link a proxy to its current implementation.
- Cannot: sign or transfer in place of a private key; spend your SepETH; upgrade the UBOX proxy (that needs the ProxyAdmin owner’s signature).
Verifying through the API: two steps
- Submit: send the source (Standard JSON format recommended), the full compiler version (
v0.8.34+commit.80d5c536in this lab), the optimizer setting (off here) and the EVM version (osaka) tohttps://api.etherscan.io/v2/api?chainid=11155111&module=contract&action=verifysourcecode. A successful submission returns a GUID, which only means “queued”, not “verified”. - Check: query with
action=checkverifystatus&guid=…until it saysPass - Verified, then look at the verified mark in the explorer with your own eyes.
Proxies need an extra step, verifyproxycontract. Chapter 15 records the real outcome: all 8 submissions were still Pending in queue at the snapshot.
Success requires the source to reproduce the on-chain bytecode: compiler version, optimizer, EVM version, constructor arguments and the source itself must all match deployment. This lab’s V1/V2 are the counter-example: their source changed later, so only a rebuilt historical snapshot could be tried, and metadata may still block an exact match.
A route without an API key: Sourcify
Sourcify is a separate, open-source verification service. Verifying through the website verify.sourcify.dev or Foundry usually needs no Etherscan API key:
forge verify-contract 0xYourContractAddress \
src/MyToken.sol:MyToken \
--chain 11155111 \
--verifier sourcify
Results come as exact_match or match. Verified contracts can be browsed at:
https://repo.sourcify.dev/11155111/0xYourContractAddress
Etherscan and Sourcify are two independent public records: passing on one does not pass the other. (As read on 2026-11-12, the Sourcify docs say the old v1 API was shut down on 2026-07-07; use v2.)
What else did the lab need to sign up for?
| Item | Applied for? | Paid? | Notes |
|---|---|---|---|
| Etherscan account + free API key | Yes (for source verification) | No | This appendix |
| Sourcify account | No | No | Website verification usually accepts direct uploads |
| Infura / Alchemy node keys | No | No | Used a free public RPC |
| Exchange or mainnet wallet | No, importing one was forbidden | — | Locally generated test accounts only |
| Buying ETH or test coins | No | $0 budget | Faucet only |
| GitHub token | No | No | Local Git only |
| Foundry / solc | Tools installed, no keys | No | Open-source tools |