archethic_lib_dart 0.0.12+12 copy "archethic_lib_dart: ^0.0.12+12" to clipboard
archethic_lib_dart: ^0.0.12+12 copied to clipboard

outdated

ArchEthic dart library for Flutter based on Official ArchEthic Javascript library for Node and Browser

example/example.dart

import 'package:archethic_lib_dart/crypto.dart' as crypto;
import 'package:archethic_lib_dart/model/key_pair.dart';
import 'package:archethic_lib_dart/transaction_builder.dart';
  
void main(List<String> args) {
  // It creates a new keypair into hexadecimal format
  KeyPair keypair = crypto.deriveKeyPair("mysuperpassphraseorseed", 0);
  
  // Generate `address`, `timestamp`, `previousPublicKey`, `previousSignature`, `originSignature` of the transaction and 
  // serialize it using a custom binary protocol.
  var transaction = new TransactionBuilder("transfer")
    .addUCOTransfer("00b1d3750edb9381c96b1a975a55b5b4e4fb37bfab104c10b0b6c9a00433ec4646", 0.420) 
    .build("mysuperpassphraseorseed", 0, 'P256');

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

  // Export the transaction generated into JSON
  var transaction3 = new TransactionBuilder("transfer")
    .addUCOTransfer("00b1d3750edb9381c96b1a975a55b5b4e4fb37bfab104c10b0b6c9a00433ec4646", 0.420) 
    .build("mysuperpassphraseorseed", 0, 'P256') 
    .toJSON();
}
6
likes
0
pub points
54%
popularity

Publisher

verified publisherarchethic.net

ArchEthic dart library for Flutter based on Official ArchEthic Javascript library for Node and Browser

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

asn1lib, convert, crypto, crypto_keys, ecdsa, elliptic, http, pinenacl, pointycastle, secp256k1

More

Packages that depend on archethic_lib_dart