encodeRaw function

Uint8List encodeRaw(
  1. int version,
  2. Uint8List privateKey,
  3. bool compressed
)

Implementation

Uint8List encodeRaw(int version, Uint8List privateKey, bool compressed) {
  if (privateKey.length != 32) {
    throw ArgumentError('Invalid privateKey length');
  }
  Uint8List result = Uint8List(compressed ? 34 : 33);
  ByteData bytes = result.buffer.asByteData();
  bytes.setUint8(0, version);
  result.setRange(1, 33, privateKey);
  if (compressed) {
    result[33] = 0x01;
  }
  return result;
}