build method

Transaction build(
  1. dynamic seed,
  2. int index,
  3. String curve, {
  4. String hashAlgo = 'sha256',
})

Generate the transaction address, keys and signatures @param {String | Uint8List} seed Transaction chain seed (hexadecimal or binary buffer) @param {Integer} index Number of transaction on the chain @param {String} curve Elliptic curve to use for the key generation @param {String} hashAlgo Hash algorithm to use for the address generation

Implementation

Transaction build(seed, int index, String curve,
    {String hashAlgo = 'sha256'}) {
  final KeyPair keypair = crypto.deriveKeyPair(seed, index, curve: curve);
  final KeyPair nextKeypair =
      crypto.deriveKeyPair(seed, index + 1, curve: curve);
  final Uint8List address =
      crypto.hash(nextKeypair.publicKey, algo: hashAlgo);

  this.address = uint8ListToHex(address);
  this.previousPublicKey = uint8ListToHex(keypair.publicKey);
  this.previousSignature = uint8ListToHex(
      crypto.sign(this.previousSignaturePayload(), keypair.privateKey));

  return this;
}