#.env file how to create

103 messages · Page 1 of 1 (latest)

steel bison
#

The .env file is not being created, and if it is necessary to deploy the project, what should I do?
@mellow violet @merry grail

tall stone
#

Can you share your deploy code?

steel bison
#

You mean smart contract?

tall stone
#

Is this a fresh AlgoKit project?

steel bison
#

Yes

tall stone
#

I would suggest making sure AlgoKit is on the latest version first

steel bison
#

2.5.2

tall stone
#

Trying to init my own to see if I can reproduce the issue

steel bison
#

Sorry please explain

merry grail
#

There should be information in the README about generating an env file, something like “algokit project generate env-file” - have you ran that command?

tall stone
#

That shouldn't even be necessary

steel bison
#

Yes I can run this command

tall stone
#

I don't have a .env file and I can just hit F5 and it works

merry grail
#

I think it depends if you run algokit project deploy or algokit project deploy localnet? I remember having a similar issue

steel bison
#

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

tall stone
#

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

merry grail
#

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

steel bison
#

What is the difference between these two, and which method is more suitable? Please guide me.

merry grail
#

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

steel bison
merry grail
#

Looks like it worked

steel bison
#

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?

merry grail
#

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

steel bison
#

Just need to run algokit generate env-file, nothing else? Just generate this file, no other settings?

merry grail
#

Right

steel bison
#

Algokit project deploy not run

#

Algokit project deploy localnet only run 🥺

merry grail
#

Did the generate command work?

steel bison
#

Yes

merry grail
#

What env files did it generate?

steel bison
#

Env.localnet only

merry grail
#

Isn’t there a command in the README for generating env files for mainnet/testnet?

steel bison
merry grail
#

when you ran the generate command

#

it should have prompted you to select which network you want to generate for

steel bison
#

Local net

merry grail
#

okay

#

so it works

#

generate one for testnet and deploy it

steel bison
#

Algokit project deploy localnet net work

#

Developer mnemonic how to put

merry grail
#

easiest way is to run algokit goal wallet new my_wallet

#

then hit y when it asks you to show the mnemonic

steel bison
merry grail
#

did you get the mnemonics by running the commands I showed you?

steel bison
#

Yes I can run

merry grail
#

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

steel bison
#

Yes, only a developer account for learning.

#

Press f5 deploy easly

merry grail
#

You didn’t paste in the entire mnemonic

steel bison
#

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

merry grail
#

F5 deploys to localnet

#

Or uses what’s in .env

steel bison
#

Ok local net work always but test net not work 😢

merry grail
#

Did you fund the deployer account?

steel bison
#

Only 2 file env

#

Yes

merry grail
#

What is in your .env.testnet file? Just copy paste, don’t share screenshot please 🙂

steel bison
#

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"

merry grail
#

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
steel bison
merry grail
#

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

steel bison
#

Yes I can run algokit project test net

merry grail
#

Awesome

steel bison
#

Algokit project deploy testnet but not work dear

merry grail
#

Hmmm

#

Try just running the command, and pasting in the deployer mnemonic when it asks you

#

“DEPLOYER_MNEMONIC:” in the console

steel bison
#

Try all thing but not work

merry grail
#

Try adding the quotes again? I took them away, but I’m on Mac, maybe a Windows issue

steel bison
#

Not work dear

merry grail
#

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

steel bison
#

Thank you @merry grail 😊🙏

random lanceBOT
#

Gave +1 Rep to @merry grail (current: #7 - 32)

merry grail
#

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

steel bison
#

@merry grail Thank you for your support 😊

random lanceBOT
#

Gave +1 Rep to @merry grail (current: #7 - 33)

merry grail
#

You’re welcome