A decentralized carpooling application built on the Sui blockchain using the Move programming language. This project enables users to register as drivers or passengers and create ride-sharing arrangements in a trustless, blockchain-based environment.
- Driver Registration: Users can register as drivers with their vehicle information
- Passenger Registration: Users can register as passengers to request rides
- Ride Booking: Passengers can book rides with available drivers
- Ride Management: Track active rides and manage driver availability
- Decentralized: Built on Sui blockchain for transparency and security
- Smart Contracts: Automated ride management through Move smart contracts
Conductor: Represents a driver with vehicle information and availability statusPasajero: Represents a passenger with wallet informationViaje: Represents a booked ride with origin, destination, and statusRegistroConductores: Global registry of all registered driversRegistroPasajeros: Global registry of all registered passengers
- Driver Management: Register drivers, check availability, update status
- Passenger Management: Register passengers, validate registration
- Ride Operations: Book rides, finalize trips, track active rides
- Registry Management: Maintain global registries of users
- Sui CLI installed
- Basic understanding of Move programming language
- Sui testnet or devnet access
- Clone the repository:
git clone <repository-url>
cd go_together- Install dependencies:
sui move buildExecute the test suite to verify functionality:
sui move testThe test suite includes:
- Driver registration tests
- Passenger registration tests
- Ride booking functionality tests
- Create a driver profile:
let conductor = crear_conductor(nombre, coche, ctx);- Register the driver in the global registry:
registrar_conductor(&mut registro, &mut conductor);- Register as a passenger:
registrar_pasajero(&mut registro, nombre, ctx);- Reserve a ride with an available driver:
reservar_viaje(&mut conductor, &pasajero, origen, destino, ctx);- Finalize the ride when completed:
finalizar_viaje(&mut viaje, &mut conductor);crear_conductor(nombre: String, coche: String, ctx: &mut TxContext): Conductorregistrar_conductor(registro: &mut RegistroConductores, conductor: &mut Conductor)esta_conductor_registrado(registro: &RegistroConductores, user: address): boolesta_disponible(conductor: &Conductor): boolactualizar_disponibilidad_conductor(conductor: &mut Conductor, disponible: bool)
registrar_pasajero(registro: &mut RegistroPasajeros, nombre: String, ctx: &mut TxContext)esta_pasajero_registrado(registro: &RegistroPasajeros, user: address): bool
reservar_viaje(conductor: &mut Conductor, pasajero: &Pasajero, origen: String, destino: String, ctx: &mut TxContext)finalizar_viaje(viaje: &mut Viaje, conductor: &mut Conductor)crear_viaje(conductor: &mut Conductor, pasajero: &Pasajero, origen: String, destino: String, ctx: &mut TxContext): Viajeesta_activo(viaje: &Viaje): bool
crear_registro(ctx: &mut TxContext): RegistroConductorescrear_registro_pasajeros(ctx: &mut TxContext): RegistroPasajeroseliminar_registro(registro: RegistroConductores)eliminar_registro_pasajeros(registro: RegistroPasajeros)
The project includes comprehensive tests covering:
- Driver registration and validation
- Passenger registration and validation
- Ride booking workflow
- Registry management
Run tests with:
sui move testThe project includes organized bash scripts that demonstrate how to use the Sui CLI to interact with the module:
A unified script that provides access to all functionality:
# Using the symlink (recommended)
./go_together [comando] [argumentos...]
# Or using the full path
./scripts/go_together.sh [comando] [argumentos...]Available commands:
# Development
./go_together build # Compilar el proyecto
./go_together publish # Publicar el módulo
./go_together test # Ejecutar tests unitarios
# Examples
./go_together example-simple # Ejecutar ejemplo simple
./go_together example-full # Ejecutar ejemplo completo
# Testing
./go_together test-conductor # Probar función crear_conductor
./go_together test-publish # Probar extracción de package ID
./go_together test-registry # Probar funciones de registro
./go_together test-trip # Probar función crear_viaje
# Operations
./go_together create-driver "John" "Toyota" <registry_id>
./go_together create-passenger "Mary" <registry_id>
./go_together create-trip "Downtown" "Airport" <driver_id> <passenger_id>
./go_together check-driver <driver_id>
./go_together check-trip <trip_id>
./go_together finalize-trip <trip_id> <driver_id>
# Utilities
./go_together clean # Limpiar archivos temporales
./go_together help # Mostrar ayudaA complete script that executes the entire carpooling flow:
./scripts/examples/ejemplo_uso.shA modular script for specific use cases:
# Build project
./scripts/examples/ejemplo_simple.sh build
# Publish module
./scripts/examples/ejemplo_simple.sh publish
# Create driver
./scripts/examples/ejemplo_simple.sh create-driver "John" "Toyota" <registry_id>
# Create passenger
./scripts/examples/ejemplo_simple.sh create-passenger "Mary" <registry_id>
# Create trip
./scripts/examples/ejemplo_simple.sh create-trip "Downtown" "Airport" <driver_id> <passenger_id>
# Check status
./scripts/examples/ejemplo_simple.sh check-driver <driver_id>
./scripts/examples/ejemplo_simple.sh check-trip <trip_id>
# Finalize trip
./scripts/examples/ejemplo_simple.sh finalize-trip <trip_id> <driver_id>Individual test scripts for specific functionality:
test_conductor.sh- Test driver creationtest_publish.sh- Test package publishingtest_registry.sh- Test registry functionstest_trip.sh- Test trip creation
- Sui CLI installed
- Connection to testnet/devnet
- SUI tokens for transactions
jqinstalled for JSON processing
See SCRIPT_EJEMPLO.md for detailed documentation.
go_together/
├── sources/
│ └── go_together.move # Main Move module
├── tests/
│ └── go_together_tests.move # Test suite
├── scripts/
│ ├── go_together.sh # Main unified script
│ ├── examples/
│ │ ├── ejemplo_uso.sh # Complete demonstration script
│ │ └── ejemplo_simple.sh # Modular script for specific cases
│ └── tests/
│ ├── test_conductor.sh # Test driver creation
│ ├── test_publish.sh # Test package publishing
│ ├── test_registry.sh # Test registry functions
│ └── test_trip.sh # Test trip creation
├── Move.toml # Project configuration
├── Move.lock # Dependency lock file
├── go_together # Symlink to main script (for easy access)
├── SCRIPT_EJEMPLO.md # Script documentation
└── README.md # This file
- Access Control: Only registered users can participate in rides
- Availability Management: Prevents double-booking of drivers
- Ownership Verification: Ensures only vehicle owners can register as drivers
- State Validation: Comprehensive checks before state changes
This application is built for the Sui blockchain, leveraging:
- Object Model: Using Sui's object-centric architecture
- Transfer System: Secure object transfers between users
- Transaction Context: Proper transaction handling and validation
- Global State: Decentralized storage of user registries
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please open an issue in the repository or contact the development team.
Note: This is a demonstration project for educational purposes. For production use, additional security audits and feature implementations would be required.