4.2 Your First Program Deployment
Let's deploy the token program we developped in last module. First you need to update the program id to make sure no other program deployed with that program id exists already.
You can check by typing your program id your_token_example_123.aleo
in the seach bar of one of the Aleo block explorers:
If a program with that ID exists already, you should update your program's ID:
At the top of your Leo file, when defining the program:
program your_token_example_123.leo {
In the
program.json
file at the root of your project:"program": "your_token_example_123.aleo",
Make sure to use a program ID with more than 10 characters, less than that and you will have to pay an extra namespace fee that can be pretty high an make the deploy transaction fail.
Once you have made sure your program ID does not exist yet, you must set a private key for an Aleo wallet with funds to pay for the deployment fees. For that you need to extract your private key from your Leo Wallet by following those steps.
Then, set your private key in .env
file at root of your Leo application
PRIVATE_KEY="PASTE_PRIVATE_KEY_HERE"
NETWORK="testnet"
ENDPOINT=https://api.explorer.provable.com/v1
Deploy the program using the leo CLI
leo deploy
You should have seen a confirmation that your Aleo application was deployed in the form of a transaction ID that looks like the following at1rkkpqu5k4rt86zzccczw6cxeyvrl7hxydvvv7dhl7zr7p9w40c8s70kwm8
.
Paste your transaction ID to view the details of your deployment transaction on one of the Aleo chain explorers above.
Optinal arguments
--record
: Record to pay for fee privately. If one is not specified, a public fee will be taken.--dry-run
: To just generate a test transaction without submitting it to the network.
Fee
Here's a breakdown for the fee for a deployement transaction:
Transaction Storage - Storing your program's instructions on the ledger.
Program Synthesis - Generating proving and verifying fee for your program.
Namespace - Paying a premium for special names, each letter below 10 characters is exponentially more expensive.
Priority Fee - Making sure your transaction gets included when there are multiple other competitors in the memepool.
Last updated