Gmmmmm Feed Fam!
Welcome to the 14th episode of the #Aleo Pulse, your one-stop hub for all things on ALEO😎
Usual reminder, we are live on X as well, so go check that out!
Here we go again, LFG🚀
Today, We will be discussing how to deploy a basic contract on the Aleo Blockchain🤯
🟦Prerequisites
1️⃣Install LEO Wallet
➡️Head to the Chrome web store and search for Leo Wallet, which should look something like this👇
As always, look out for the verified tick to stay out of scam extensions.
We ain't losing a sec for scams!
2️⃣Identifying the Wallet
Now click the extension and you should see something like this👇
Note that the monetary value isn't true, as it's just testnet.
In addition, the wallet address is hidden for privacy purposes (Which is obviously untraceable in privacy blockchains🙈)
3️⃣Using the faucet
Now click the Faucet🚰button and follow the instructions there.
The process is quite simple, just scan the QR code there and send a text message to get some Aleo credits from the faucet.
Note: This is a unique process implemented to minimize bot activity in the blockchain.
4️⃣Deploy the contract
🔵Head to demo dot leo dot app /deploy
Now we add some basic logic to the program section.
Here's the basic logic I will be using :)
======== Code =========
program AleoPulse.aleo;
record Token:
owner as address.private;
amount as u64.private;
function mint:
input r0 as address.private;
input r1 as u64.private;
cast r0 r1 into r2 as Token.record;
output r2 as Token.record;
function transfer: input r0 as Token.record;
input r1 as address.private;
input r2 as u64.private;
sub r0.amount r2 into r3;
cast r0.owner r3 into r4 as Token.record;
cast r1 r2 into r5 as Token.record;
output r4 as Token.record;
output r5 as Token.record;
==================================
You are free to use this sample code with your own modifications.
Now for fees just type in 12000000 (units are in microcredits)
Now your contract should look something like this👇
➡️Now hit Submit and approve the transaction.
Now, another window shall pop up with this screen, stating the progress.
⚠️ Don't close this window, as this will fail the deployment.
Please be patient as this may take a couple of minutes to finalize🙈
[The time varies on how powerful is your Computer]
🔵To add, as this is a resource-intensive process, make sure you leave adequate RAM and processor utilization to ensure smooth operations [Just leave the device Idle or continue to do lightweight tasks while the process finishes]
Once the transaction goes through, this shall automatically close.
Now, head back to the Leo app and check whether the Deployment has been completed, which should look like this👇
The contract should be live here 👇
explorer dot hamp dot app /programs
5️⃣Implement the token
🔵Now we finally can deploy the token on the Aleo testnet.
Here's what you need to do👇
1️⃣Click the execute function in the Leo app
Here's some reference✌️
Now type in the following
Program ID: aleopulse.aleo (which we deployed above).
Function Name: mint
Inputs: YOUR_WALLET_ADDRESS 1000000u64
➡️Note: Inputs indicate your ALEO address where we deployed the contract and are going to mint tokens now.
Quantity of tokens
Eg/
if 100000, we write 100000u64;
if 13988, then 13988u64;
Input the FEE for deployment: 1000000
Here's how the setup should look like before the final deployment👇
➡️Now, hit Submit and wait until it's completed.
Now, head to Aleo Explorer and in programs it should be live
Here's a reference✌️
Aaand congratulations!
You've finally deployed your first smart contract and token on the Aleo blockchain🥳
Feel free to head towards the Aleo website if you are more interested in joining the evolution of ZK-enabled dApps.
Here I wrap up for now, and I'll see ya in the next episode🫡