A Verifiable Reputation Aggregation System on Stellar Soroban
Trustful is an innovative reputation aggregation system built on the Stellar Soroban platform that enables communities and projects to issue digital badges recognizing user contributions. These badges serve as verifiable proof of achievements and skills within the Stellar ecosystem.
The project is organized as follows:
Trustful/
├── contracts/ # Smart contracts for the system
├── src/ # Main file
├── scripts/ # Utility scripts for deployment and testing
├── tests/ # Test cases for the contracts
└── README.md # Project documentation
The Trustful system is built using a modular architecture consisting of multiple smart contracts to facilitate the creation, management, and verification of digital badges. Below is a brief summary of the key contracts:
- Deployer Contract: Handles the atomic deployment and initialization of other contracts in the system.
- Scorer Contract: Manages badges, scores and users.
- Scorer Factory Contract: Implements a factory pattern to deploy multiple Scorer Contracts efficiently.
For detailed information on each contract's methods and functionalities, please refer to the README files in the contracts/
folder.
Trustful implements specific design patterns to ensure security, modularity, and maintainability of contracts. Below are the main patterns used in our implementation:
Enables contract code updates without losing state or address, crucial for system maintenance and evolution over time.
Used to create and manage multiple instances of Scorer contracts in a standardized way, enabling system scalability.
Implements a role-based permission system to protect critical contract functions.
Defines an organized structure for contract state storage, facilitating data access and modification.
Establishes a comprehensive testing framework including unit, fuzzing, and integration tests.
Organizes operations in a secure sequence: validations, state modifications, and external interactions.
Ensures system initialization occurs in a single atomic transaction, preventing invalid intermediate states and Front-Running.
Before you begin, ensure you have the following tools installed:
- Rust toolchain
- Soroban CLI
To build the project, run the following command:
cargo build --target wasm32-unknown-unknown --release
To run the tests, use the following command:
cargo test --workspace
- Install the Stellar CLI. You can do this via Homebrew:
brew install stellar-cli
Or using Cargo:
cargo install --locked [email protected] --features opt
- Generate a test account (this example uses 'alice' as the account name):
stellar keys generate --global alice --network testnet --fund
You can verify the address was created with:
stellar keys address alice
- Make the scripts executable:
chmod +x scripts/deploy_deployer.sh
chmod +x scripts/deploy_factory.sh
chmod +x scripts/create_scorer.sh
chmod +x scripts/add_user_manager.sh
- Deploy the deployer contract:
./scripts/deploy_deployer.sh -n testnet -s alice
- Deploy the factory contract:
./scripts/deploy_factory.sh -n testnet -s alice
- Create a scorer instance:
./scripts/create_scorer.sh -s alice -n testnet
- Add/remove users and managers (requires two accounts):
./scripts/add_user_manager.sh -s alice -t bob -n testnet
Note: Replace alice
and bob
with your actual account names. The source account (-s
) should be the admin account that deployed the contracts, while the target account (-t
) is the account you want to add as a user/manager.