This is an example Solana project that has a smart contract that writes tweets to the blockchain and read tweets from the block chain. The UI calls this smart contract for writing and reading.
Right before tweet, about to approve transaction using Phantom:
After tweet was saved via smart contract and fetched to display:
Step 1:
solana config set --url localhost
Step 2:
In Anchor.toml ensure that cluster is equal to localnet, like:
[provider]
cluster = "localnet"
Step 3:
anchor test
anchor run copy-idl
solana config set --url devnet
solana airdrop 2 {public_key}
solana airdrop 2 {public_key}
In Anchor.toml ensure that cluster is equal to devnet, like:
[provider]
cluster = "devnet"
anchor build
anchor deploy
cd app
npm run serve:devnet
solana-keygen new -o localkey.json
solana address -k localkey.json
solana address -k target/deploy/solana_twitter-keypair.json
-
Set cluster to devnet (in Anchor.toml)
-
Make a new key and airdrop ~10 sol
solana-keygen new -o localkey.json
solana address -k localkey.json
# split up because of rate limiting
solana airdrop 2 {public_key}
solana airdrop 2 {public_key}
solana airdrop 2 {public_key}
solana airdrop 2 {public_key}
solana airdrop 2 {public_key}
-
Set the wallet address of the location of the key from #1 in Anchor.toml
-
Delete the fiiles in target/deploy/*
-
execute
anchor build
anchor deploy
-
Take the public key from the deploy and add to the top of program/solana/src/lib.rs and to the desired programs in Anchor.toml
-
execute
anchor build
anchor deploy