Token Based Floating License
Introduction
Babel Licensing Service represents a paradigm shift in software licensing, offering sophisticated token-based consumption models that provide unprecedented control over software usage and costs. This comprehensive guide demonstrates the implementation and testing of token consumption with floating licenses, showcasing how organizations can leverage usage-based licensing strategies that align expenses with actual software utilization.
Token-based licensing transcends traditional seat-based or time-based models by introducing a consumption-driven approach where customers purchase tokens that are depleted based on actual software usage. This methodology offers remarkable flexibility for customers with variable usage patterns, enables precise cost allocation based on real consumption metrics, and empowers software vendors to implement sophisticated pricing strategies that accurately reflect the value delivered to their customers.
Environment Setup
The demonstration environment utilizes a sophisticated Docker-based deployment that encompasses the complete Babel Licensing Service ecosystem. This containerized approach ensures consistency, reproducibility, and isolation while simplifying the deployment process across different environments.
Docker Infrastructure Overview
The Docker infrastructure consists of three primary components:
- MariaDB Database Container: Provides persistent storage for licensing data, customer information, and token balances
- Babel Licensing Service Container: The core licensing engine that manages license validation, token consumption, and reporting
- WordPress Container: Demonstrates integration capabilities with popular web platforms
Docker Configuration Files
AspNet.dockerfile
The Babel Licensing Service container is built using a custom Dockerfile that provides a optimized runtime environment:
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
# Add image metadata
LABEL maintainer="babelfor.net"
LABEL name="babel-licensing-service-net9"
LABEL version="11.0.0"
LABEL description="Babel Licensing Service 11.1 (.NET 9.0)"
# Update Ubuntu Software repository
RUN apt-get update
# Install unzip
RUN apt-get install -y unzip
# Unzip babel_service_datacenter_net90_11.1.0.3.zip to the /var/www/babel-lic directory
COPY babel_service_datacenter_net90_11.1.0.3.zip /tmp/
RUN mkdir -p /var/www/babel-lic && \
unzip /tmp/babel_service_datacenter_net90_11.1.0.3.zip -d /var/www/babel-lic && \
rm /tmp/babel_service_datacenter_net90_11.1.0.3.zip
# Expose service ports
EXPOSE 5005
EXPOSE 5455
# Set working directory
WORKDIR /var/www/babel-lic
# Set entrypoint
ENTRYPOINT [ "dotnet", "Babel.Licensing.Service.dll" ]This Dockerfile demonstrates several best practices:
- Multi-stage builds for optimized image size
- Proper metadata labeling for container identification
- Security considerations with package updates
- Port exposure for both gRPC (5005) and HTTPS (5455) interfaces
Docker Compose Configuration
The compose.yaml file orchestrates the entire licensing ecosystem:
services:
# Database
db:
image: mariadb:latest
restart: always
ports:
- '6603:3306'
volumes:
- ./wordpress.sql:/docker-entrypoint-initdb.d/wordpress.sql
- ./licenses.sql:/docker-entrypoint-initdb.d/licenses.sql
environment:
MARIADB_ROOT_PASSWORD: hjWrTSKa12PUoY
MARIADB_DATABASE: wordpress
MARIADB_USER: babel
MARIADB_PASSWORD: hjWrTSKa12PUoY
networks:
- babel-lic-wp-net
# WordPress
wordpress:
depends_on:
- db
container_name: babel-lic-wp-net9
restart: always
build:
dockerfile: WordPress.dockerfile
context: .
image: babel-licensing-wordpress:v11.1
ports:
- '8000:80'
volumes:
- type: bind
source: ./docker-uploads.ini
target: /usr/local/etc/php/conf.d/docker-uploads.ini
- type: bind
source: ./wp-config.php
target: /var/www/html/wp-config.php
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: hjWrTSKa12PUoY
WORDPRESS_DB_NAME: wordpress
networks:
- babel-lic-wp-net
# Babel Licensing
licensing:
depends_on:
- db
container_name: babel-lic-svc
restart: always
build:
dockerfile: AspNet.dockerfile
context: .
image: babel-licensing-service-net9-111:v11.1
ports:
- '5005:5005'
- '5455:5455'
volumes:
- type: bind
source: ./appsettings.json
target: /var/www/babel-lic/appsettings.json
- type: bind
source: ./babel.licenses
target: /var/www/babel-lic/babel.licenses
- type: bind
source: ./HttpKeys.pfx
target: /var/www/babel-lic/HttpKeys.pfx
environment:
ASPNETCORE_ENVIRONMENT: Production
BABEL_SERVICE_DATABASE__PROVIDER: MySQL
BABEL_SERVICE_CONNECTIONSTRINGS__MYSQL: Server=db;User=root;Password=hjWrTSKa12PUoY;Database=licenses
networks:
- babel-lic-wp-net
networks:
babel-lic-wp-net:Deployment Process
To deploy the complete Babel Licensing Service environment:
- Prepare the deployment directory with all required files:
babel_service_datacenter_net90_11.1.0.3.zip(Babel Licensing Service archive)appsettings.json(Service configuration)babel.licenses(License file for the service itself)HttpKeys.pfx(SSL certificate for HTTPS endpoints)- Database initialization scripts (
wordpress.sql,licenses.sql)
- Execute the deployment command:
docker-compose up -d- Verify service availability:
- Babel Licensing Service Web UI:
https://localhost:5455 - Babel Licensing Service HTTPS API:
https://localhost:5455(used by the client) - Babel Licensing Service Swagger UI:
https://localhost:5455/swagger - Babel Licensing Service gRPC API:
https://localhost:5005 - WordPress Integration:
http://localhost:8000 - MariaDB Database:
localhost:6603
- Babel Licensing Service Web UI:
Step-by-Step Testing Process
This comprehensive guide walks through the entire token consumption lifecycle:
- Environment Setup: Deploy the Docker infrastructure with all required services
- License Creation: Create a floating license with token balance support
- Token Allocation: Configure initial token balance (100 tokens)
- Client Execution: Run the floating client to consume tokens
- Monitoring: Observe real-time token consumption patterns
- Exhaustion Testing: Experience token exhaustion behavior
- Cleanup: Proper license release and resource management
Testing Timeline and Token Consumption
The floating client performs the following operations:
- Initial License Request (1 token consumed)
- Authenticates with the licensing service
- Requests allocation of a floating license
- Establishes client session
- Validation Cycle (100 iterations × 1 token = 100 tokens)
- Validates license every 200 milliseconds
- High-frequency consumption pattern simulates real-world usage
- Each validation consumes exactly 1 token
- License Release (1 token consumed, if tokens available)
- Returns license to the floating pool
- Completes the licensing lifecycle
- Enables other clients to use the license
Total Expected Consumption: 102 tokens (Request + 100 Validations + Release) Available Tokens: 100 Expected Behavior: Token exhaustion after 99 validation cycles
Step 1: Accessing the Babel Licensing Service Web Interface
Once the Docker environment is successfully deployed and all services are running, access the Babel Licensing Service Web UI by navigating to https://localhost:5455/. The web interface serves as the comprehensive management console for all licensing operations, providing intuitive access to license creation, token management, usage monitoring, and detailed analytics.
The authentication system uses the following default credentials:
- Username:
admin - Password:
admin
Security Consideration: In production environments, these default credentials must be changed immediately after initial setup. Consider implementing additional security measures such as multi-factor authentication, IP restrictions, and regular password rotation policies.
Upon successful authentication, you’ll gain access to the complete licensing management ecosystem, including:
- License creation and management
- Token balance administration
- Real-time usage monitoring
- Comprehensive reporting and analytics
- Customer and order management
- System configuration and maintenance tools
Step 2: Creating a Floating License with Token Support
Navigate to the Licenses section within the web interface to begin the license creation process. Floating licenses in Babel Licensing Service are engineered to support sophisticated usage models, including token-based consumption that provides granular control over software utilization.
License Configuration Process
- Select License Creation: Choose the option to create a new license from the main licenses dashboard.
- Choose License Template: Select an appropriate license template that supports floating license functionality. Templates provide pre-configured settings that ensure consistency across deployments while reducing configuration overhead.
- Configure License Parameters:
- License Type: Floating
- User Key:
UEGEB-FV5JY-CMZB5-9SUWQ - Sites: 100 (maximum concurrent users)
- Format: ASCII (for compatibility across different systems)
- Mode: Floating (enables token consumption features)
The user key serves as the unique identifier that client applications will use to authenticate and request access to licensed functionality. This key should be distributed through secure channels and may be integrated into customer management systems for automated provisioning.

