#.env file how to create
103 messages · Page 1 of 1 (latest)
Can you share your deploy code?
Is this a fresh AlgoKit project?
Yes
I would suggest making sure AlgoKit is on the latest version first
2.5.2
Trying to init my own to see if I can reproduce the issue
Sorry please explain
There should be information in the README about generating an env file, something like “algokit project generate env-file” - have you ran that command?
That shouldn't even be necessary
Yes I can run this command
I don't have a .env file and I can just hit F5 and it works
I think it depends if you run algokit project deploy or algokit project deploy localnet? I remember having a similar issue
I will run it and show you. I have run it before, but I will do it again on a new project. Please wait.
Algokit project deploy
Oh I know what the issue is
When you don't have a .env, it prompts you for the deployer mnemonic in the terminal
but you must have just hit enter and not given it a valid mnemonic
So I think the best course is to generate a .env file like Gabe said
yeah, if you run algokit project deploy localnet it automatically setsup the deploy account for you without any env variables. If you run algokit project deploy you need to either create/generate the .env or provide the mnemonic in terminal
What is the difference between these two, and which method is more suitable? Please guide me.
The first one is easier if you just want to get started with local development. The second one lets you use a .env where you can specify the parameters of deployment, like the account of the deployer and whether it gets deployed to testnet/mainnet
So try the first one and see if it works
Looks like it worked
Yes, this is working, but I want to deploy it on the testnet and learn more. Can you guide me on how to create the .env file, etc., and where to do all this?
Check out the README and run the command to generate the env file, that creates it for you so you can see the variables it’s setting
You can also run algokit explore which opens an explorer for the local version of the network and will show your contract deployed there
Just need to run algokit generate env-file, nothing else? Just generate this file, no other settings?
Right
Did the generate command work?
Yes
What env files did it generate?
Isn’t there a command in the README for generating env files for mainnet/testnet?
when you ran the generate command
it should have prompted you to select which network you want to generate for
Local net
easiest way is to run algokit goal wallet new my_wallet
then hit y when it asks you to show the mnemonic
did you get the mnemonics by running the commands I showed you?
okay, that phrase that starts with "blame solar..." etc is your mnemonic
careful sharing that, if it has real money on it, people can steal your funds
for development it's fine
place that phrase in your .env.testnet file that you generated, like this
DEPLOYER_MNEMONIC=blame solar (...rest of the mnemonic)
then run algokit project deploy testnet
You didn’t paste in the entire mnemonic
I pressed F5, and it deployed easily. But my question is: **Where was it deployed—TestNet, MainNet, or LocalNet?
And if it has been deployed, how can I find out which account is connected to my Perawallet? I know which account I entered in the configuration, but I need to confirm the connected account.
Yes I past this but not work
Ok local net work always but test net not work 😢
Did you fund the deployer account?
What is in your .env.testnet file? Just copy paste, don’t share screenshot please 🙂
Ok
this file contains algorand network settings for interacting with testnet via algonode
ALGOD_SERVER=https://testnet-api.algonode.cloud
INDEXER_SERVER=https://testnet-idx.algonode.cloud
DEPLOYER_MNEMONIC="rent supply car neither crane half shove multiply valley mother sport dice neglect
settle danger staff include arrest polar miss science certain devote ability onion"
oh sorry, wrong variable name
try this
ALGOD_SERVER=https://testnet-api.algonode.cloud/
INDEXER_SERVER=https://testnet-idx.algonode.cloud/
DEPLOYER=rent supply car neither crane half shove multiply valley mother sport dice neglect
settle danger staff include arrest polar miss science certain devote ability onion
Run “algokit project deploy testnet”
To run “algokit project deploy” you need to create a .env and put the contents from .env.testnet in there
Yes I can run algokit project test net
Awesome
Algokit project deploy testnet but not work dear
Hmmm
Try just running the command, and pasting in the deployer mnemonic when it asks you
“DEPLOYER_MNEMONIC:” in the console
Try all thing but not work
Try adding the quotes again? I took them away, but I’m on Mac, maybe a Windows issue
Not work dear
okay let's just try a new mnemonic lol
ALGOD_SERVER=https://testnet-api.algonode.cloud/
INDEXER_SERVER=https://testnet-idx.algonode.cloud/
DEPLOYER_MNEMONIC=joke morning animal scrap dice roof reduce response material blind core bronze nest wet cheese banana become bar join blame pause divert physical ability decade
that's one I generated. Please put it in .env.testnet and try again. Not sure why it's not working for you
Thank you @merry grail 😊🙏
Gave +1 Rep to @merry grail (current: #7 - 32)
It worked? =0 strange maybe something was getting lost in between the copy paste - it was definitely an issue with the mnemonic
Congratulations on your first testnet deployment
@merry grail Thank you for your support 😊
Gave +1 Rep to @merry grail (current: #7 - 33)
You’re welcome