Step 3 of 1127% complete

Set Environment Variables

Estimated time: 2 minutes

Set Environment Variables

Learning Objectives

By the end of this step, you'll:

  • Understand what environment variables are needed
  • Have created your .env file with the correct values
  • Know how to securely manage your private key

Content

What Are Environment Variables?

Environment variables are configuration values that your app needs to run. They're stored in a .env file (which is gitignored for security).

For this tutorial, you need:

  • SPACE_ID: The space where your data lives (we'll use "ns" for the workshop)
  • ARKIV_PRIVATE_KEY: Your wallet's private key (for signing transactions)

Why Keep Them Secret?

Your private key is like a password - if someone has it, they can sign transactions as you. That's why .env files are never committed to git.

I'm at step 3: Set Environment Variables.

Help me:
1. Copy the .env.example file to .env
2. Fill in my ARKIV_PRIVATE_KEY (I have it from step 2)
3. Set SPACE_ID to "ns" for the workshop
4. Understand why we keep these values secret

Provide clear instructions and explain security best practices.

Update the internal implementation plan with notes and show me the plan so I can track your progress.

✓ Checkpoint

Troubleshooting

Q: I don't see a .env.example file. A: Make sure you're in the root directory of the project. If it's missing, create a .env file manually with the variables above.

Q: How do I know if my private key is correct? A: It should:

  • Start with 0x
  • Be 66 characters long (including the 0x prefix)
  • Be the same key you generated in step 2 using the Arkiv Getting Started guide

Q: I lost my private key from step 2. A: You'll need to generate a new account. Go back to step 2 and use the Arkiv Getting Started guide to generate a new account. You'll also need to get new testnet tokens for the new wallet address from the Mendoza Testnet Faucet.

Q: Can I use the same private key for multiple projects? A: Yes, but for testnet only. Never reuse testnet keys for mainnet, and never share keys between projects in production.