Skip to main content

activeledger 1.0.0 copy "activeledger: ^1.0.0" to clipboard
activeledger: ^1.0.0 copied to clipboard

Activeledger SDK for Dart and Flutter. Onboard identities, sign payloads, and sign and submit transactions with secp256k1 and post-quantum ML-DSA-65 keys.

example/example.dart

import 'package:activeledger/activeledger.dart';

/// Onboards an identity and submits a transaction.
///
/// Run a node locally first (default port 5260), then:
///
///     dart run example/example.dart
Future<void> main() async {
  final ledger = Activeledger('http://localhost:5260');

  // secp256k1 is the smallest; KeyType.preferredPostQuantum gives
  // Falcon-512 when the add-on is enabled and ML-DSA-65 otherwise.
  final key = ledger.generateKey(
    'identity',
    type: KeyType.preferredPostQuantum,
  );

  final onboard = await ledger.onboard(key);
  print('Onboarded ${key.identity} (committed: ${onboard.committed})');

  final tx = ledger.transactions.labelledTransaction(
    key: key,
    namespace: 'default',
    contract: 'namespace',
    inputLabel: key.identity!,
    stream: key.identity!,
    inputData: {'namespace': 'example${DateTime.now().millisecondsSinceEpoch}'},
  );

  final response = await ledger.send(tx);
  if (!response.committed) {
    // A rejected transaction is still HTTP 200.
    print('Rejected: ${response.errors}');
  } else {
    print('Committed ${response.umid}');
  }

  await ledger.close();
}
0
likes
160
points
444
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Activeledger SDK for Dart and Flutter. Onboard identities, sign payloads, and sign and submit transactions with secp256k1 and post-quantum ML-DSA-65 keys.

Homepage
Repository (GitHub)
View/report issues

Topics

#activeledger #blockchain #dlt #post-quantum #cryptography

License

MIT (license)

Dependencies

http, pointycastle, pqcrypto, unorm_dart

More

Packages that depend on activeledger