DEV Community

Max Daunarovich for Flow Blockchain

Posted on

Build on Flow | Learn FCL - 12. How to Create a New Account with Flow CLI and Testnet Faucet

Overview

In previous posts we’ve covered how to setup your wallet with Blocto and Lilico. While it’s convenient to use those in the browser environment, you won’t be able to do it on server side. But it’s still possible to sign the transactions if you control the private key corresponding to a public key set on account.

So in this post will teach you how to:

Step 1 - Installation

First we will need to install Flow CLI. The process is pretty straightforward and explained in details here → Flow Documentation - Install the Flow CLI.

After the installation is completed, you can check that it’s working properly by checking version of installed Flow CLI:

flow version
Enter fullscreen mode Exit fullscreen mode

At the time of writing latest released version is v0.36.1 and that’s what you should see in the terminal window:

% flow version
Version: v0.36.1
Commit: 5a1d7bfa90fb95ac3335d9c5ea214a6ef445759b
Enter fullscreen mode Exit fullscreen mode

Step 2 - Generate Key Pair

Next thing we need to generate key pair - private and public keys. We will use the former to sign transactions and the latter to attach to a newly created account, so we could control it.

The easiest way to generate fresh key pair is - drum rolls 🥁 - Flow CLI! Boi, what a handy tool it is 🤩. Run this in your terminal:

flow keys generate
Enter fullscreen mode Exit fullscreen mode

The output will be similar to this:

🙏 If you want to create an account on testnet with the generated keys use this link:
https://testnet-faucet.onflow.org/?key=95b37b7d759c09532ffbda33bcd65bd6826366fe0d518e1bdbead62a9e51a2f19db0fb4e0bbf0b4a35048437423fc87dfc00349096723d75c2e3bfbf2246895e 

🔴️ Store private key safely and don't share with anyone! 
Private Key      feca763f32039483394bf0b416c55fea7c9e07f43bc48ccf02de66a774346b49 
Public Key   95b37b7d759c09532ffbda33bcd65bd6826366fe0d518e1bdbead62a9e51a2f19db0fb4e0bbf0b4a35048437423fc87dfc00349096723d75c2e3bfbf2246895e
Enter fullscreen mode Exit fullscreen mode

⛔ Attention! Do not share your private key with anyone. I’m showing you mine here for editorial purposes. But you should keep your private key in some safe place.

🙈 Post-it note on your monitor is not safe place…

⚠️ Windows OS have some issues with splitting the lengthy keys, so when you copy/paste it from your terminal ensure there is no extra space characters in the middle 😤

You can copy that link Flow CLI created for you to pre-populate Paste Your Public Key or you can open Flow Testnet Faucet and do it manually. Either way is OK 🙂

Keep ECDSA_P256 for Signature Algorithm and SHA3_256 for Hash Algorithm as those are used by CLI to prepare your keys. Then mark checkbox and pass CAPTCH test, confirming you are human (🤖 got you, meat bags!). Press Create Account and you are done! 🙌

Faucet - Account

Write that address down - better alongside private key 😉 - cause we will need it for signing as well.

Congratulations! Now you are the owner of freshly baked Flow Testnet account! 💪

https://media.giphy.com/media/5mTwWeN3MoS08/giphy.gif

Until next time, my fluffy kittens! 👋 😸

Resources

Discussion (0)