archethic_lib_dart 0.2.2 copy "archethic_lib_dart: ^0.2.2" to clipboard
archethic_lib_dart: ^0.2.2 copied to clipboard

outdated

ArchEthic dart library for Flutter for Node and Browser. This library aims to provide a easy way to create ArchEthic transaction and to send them over the network

example/example.dart

import 'package:archethic_lib_dart/archethic_lib_dart.dart'
    show KeyPair, deriveKeyPair;
import 'package:archethic_lib_dart/src/model/transaction.dart';

void main(List<String> args) {
  /// It creates a new keypair into hexadecimal format
  KeyPair keypair = deriveKeyPair('mysuperpassphraseorseed', 0);

  /// Generate `address`, `timestamp`, `previousPublicKey`, `previousSignature`, `originSignature` of the transaction and
  /// serialize it using a custom binary protocol.
  var transaction = new Transaction(type: 'transfer')
      .addUCOTransfer(
          '00b1d3750edb9381c96b1a975a55b5b4e4fb37bfab104c10b0b6c9a00433ec4646',
          0.420)
      .build('mysuperpassphraseorseed', 0, 'P256');
  transaction.convertToJSON();

  /// Sign the transaction with an origin device private key
  final KeyPair originKeypair = deriveKeyPair('origin_seed', 0);
  var transaction2 = new Transaction(type: 'transfer')
      .addUCOTransfer(
          '00b1d3750edb9381c96b1a975a55b5b4e4fb37bfab104c10b0b6c9a00433ec4646',
          0.420)
      .build('mysuperpassphraseorseed', 0, 'P256')
      .originSign(originKeypair.privateKey);
  transaction2.convertToJSON();

  /// Export the transaction generated into JSON
  var transaction3 = new Transaction(type: 'transfer')
      .addUCOTransfer(
          '00b1d3750edb9381c96b1a975a55b5b4e4fb37bfab104c10b0b6c9a00433ec4646',
          0.420)
      .build('mysuperpassphraseorseed', 0, 'P256');
  transaction3.convertToJSON();
}
5
likes
0
pub points
62%
popularity

Publisher

verified publisherarchethic.net

ArchEthic dart library for Flutter for Node and Browser. This library aims to provide a easy way to create ArchEthic transaction and to send them over the network

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

crypto, crypto_keys, ecdsa, elliptic, http, logger, pinenacl, pointycastle, secp256k1, x25519

More

Packages that depend on archethic_lib_dart