- Starkli - Command line tool for interacting with Starknet.
If you're on Linux/macOS/WSL, you can install starkliup by running the following command:
curl https://get.starkli.sh | sh
You might need to restart your shell session for the starkliup command to become available. Once it's available, run the starkliup command:
starkliup --version 0.1.20
Running the commands installs starkli for you, and upgrades it to the latest release if it's already installed.
This guide will help you declare and deploy contracts on a testnet. Please note that you won't be able to use the commands in the Makefile unless you follow these instructions.
A smart wallet consists of two parts: a Signer and an Account Descriptor. The Signer is a smart contract capable of signing transactions (for which we need its private key). The Account Descriptor is a JSON file containing information about the smart wallet, such as its address and public key.
Follow the steps below to set up a testnet smart wallet using starkli
:
-
Connect to a Provider: to interact with the network you need an RPC Provider. For our project we will be using Alchemy's free tier in Goerli Testnet.
-
Go to Alchemy website and create an account.
-
It will ask which network you want to develop on and choose Starknet.
-
Select the Free version of the service (we will only need access to send some transactions to deploy the contracts)
-
Once the account creation process is done, go to My apps and create a new Application. Choose Starknet as a Chain and Goerli Starknet as a Network.
-
Click on View key on the new Starknet Application and copy the HTTPS url.
-
Updated
.env
file:RPC_URL="<ALCHEMY_API_HTTPS_URL>"
-
-
Create a Keystore: A Keystore is a encrypted
json
file that stores the private keys.-
Create a hidden folder: Use the following command:
mkdir -p ~/.starkli-wallets
-
Generate a new Keystore file: Run the following command to create a new private key stored in the file. It will ask for a password to encrypt the file:
starkli signer keystore new ~/.starkli-wallets/keystore.json
The command will return the Public Key of your account, copy it to your clipboard to fund the account.
-
-
Account Creation: In Starknet every account is a smart contract, so to create one it will need to be deployed.
-
Initiate the account with the Open Zeppelin Account contract:
starkli account oz init --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
-
Deploy the account by running:
starkli account deploy --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
For the deployment
starkli
will ask you to fund an account. To do so you will need to fund the address given bystarkli
with the Goerli Starknet Faucet
-
-
Setting Up Environment Variables: There are two primary environment variables vital for effective usage of Starkli’s CLI. These are the location of the keystore file for the Signer, and the location of the Account.
Updated
.env
file:ACCOUNT_SRC=~/.starkli-wallets/account.json KEYSTORE_SRC=~/.starkli-wallets/keystore.json