As illustrated in the license details interface, the newly created license (ID: licCC5CD19B) demonstrates the comprehensive configuration options available:
- License ID:
licCC5CD19B(unique system identifier) - Name:
babelfor.NET(descriptive name for identification) - Issue Date:
7/19/2025, 11:07:41 AM(timestamp of license creation) - User Key:
UEGEB-FV5JY-CMZB5-9SUWQ(client authentication key) - Type:
Full(license edition or tier) - Email:
demo@babelfor.net(contact information) - Expire Date:
7/19/2026, 11:59:59 PM(license validity period) - Sites:
100(maximum concurrent users or installations)
The encoded license key contains all licensing parameters, restrictions, and cryptographic signatures necessary for client-side validation, ensuring that license terms are enforced even in disconnected scenarios.
Step 3: Establishing Token Balance Infrastructure
Token-based consumption requires the establishment of a sophisticated balance management system that tracks token allocation, consumption, and replenishment. This system provides the foundation for usage-based billing and ensures that software usage remains within purchased limits.
Token Balance Configuration
Navigate to the license management interface and locate the Balance section. Create a new token balance with the following specifications:

Configuration Parameters:
- Payment Type: Prepaid (tokens purchased in advance)
- Balance Type: Tokens (consumption-based units)
- Initial Token Amount: 100 (starting allocation)
- Current Token Balance: 0 (will be updated after allocation)
The prepaid model provides several advantages:
- Cost Control: Prevents usage beyond purchased allocation
- Budget Predictability: Enables accurate cost forecasting
- Risk Mitigation: Eliminates exposure to unexpected usage spikes
- Compliance: Supports regulatory requirements for expenditure controls
After configuring the token balance, the system provides comprehensive visibility into token allocation and consumption patterns:
.png)
The balance management interface displays:
- Type: Tokens (balance category)
- Order: (associated purchase order reference)
- Balance:
100 (100)(current balance with initial allocation) - Payment: Prepaid (payment model)
- Token Price:
$1.00(per-token cost) - Package: (token package identifier)
- Expires: (token expiration date, if applicable)
- Active: ✓ (balance status indicator)
Step 4: Deploying and Configuring the Floating Client Application
The floating client application serves as the demonstration vehicle for understanding token consumption patterns and behaviors under various operational scenarios. This application is designed to simulate real-world usage patterns while providing detailed logging and monitoring capabilities.
Client Configuration and Initialization
Launch the floating client application and configure it with the appropriate connection parameters:
- Service URL:
https://localhost:5005(gRPC endpoint) - License Key:
UEGEB-FV5JY-CMZB5-9SUWQ - Client Identifier: Unique identifier for this client instance
- Heartbeat Interval: Frequency of license validation requests
When prompted by the client application, enter the floating license key: UEGEB-FV5JY-CMZB5-9SUWQ
Press ENTER to initiate the licensing workflow. The client will:
- Establish secure communication with the Babel Licensing Service
- Authenticate using the provided license key
- Request allocation of a floating license token
- Begin periodic validation and heartbeat processes
Step 5: Real-Time Token Consumption Monitoring
Once the client application establishes communication with the licensing service, it begins consuming tokens based on its operational requirements. Each interaction with the licensing service represents a billable event that decrements the available token balance.
Consumption Patterns and Analytics
The token consumption system provides granular tracking of usage patterns:

