A full-stack decentralized application (dApp) built on the Stellar blockchain. Users can utilize this dApp to register anonymous feedback. The smart contract includes logic to automatically assign unique IDs to each newly created feedback, and these registered feedback entries can be accessed using their respective feedback IDs.
- Technologies Used
- Smart-contract Info
⚠️ Issue- Project Setup Guide
- Smartcontract : Rust, Soroban-SDK
- Wallet : Freighter (available as a chrome-extension)
- Frontend : ReactJS, TailwindCSS
- Integeration : Stellar-SDK
-
All the materials related to the smart contract can be found in the
anonymous-feedback-smartcontract
folder: -
The path to the smart contract is:
./anonymous-feedback-smartcontract/contracts/hello_world/src/lib.rs
-
send_feedback(env: Env, feedback_msg: String) -> u64
: Takes a feedback message (of typeString
) as an argument, assigns a unique ID to each feedback, stores the feedback on the blockchain, and returns the feedback ID for the newly created entry. -
fetch_feedback(env: Env, fb_id: u64) -> Feedback
: Takes a feedback ID (of typeu64
) as an argument and returns the feedback associated with the specified ID.
Getting undefined
When Fetching Data from the Blockchain Using Stellar-SDK
Both setter (send_feedback()
) and getter (fetch_feedback()
) functions work as expected when invoked from the terminal using Stellar-CLI.
The getter smart contract function (fetch_feedback()
) returns undefined when invoked using the JavaScript interaction function (fetchFeedback()
) built with Stellar-SDK (located in the Soroban.js file). This issue persists despite the function being correctly invoked.
Additionally, while I am able to store data on the blockchain using the setter smart contract function (send_feedback()
) through the sendFeedback()
interaction function, this function also returns undefined instead of the expected object.
The transaction builder function and all interaction functions are implemented in the Soroban.js file.
- Path to
Soroban.js
file:src/components/Soroban.js
I have followed the Stellar documentation mentioned below to create the transaction builder function: https://developers.stellar.org/docs/build/guides/transactions/invoke-contract-tx-sdk
-
Creating a Feedback and Storing it onchain by invoking the
send_feedback()
smartcontract function:Result:
-
Fetching a feedback with feedback-id
4
by invoking thefetch_feedback()
smartcontract function:Result:
- Install NodeJS, Rust, Stellar-CLI
- Install Freighter Wallet chrome extension.
- Clone the repository :
git clone https://github.com/bhupendra-chouhan/Anonymous-Feedback-Soroban.git
- Install Dependencies:
npm install
- Start the project:
npm run start