Inject PRIVATE_KEY and ALCHEMY_API_URL at deploy time — keys never touch disk.
- Node.js 18+
npm install
npm run compile # compile contracts
npm run deploy # deploy to Sepolia| Flag | Description |
|---|---|
| (none) | Uses .env.development (default) |
--staging |
Uses .env.staging and injects staging secrets from 1Password |
--production |
Uses .env.production and injects production secrets from 1Password |
To pass flags via npm scripts:
npm run deploy -- --production # deploy with production secrets- Install dependencies:
npm install - Encrypt your
.env.development:npx @dotenvx/dotenvx encrypt -f .env.development - Store the generated
DOTENV_PRIVATE_KEY_DEVELOPMENTin a 1Password Environment - Set
onePasswordEnvIdinenvlock.config.js:
export default {
onePasswordEnvId: "your-1password-environment-id",
commands: {
compile: "npx hardhat compile",
deploy: "npx hardhat run scripts/deploy.js --network sepolia",
},
};