DEV Community

EgorMajj
EgorMajj

Posted on

Deploying the contract in the Aleo test network

Video Tutorial: https://youtu.be/EkNk7MnzA8s
Developer documentation: https://developer.aleo.org/testnet/getting_started/deploy_execute

1. Installing Leo according to the official tutorial: https://github.com/AleoHQ/leo
2. Installing Leo according to the official tutorial: https://github.com/AleoHQ/snarkOS
3. Install JSON Beautifier & Editor: https://chrome.google.com/webstore/detail/json-beautifier-editor/lpopeocbeepakdnipejhlpcmifheolpl
4. Generate Key
Go here https://aleo.tools/ and click Generate, copy Address separately. Be sure to save all the data!
Now you have a private key!
5. Go to the Faucet for test tokens https://twitter.com/AleoFaucet and request them
see the format "@AleoFaucet send 10 credits to $YOUR_WALLET_ADDRESS" below in the screenshot

Image description
6. Creating a Leo program
In the terminal we enter

cd $HOME/Desktop
mkdir demo_deploy_Leo_app && cd demo_deploy_Leo_app
Enter fullscreen mode Exit fullscreen mode

7. WALLETADDRESS
The wallet you copied in step 4

WALLETADDRESS=Here's the wallet address”
Enter fullscreen mode Exit fullscreen mode

8. Creating a program name

APPNAME=helloworld_${WALLETADDRESS:4:6}
Enter fullscreen mode Exit fullscreen mode

9. Creating a Leo test application.

leo new ${APPNAME}
Enter fullscreen mode Exit fullscreen mode

Leo new will automatically create a basic hello world program.

10. Launching the Leo app

cd ${APPNAME} && leo run && cd -
Enter fullscreen mode Exit fullscreen mode

11. Save the program path

PATHTOAPP=$(realpath -q $APPNAME)
Enter fullscreen mode Exit fullscreen mode

12. Faucet Link
The https://twitter.com/AleoFaucet will retweet your request, you will see the link "vm.aleo.org/api/testnet3/... "and you will get the encrypted text record value.

13. Click the link retweeted by https://twitter.com/AleoFaucet. JSON should appear in a new window.

14. Select object.execution.transitions[0].outputs[0].value and copy the saved encrypted text.

15. Getting your notes in plain text

  • Go to https://aleo.tools/ and click the "Record" button on the navigation bar at the top of the page.
  • Place the encrypted text you copied in step 14 in the Record (Ciphertext) field.
  • Place the view key in the View Key field.
  • Copy the plaintext entry.
  • Save the record of the plaintext!

16. Deploying a test program
Open the terminal
Go to the path of your application from step 11

cd $PATHTOAPP && cd ..
Enter fullscreen mode Exit fullscreen mode

17. Assign $PRIVATEKEY to the private address from step 4

PRIVATEKEY=Here is the private key
Enter fullscreen mode Exit fullscreen mode

18. Assign $RECORD to the open text entry you saved earlier

19. Deploy Leo

snarkos developer deploy "${APPNAME}.aleo" --private-key "${PRIVATEKEY}" --query "https://vm.aleo.org/api" --path "./${APPNAME}/build/" --broadcast "https://vm.aleo.org/api/testnet3/transaction/broadcast" --fee 600000 --record "${RECORD}"
Enter fullscreen mode Exit fullscreen mode

20. Check
Go to https://aleo.tools/ and type in the program name.

You will see that your program is now successfully deployed.

If you still have questions, join the Aleo community

Top comments (0)