This is my submission for Assignment 1 in the Solana Summer Fellowship. This is a CLI application that lets you -
- Create a key pair
- Retrieve a public key from a private key
- Transfer sols from one account to another
- Request an Airdrop
This project is created using Bun, but you can use Node+npm or Deno to run this project.
bun installBefore running the 16ana CLI app, you need to register it. Run the following commands to register the CLI application.
bun link
bun link 16anaTo make sure the application was registered successfully, run
16ana --versionThe output should look something like this -
1.0.0Now, let's look into all the commands that this application offers us.
You can use the following command to create a keypair -
16ana keypairThis command will print the public key of the created keypair.
If you wish to get the private key printed on the terminal, use the -s or --show-secret flag.
16ana keypair --show-secretWe can get the public key from a private key that we already have using the --from-secret option on keypair command -
16ana keypair --from-secret="<private-key>"Example:
16ana keypair --from-secret="[ 1, 70, 69, 248, 202, 4, 159, 251, 181, 40, 86, 45, 109, 94, 65, 139, 65, 9, 36, 45, 29, 91, 19, 90, 107, 189, 40, 247, 4, 178, 226, 62, 253, 111, 98, 230, 123, 175, 14, 241, 154, 146, 187, 1, 25, 5, 91, 161, 53, 111, 18, 187, 107, 112, 218, 50, 192, 222, 37, 218, 18, 11, 176, 255 ]"Make sure to wrap your private key in double or single quotes.
Use the request-airdrop command along with options --wallet-address and --sols to specify receiver's address and number of sols respectively.
16ana request-airdrop --wallet-address=<receiver-wallet-address> --sols=<number-of-sols>This command creates an airdrop and returns a transaction ID, which can be queried later for transaction status.
A transfer can be created using the transfer command with options --payer-secret, --to and --sols to specify sender's secret key, receiver's public key (address) and the number of sols to be transfered.
16ana transfer --payer-secret="<payer-secret-key>" --to=<receiver-public-key> --sols=<number-of-sols-to-be-transfered>- The
devnetseems to have quite aggressive rate limiting, so in case your limit is expired, uncomment line #4 intransactions.tsand comment out line #3 in the same file to make the app point tolocalnet, in case you have a running localnet. - Feel free to raise issues for bugs and contribute to making this project better. There are no contribution guidelines as such. Just raise a PR and I'll review it.
16 in Hindi is Solah. So 16ana becomes "Solah"-ana. I know this is not much, but this is as creative as I can get. Haha.
- I don't really know
bunandtypescript, but thanks to this blog for a great intro tobunand building CLI apps with it. - Thanks to Kunal for session 1 where he introduced us to transactions on Solana!