The monitoring interface reveals detailed consumption analytics:
- Total Token Balance: 100 (initial allocation)
- Remaining Tokens: 84 (indicating 16 tokens consumed)
- Creation Date: 7/19/2025 (balance establishment date)
- Token Price: $1.00 (per-token cost for billing)
- Status: Active (balance availability status)
Step 6: Token Exhaustion Scenarios and Error Handling
As the client application continues its operational cycle, token consumption gradually depletes the available balance. The system implements sophisticated monitoring and alerting mechanisms to provide early warning of potential token exhaustion and ensure graceful handling of insufficient balance scenarios.

The console output demonstrates the complete token consumption lifecycle:
Phase 1: Normal Operation (Iterations 0-98)
0) License licCC5CD19B valid.
1) License licCC5CD19B valid.
...
98) License licCC5CD19B valid.During this phase, the client successfully validates its license with each request every 200 milliseconds, consuming one token per validation cycle. The system maintains detailed logs of each transaction for audit and debugging purposes. The rapid validation cycle (5 validations per second) demonstrates high-frequency token consumption scenarios.
Phase 2: Token Exhaustion (Iterations 98+)
Service error: Insufficient tokens available. Required: 1, Available: 0. (ResourceInvalidState)When the token balance reaches zero, the system generates a structured ServiceException with detailed error information:
- Exception Type:
Babel.Licensing.Service.ServiceException - Error Message: “Insufficient tokens available. Required: 1, Available: 0”
- Error Code:
ResourceInvalidState(structured error categorization) - Required Tokens: 1 (tokens needed for the operation)
- Available Tokens: 0 (remaining balance)
The client application handles this exception gracefully and terminates the validation loop, preventing infinite retry attempts that could impact system performance.
Final Token Balance State
After the client application completes its execution cycle, the token balance reflects the actual consumption that occurred during the testing process.
.png)
This real-world example showcases how token consumption can vary based on actual usage patterns, network conditions, and operational requirements.
Floating License Client Implementation
Complete Client Code
The following C# implementation demonstrates a complete floating license client with token consumption capabilities:
using Babel.Licensing;
using Babel.Licensing.Service;
// Create a new configuration object
BabelLicensingConfiguration config = new BabelLicensingConfiguration()
{
// Set the service URL
// ServiceUrl = "http://localhost:5005/", // GRPC
ServiceUrl = "https://localhost:5455/", // HTTPS
// ServiceUrl = "http://localhost:5000/", // HTTP
// Set the public key used to verify the license signature
SignatureProvider = RSASignature.FromKeys("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDE1VRiIdr6fiVZKve7NVgjIvGdRiRx0Mjjm+Yzf6tLbzFnxLs0fat5EoRcubxx0QQQDfydsJBE/fc7cwRWSrE2xK6X4Eb4W8O47pCMjqvTQZfDqQywEZJrLlxpp9hlKz6FDYX4SagrjmP1gdw8olo+n+IBz8ubkNxRhvycikxuDQIDAQAB"),
// Set a unique client ID in case multiple instances of the application are running on the same machine
ClientId = Guid.NewGuid().ToString(),
TokenUsageSettings = new TokenUsageSettings()
{
RequiredTokensOnRequest = 1,
RequiredTokensOnValidation = 1,
RequiredTokensOnRelease = 1,
RequiredTokensOnHeartbeat = 1
}
};
config.UseHttp(http => {
// Configure the HttpClient
http.Handler = new HttpClientHandler() {
// Allow self-signed certificates
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
};
});
// Create the client object used to communicate with the server
BabelLicensing client = new BabelLicensing(config);
// Ask the user to activate the license
Console.WriteLine("Please enter your floating license key: ");
string? userKey = Console.ReadLine();
try
{
var result = await client.RequestFloatingLicenseAsync(userKey, typeof(Program));
Console.WriteLine($"License {result.License.Id} requested.");
}
catch (Exception ex)
{
Console.WriteLine($"Could not request floating license: {ex.Message}");
return;
}
try
{
// Simulate a long task which requires the allocation of a license
for (int i = 0; i < 100; i++)
{
try
{
// Validate the license
// This will contact the server to validate the license
var result = await client.ValidateLicenseAsync(userKey, typeof(Program));
Console.WriteLine($"{i}) License {result.License.Id} valid.");
}
catch (ServiceException ex)
{
Console.WriteLine($"Service error: {ex.Message} ({ex.ErrorCode})");
return;
}
catch (Exception ex)
{
Console.WriteLine($"Could not validate license: {ex.Message}");
return;
}
// Wait 200 milliseconds
await Task.Delay(200);
}
try
{
// When the application is done with the license, it can release it
await client.ReleaseFloatingLicenseAsync(userKey);
Console.WriteLine("License released.");
}
catch (Exception ex)
{
Console.WriteLine($"Could not release license: {ex.Message}");
}
}
catch (Exception ex)
{
Console.WriteLine($"License not valid: {ex.Message}");
return;
}Code Structure and Key Components
1. Configuration Setup
BabelLicensingConfiguration config = new BabelLicensingConfiguration()
{
ServiceUrl = "https://localhost:5455/",
SignatureProvider = RSASignature.FromKeys("..."),
ClientId = Guid.NewGuid().ToString(),
TokenUsageSettings = new TokenUsageSettings() { ... }
};Purpose: Establishes the connection parameters and security settings for communicating with the Babel Licensing Service.
Key Elements:
- ServiceUrl: Specifies the HTTPS endpoint for the licensing service
- SignatureProvider: Contains the public key for license signature verification
- ClientId: Unique identifier for this client instance to support multiple concurrent clients
- TokenUsageSettings: Defines token consumption rules for different operations
2. HTTP Client Configuration
config.UseHttp(http => {
http.Handler = new HttpClientHandler() {
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
};
});Purpose: Configures the HTTP client to handle SSL certificate validation, particularly useful for development environments with self-signed certificates.
Security Note: In production environments, proper certificate validation should be implemented
3. License Request Phase
var result = await client.RequestFloatingLicenseAsync(userKey, typeof(Program));
Console.WriteLine($"License {result.License.Id} requested.");Purpose: Initiates the floating license session by requesting a license from the available pool.
Token Consumption: 1 token consumed for the initial request operation.
4. License Validation Loop
for (int i = 0; i < 100; i++)
{
var result = await client.ValidateLicenseAsync(userKey, typeof(Program));
Console.WriteLine($"{i}) License {result.License.Id} valid.");
await Task.Delay(200);
}Purpose: Simulates ongoing application usage by periodically validating the license.
Token Consumption: 1 token per validation cycle (up to 100 tokens total).
Frequency: Validation occurs every 200 milliseconds, creating a high-frequency consumption pattern for demonstration purposes.
5. Exception Handling
catch (ServiceException ex)
{
Console.WriteLine($"Service error: {ex.Message} ({ex.ErrorCode})");
return;
}Purpose: Provides structured error handling for service-specific exceptions, including token exhaustion scenarios.
Error Information: Displays both human-readable messages and structured error codes for programmatic handling.
6. License Release
await client.ReleaseFloatingLicenseAsync(userKey);
Console.WriteLine("License released.");Purpose: Properly returns the license to the floating pool when the application completes its work.
Token Consumption: 1 token consumed for the release operation.
Resource Management: Ensures that floating licenses are available for other clients to use.
Token Consumption Workflow
The client follows a predictable token consumption pattern:
- Initial Request: 1 token
- Validation Cycles: 1 token per cycle (up to 100 cycles)
- Release Operation: 1 token (if tokens remain available)
Total Potential Consumption: 102 tokens (1 + 100 + 1)
With only 100 tokens available in the demonstration, the client will experience token exhaustion during the validation phase, typically around the 80th iteration, depending on the exact token allocation and any background operations.
Practical Applications
This client implementation pattern can be adapted for various real-world scenarios:
- Desktop Applications: Long-running applications that periodically validate licensing
- Web Services: API services that check licensing on each request or at regular intervals
- Batch Processing: Applications that consume tokens based on processed items or time units
- Development Tools: IDEs or compilers that validate licensing during build processes
The flexible token consumption model allows organizations to implement precise usage-based billing that aligns costs with actual software utilization.
Conclusion and Future Considerations
The token-based floating license system demonstrated in this comprehensive guide represents a sophisticated approach to software licensing that addresses the evolving needs of modern software consumption patterns. By aligning costs directly with usage, organizations can implement fair and transparent pricing models that benefit both software vendors and customers.
Key Benefits Realized
The implementation demonstrates several critical advantages:
- Financial Transparency: Direct correlation between software usage and costs eliminates uncertainty in budget planning and cost allocation.
- Operational Flexibility: The system adapts to varying usage patterns without requiring complex license redistribution or administrative overhead.
- Scalability: The Docker-based deployment and sophisticated caching strategies ensure the system can scale to support enterprise-level deployments.
- Security: Multiple layers of cryptographic protection and comprehensive audit trails provide robust protection against unauthorized usage.
- Analytics: Rich usage data enables data-driven decision making for both software optimization and business strategy.
The Babel Licensing Service token system provides a proven, enterprise-ready platform for implementing sophisticated usage-based licensing strategies. Its combination of technical excellence, operational flexibility, and comprehensive management tools makes it an ideal choice for organizations seeking to modernize their licensing approaches and unlock new revenue opportunities in the evolving software marketplace.
Through careful implementation and ongoing optimization, token-based licensing can transform software licensing from a cost center into a strategic advantage that drives both customer satisfaction and business growth. The foundation established by this comprehensive system enables organizations to adapt quickly to changing market conditions while maintaining the security, compliance, and operational excellence required for enterprise software deployment.