--- title: "PDK Environment Configuration" description: "Comprehensive guide to configuring the Pluggable Development Kit (PDK) for Sonr plugins" icon: "gear" --- # PDK Environment Configuration The Pluggable Development Kit (PDK) provides a flexible configuration system for managing plugin environments, MPC enclaves, and runtime settings. ## Environment Variables ### Core PDK Variables | Variable | Type | Description | Default | | -------------- | -------- | --------------------------------- | ------------------ | | `chain_id` | `string` | Target blockchain network | `"sonr-testnet-1"` | | `enclave` | `object` | MPC enclave configuration | `{}` | | `vault_config` | `object` | Vault and key management settings | `{}` | | `log_level` | `string` | Logging verbosity | `"info"` | ## Enclave Configuration ### Basic Enclave Setup ```json { "enclave": { "id": "unique-enclave-identifier", "key_type": "secp256k1", "threshold": 2, "participants": [ { "id": "participant1", "public_key": "..." }, { "id": "participant2", "public_key": "..." } ] } } ``` ### Advanced Enclave Parameters ```json { "enclave": { "security_level": "high", "attestation_mode": "remote", "key_rotation_interval": "1h", "backup_strategy": "distributed" } } ``` ## Vault Configuration ### Key Management Settings ```json { "vault_config": { "storage_backend": "ipfs", "encryption": { "algorithm": "aes-256-gcm", "key_derivation": "pbkdf2" }, "access_control": { "mode": "role-based", "default_role": "viewer" } } } ``` ## Logging Configuration ```json { "log_level": "debug", "log_format": "json", "log_outputs": [ { "type": "stdout" }, { "type": "file", "path": "/var/log/sonr/pdk.log" } ] } ``` ## Performance Tuning ```json { "performance": { "max_concurrent_tasks": 10, "task_timeout": "5m", "memory_limit": "512MB", "cpu_allocation": 2 } } ``` ## Security Hardening ```json { "security": { "require_mfa": true, "allowed_key_types": ["secp256k1", "ed25519"], "audit_logging": true, "rate_limiting": { "max_requests_per_minute": 100 } } } ``` ## Plugin-Specific Configuration ```json { "plugins": { "motor": { "mpc_mode": "distributed", "token_generation_rate_limit": 10 }, "did": { "supported_methods": ["did:key", "did:sonr"] } } } ``` ## Environment Loading Precedence 1. Environment Variables 2. Configuration Files 3. Default Values ## Best Practices - Use environment-specific configurations - Implement strict access controls - Rotate encryption keys regularly - Monitor and log configuration changes - Use minimal privilege principles ## Example Configuration Loading ```go func loadPDKConfiguration() (*PDKConfig, error) { // Load from environment variables config := &PDKConfig{} // Override with config file if exists configFile, err := ioutil.ReadFile("/etc/sonr/pdk.json") if err == nil { json.Unmarshal(configFile, config) } return config, nil } ``` ## Troubleshooting - Check `log_level` for detailed diagnostics - Validate JSON configuration syntax - Verify key and enclave configurations ## Advanced Topics For more complex PDK configurations, refer to: - [DWN Plugin Documentation](/blockchain/modules/dwn/plugin) - [DWN Architecture Overview](/blockchain/modules/dwn/architecture)