Blockchain Services
Blockchain services connecting your institutional users and lab access control system to the blockchain
Spring Boot service for DecentraLabs that provides:
Authentication and authorization (
wallet,SAML,WebAuthnonboarding)Institutional wallet and treasury operations
Intent submission and authorization flows
Provider/consumer institutional provisioning
While it is designed so that it can be deployed as an independent container (use case for lab institutional consumers), it is also included in the Lab Gateway (use case for lab institutional providers).

This service provides four main components:
Authentication and Authorization Service: Web3-based JWT authentication with wallet challenges, SAML2 SSO integration, and WebAuthn support.
Institutional Wallet and Treasury: Ethereum wallet management and treasury operations for institutional lab providers and consumers.
Intent Authorization and Execution: signed intent intake, WebAuthn ceremony, and on-chain execution/status tracking.
Institution Provisioning: provider/consumer token application and Marketplace registration flows.
Together, they bridge institutional access control systems (such as Lab Gateway) with blockchain smart contracts in one backend.
✨ Key Features
Authentication and Authorization Service
Wallet Challenges: Web3 signature-based authentication with wallet verification.
SAML2 Integration: dual-path SSO flows (
/auth/saml-authand/auth/saml-auth2).JWT Management: OIDC/JWKS discovery, JWT issuance, and claim/scope-based access checks.
Smart Contract Validation: direct on-chain reservation/booking queries for booking-aware flows.
Institutional Wallet and Treasury
Wallet Management: create/import/reveal institutional wallets encrypted at rest (AES-256-GCM + PBKDF2).
Multi-Network Support: Mainnet/Sepolia operations with active-network switching and RPC fallback.
Treasury Operations: deposits, withdrawals, spending limits/periods, and institutional financial stats.
Reservation Engine: metadata-driven auto-approval/denial hooks for reservation requests.
Event Monitoring: contract event listener status and resilient event processing.
Intents and Provisioning
Intent Authorization: signed intent intake with JWT scope checks, SAML/WebAuthn validation, and EIP-712 verification.
WebAuthn Ceremony: authorize/status/complete flow for intent execution.
Institution Provisioning: provider/consumer token application, Marketplace JWKS validation, and registration flows.
🏗️ Architecture Overview
🔌 API Overview
Auth and identity
GET /.well-known/openid-configurationGET /auth/jwksGET /auth/messagePOST /auth/wallet-authPOST /auth/wallet-auth2POST /auth/saml-authPOST /auth/saml-auth2POST /auth/checkinPOST /auth/checkin-institutionalPOST /webauthn/registerPOST /webauthn/revokePOST /onboarding/webauthn/optionsPOST /onboarding/webauthn/complete
Wallet and treasury
POST /wallet/createPOST /wallet/importPOST /wallet/revealGET /wallet/{address}/balanceGET /wallet/{address}/transactionsGET /wallet/listen-eventsGET /wallet/networksPOST /wallet/switch-networkPOST /treasury/admin/executeGET /treasury/admin/statusGET /treasury/admin/balanceGET /treasury/admin/transactionsGET /treasury/admin/contract-infoGET /treasury/admin/treasury-infoGET /treasury/admin/top-spendersGET|POST /treasury/admin/notifications
Intents and provisioning
POST /intentsGET /intents/{requestId}POST /intents/authorizeGET /intents/authorize/status/{sessionId}GET /intents/authorize/ceremony/{sessionId}POST /intents/authorize/completeGET /institution-config/statusPOST /institution-config/save-and-registerPOST /institution-config/retry-registrationPOST /institution-config/apply-provider-tokenPOST /institution-config/apply-consumer-token
🚀 Quick Start (Local)
Build:
Run:
Verify:
http://localhost:8080/healthhttp://localhost:8080/wallet-dashboard
🐳 Quick Start (Docker)
Copy template env:
Provide JWT keys in
./config/keys(or adjustPRIVATE_KEY_PATH/PUBLIC_KEY_PATH).Start:
Open
http://localhost:8080/wallet-dashboardto create/import the institutional wallet.
⚙️ Configuration Files
Repository structure:
Docker container structure:
💡 Configuration priority: Environment variables >
.env(local file) > application.properties. For the institutional wallet specifically: env vars / secrets manager >wallet-config.properties(auto-generatedinstitutional.wallet.address+ encrypted password) > persisted wallet metadata.
🔒 Security Essentials
Never commit secrets or private keys.
Keep wallet/treasury routes behind trusted network/proxy boundaries.
If private-network access is enabled, enforce
TREASURY_TOKEN.Keep SAML trust mode on whitelist for production.
🔔 Reservation Notifications (email + ICS)
Enable with
NOTIFICATIONS_MAIL_ENABLED=trueand choose driverNOTIFICATIONS_MAIL_DRIVER=smtp|graph|noop(default: noop).Common settings:
NOTIFICATIONS_MAIL_FROM,NOTIFICATIONS_MAIL_DEFAULT_TO(comma-separated), andNOTIFICATIONS_MAIL_TIMEZONE(IANA zone, e.g.,Europe/Madrid).SMTP driver: configure
NOTIFICATIONS_MAIL_SMTP_HOST,PORT,USERNAME,PASSWORD, plusNOTIFICATIONS_MAIL_SMTP_STARTTLSwhen required.Microsoft Graph driver:
NOTIFICATIONS_MAIL_GRAPH_TENANT_ID,CLIENT_ID,CLIENT_SECRET,GRAPH_FROM(UPN/mailbox with Mail.Send app permission).ICS invite attached when start/end are available; subject
Reserva aprobada: <lab>and body includes lab, window, renter, payer, and tx hash.Runtime config (localhost):
GET/POST /treasury/admin/notificationsto view/update settings; persisted at./data/notifications-config.json.
📊 Monitoring & Health Checks
Actuator endpoints for monitoring and Kubernetes probes (restrict /actuator/** at the proxy if exposed publicly):
GET /actuator/health/liveness(liveness probe)GET /actuator/health/readiness(readiness probe)GET /actuator/prometheus(Prometheus scrape)GET /actuator/metrics(metrics index)GET /actuator/info(service metadata)
Keep /health for the detailed, app-specific checks used by Docker and external status pages:
Health endpoint available at /health:
🤝 Contributing
Fork the project
Create feature branch (
git checkout -b feature/AmazingFeature)Commit changes (
git commit -m 'Add AmazingFeature')Push to branch (
git push origin feature/AmazingFeature)Open Pull Request
📄 License
See LICENSE file for details.
Last updated