class AccountState {

    public byte[] getEncoded() {
        if (rlpEncoded == null) {
            byte[] nonce = RLP.encodeBigInteger(this.nonce);
            byte[] balance = RLP.encodeCoin(this.balance);
            byte[] stateRoot = RLP.encodeElement(this.stateRoot);
            byte[] codeHash = RLP.encodeElement(this.codeHash);
            if (stateFlags != 0) {
                byte[] stateFlags = RLP.encodeInt(this.stateFlags);
                this.rlpEncoded = RLP.encodeList(nonce, balance, stateRoot, codeHash, stateFlags);
            } else
                // do not serialize if zero to keep compatibility
            {
                this.rlpEncoded = RLP.encodeList(nonce, balance, stateRoot, codeHash);
            }
        }
        return rlpEncoded;
    }

    public  AccountState();
    public  AccountState(BigInteger nonce, Coin balance);
    public  AccountState(byte[] rlpData);

}