3. Core Concepts
Understanding the fundamental concepts of the Amadeus Protocol SDK.
Keypairs
Amadeus Protocol uses BLS12-381 cryptography for all cryptographic operations. Each account has a public/private keypair.
Generating Keypairs
import { generateKeypair } from '@amadeus-protocol/sdk'
// Generate a new keypair
const keypair = generateKeypair()
console.log('Public Key:', keypair.publicKey) // Base58 encoded
console.log('Private Key:', keypair.privateKey) // Base58 encoded seed (64 bytes)Keypair Structure
Public Key: 48-byte BLS12-381 public key, Base58-encoded
Private Key: 64-byte seed, Base58-encoded (also called "Seed64")
Deriving Public Keys
import { derivePublicKeyFromSeedBase58 } from '@amadeus-protocol/sdk'
// Derive public key from existing seed
const publicKey = derivePublicKeyFromSeedBase58('5Kd3N...')
console.log('Public Key:', publicKey)Addresses
In Amadeus Protocol, public keys serve as addresses. They are Base58-encoded 48-byte BLS12-381 public keys.
Address Format
Address Characteristics
Length: Typically 87-88 characters (Base58 encoded)
Format: Base58-encoded public key
Uniqueness: Each keypair has a unique address
Public: Safe to share publicly (it's your public key)
Address Validation
Transactions
Transactions are the primary way to interact with the Amadeus blockchain. They must be:
Built with proper structure
Signed with the sender's private key
Serialized (packed) into binary format
Submitted to a node
Transaction Structure
Transaction Lifecycle
Transaction Nonces
Nonces are automatically generated using timestamps:
For high-frequency transactions, ensure sufficient time between transactions to avoid nonce collisions.
Amounts
AMA tokens use 9 decimal places. Always use atomic units for transactions.
Converting Amounts
Amount Precision
Always use toAtomicAma when building transactions:
Serialization
The SDK uses VecPack canonical serialization for deterministic encoding of transaction data.
Encoding
Decoding
Supported Types
nullbooleannumber/bigintstringUint8ArrayArrays
Objects / Maps
Signing
Transactions are signed using BLS12-381 signatures over the transaction hash.
Signing Process
Build transaction structure
Serialize transaction (canonical encoding)
Hash the serialized transaction (SHA-256)
Sign the hash with private key (BLS12-381)
Pack transaction with signature
Encoding Formats
Base58
Used for addresses, keys, and transaction hashes:
Base64
Used for encrypted data and binary payloads:
Encryption
The SDK provides password-based encryption for securing sensitive data.
Encrypting Data
Decrypting Data
Security Features
AES-GCM encryption with 256-bit keys
PBKDF2 key derivation with 100,000 iterations
Unique salt and IV for each encryption
Authenticated encryption (prevents tampering)
API Client
The SDK provides a unified API client for interacting with Amadeus nodes.
Initialization
API Modules
sdk.chain- Chain queries (tip, stats, entries)sdk.wallet- Wallet operations (balances, transactions)sdk.transaction- Transaction submissionsdk.contract- Contract interactionssdk.epoch- Epoch and validator datasdk.peer- Network peer informationsdk.proof- Validator proofs
Error Handling
All SDK errors are instances of AmadeusSDKError:
Next Steps
Now that you understand the core concepts:
Last updated