default void writeBigIntegerScalar(final BigInteger v) {
    if (v.equals(BigInteger.ZERO)) {
      writeBytes(Bytes.EMPTY);
      return;
    }

    final byte[] bytes = v.toByteArray();
    // BigInteger will not include leading zeros by contract, but it always includes at least one
    // bit of sign (a zero here since it's positive). What that mean is that if the first 1 of the
    // resulting number is exactly on a byte boundary, then the sign bit constraint will make the
    // value include one extra byte, which will be zero. In other words, they can be one zero bytes
    // in practice we should ignore, but there should never be more than one.
    writeBytes(
        bytes.length > 1 && bytes[0] == 0
            ? Bytes.wrap(bytes, 1, bytes.length - 1)
            : Bytes.wrap(bytes));
  }
Writes a scalar (encoded with no leading zeroes).

@param v The scalar to write.
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java