Our goal is to create a place for people to ask questions and get valuable answers incentivized by our novel business model of answer-to-earn. Since our main target is STEM students who strive to get the best quality of information from the Internet. Our app also supports Tex and Markdown syntaxes.
What you can do:
-
Ask Questions: Pay for the base fee and reward for each question you asked. Base fee will be returned when an answer is selected and the reward will be given to the selected answer.
-
Answer: You can submit the answer in the question's thread.
-
Earn:
- If you are the asker, you can select the best answer as the solution and retrieve the base fee.
- If you are the answerer and your answer is selected as the solution, you can earn the reward from the asker. However, don't worry about your answer not being selected, you can delete your answer to get back the rent.
- Install your wallet for Solana (Phantom or Solflare Supported).
- Airdrop yourself from SOL using
solana-cli
or Sol Faucet. - Enjoy the app! (Demo Link).
Please follow the following best practice for all development on this project.
- Backend (Smart Contract): Should follow the test-driven approach. Write tests and make sure all the tests pass.
- Frontend: If you are unfamiliar with Vue, follow this tutorial. Note that the project is developed using composition and SFC.
app/
: frontend Vuejs applicationprograms/
: Rust backend smart contracttarget/
: target directory for deployment, generated afteranchor build
target/deploy/so_lution-keypair.json
: the private key that proves you own the contracttarget/idl/so_lution.json
: an interface description language file used to specify the interface between frontend and backend, like a schema
tests/
: tests that are run against the Rust backendAnchor.toml
: the main configuration file for Anchor
- Private Developer Docs
- Create a Solana Dapp from scratch
- Anchor Book
- Solana Cookbook
- Anchor Related Documentation
- Soldev Tutorials
- Solana Official Docs
-
Versions
node 16.*.*
anchor-cli 0.24.2
solana-cli 1.9.25
rustc 1.61.0
-
Current Deployed ProgramID on Devnet:
AhTPm4QecF67HhvFnYVJkM9jrgMwJcJNC3ULTHnaxdkX
- check
target/deploy/so_lution-keypair.json
- check
-
Authority of Deployed Program on Devnet:
Eyrm7NECYjcR2AZh1BfQ63mLoDBycwuFQRhiU4FrdQem
-
When you change the programID, make sure to check the following files and make sure that they or consistent (or you can just Ctrl + F search the entire directory)
Anchor.toml
- Top of
programs/src/lib.rs
- Bottom of
target/idl/so_lution.json
# Generate new keypair
solana-keygen new
# Check your wallet address
solana address
# Check your wallet balance
solana balance
# Make sure you’re on the localnet.
solana config set --url localhost
# And check your Anchor.toml file. (check keypair path and network of use)
# Code…
# Run the tests. (builds, deploys, tests, and shuts off all at once)
anchor test
# -r resets the validator to genesis (or it will preload from test-ledger/)
solana-test-validator [-r]
anchor build
anchor deploy
# Run tests on the created local server to generate dummy data (Note that it will probably fail if your validator is not freshly created)
anchor run test
# Copy the new IDL to frontend.
anchor run copy-idl
# Serve your frontend application on localnet.
cd app && yarn run serve
# Switch to the devnet cluster to deploy there.
solana config set --url devnet
# !! Update your Anchor.toml file !!
# Airdrop yourself some money if necessary. (Do this multiple times likely need 2 ~ 4 SOL)
solana airdrop 2
# Build and deploy to devnet.
anchor build
anchor deploy
# Copy the new IDL to frontend.
anchor run copy-idl
# Run frontend for devnet locally
cd app && yarn run serve:devnet
- modify
Anchor.toml
,programs/src/lib.rs
anchor run copy-idl
import base58
json_string = [...] # ~/.config/solana/id.json
private_key = base58.b58encode(bytes(json_string))
import base58
byte_array = base58.b58decode(MY_PRIVATE_KEY_IN_BASE58)
json_string = "[" + ",".join(map(lambda b: str(b), byte_array)) + "]" # ~/.config/solana/id.json
SOLution is licensed under Apache 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in SOLution by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.