TRU3 Protocol API Reference
Complete reference documentation for the TRU3 Protocol API, including all methods, parameters, and return types.
Core API
The Core API provides the fundamental functionality for initializing and configuring the TRU3 Protocol.
Initialization
// Initialize the TRU3 Protocol client
const tru3 = new TRU3({
network: 'mainnet', // or 'testnet'
storage: {
type: 'arweave',
config: {
host: 'arweave.net',
port: 443,
protocol: 'https'
}
},
computation: {
type: 'ao',
config: {
process: 'PROCESS_ID'
}
},
identity: {
type: 'local', // or 'hsm', 'tpm', etc.
keyPath: '/path/to/keys' // Optional path to keys
}
});
// Check if the client is ready
const status = await tru3.status();
console.log(status.ready); // true or false
console.log(status.network); // 'mainnet' or 'testnet'
console.log(status.version); // TRU3 Protocol version
Configuration
// Update configuration
await tru3.configure({
trustFactors: {
identity: 0.3, // Weight for identity factor
history: 0.4, // Weight for history factor
behavior: 0.3 // Weight for behavior factor
},
verificationOptions: {
requireProofOfWork: true, // Require proof of work for verification
minimumConfidence: 0.8 // Minimum confidence level for verification
}
});
// Get current configuration
const config = await tru3.getConfiguration();
console.log(config.trustFactors);
console.log(config.verificationOptions);
Network Operations
// Get network status
const networkStatus = await tru3.getNetworkStatus();
console.log(networkStatus.nodes); // Number of active nodes
console.log(networkStatus.latency); // Average network latency
console.log(networkStatus.lastBlock); // Last processed block
// Switch networks
await tru3.switchNetwork('testnet');
console.log(await tru3.status()); // Updated status
API Versioning
The TRU3 Protocol API follows semantic versioning. The current version is v1.0.0
.
API Stability
- Core API: Stable
- Identity API: Stable
- Credentials API: Stable
- Verification API: Beta
- Trust Scoring API: Beta
Deprecation Policy
APIs marked as deprecated will be supported for at least 6 months after deprecation notice. Breaking changes will only be introduced in major version updates.