Transaction { public synchronized byte[] getEncoded() { if (rlpEncoded != null) return rlpEncoded; byte[] nonce = null; if (this.nonce == null || this.nonce.length == 1 && this.nonce[0] == 0) { nonce = RLP.encodeElement(null); } else { nonce = RLP.encodeElement(this.nonce); } byte[] gasPrice = RLP.encodeElement(this.gasPrice); byte[] gasLimit = RLP.encodeElement(this.gasLimit); byte[] receiveAddress = RLP.encodeElement(this.receiveAddress); byte[] value = RLP.encodeElement(this.value); byte[] data = RLP.encodeElement(this.data); byte[] v, r, s; if (signature != null) { int encodeV; if (chainId == null) { encodeV = signature.v; } else { encodeV = signature.v - LOWER_REAL_V; encodeV += chainId * 2 + CHAIN_ID_INC; } v = RLP.encodeInt(encodeV); r = RLP.encodeElement(BigIntegers.asUnsignedByteArray(signature.r)); s = RLP.encodeElement(BigIntegers.asUnsignedByteArray(signature.s)); } else { v = chainId == null ? RLP.encodeElement(EMPTY_BYTE_ARRAY) : RLP.encodeInt(chainId); r = RLP.encodeElement(EMPTY_BYTE_ARRAY); s = RLP.encodeElement(EMPTY_BYTE_ARRAY); } this.rlpEncoded = RLP.encodeList(nonce, gasPrice, gasLimit, receiveAddress, value, data, v, r, s); this.hash = HashUtil.sha3(rlpEncoded); return rlpEncoded; } Transaction(byte[] rawData);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       Integer chainId);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       byte[] r, byte[] s, byte v, Integer chainId);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       byte[] r, byte[] s, byte v); long transactionCost(BlockchainNetConfig config, Block block); synchronized void verify(); synchronized void rlpParse(); boolean isParsed(); byte[] getHash(); byte[] getRawHash(); byte[] getNonce(); boolean isValueTx(); byte[] getValue(); byte[] getReceiveAddress(); byte[] getGasPrice(); byte[] getGasLimit(); long nonZeroDataBytes(); long zeroDataBytes(); byte[] getData(); ECDSASignature getSignature(); byte[] getContractAddress(); boolean isContractCreation(); ECKey getKey(); synchronized byte[] getSender(); Integer getChainId(); void sign(byte[] privKeyBytes); void sign(ECKey key); @Override String toString(); String toString(int maxDataSize); byte[] getEncodedRaw(); synchronized byte[] getEncoded(); @Override int hashCode(); @Override boolean equals(Object obj); static Transaction createDefault(String to, BigInteger amount, BigInteger nonce); static Transaction createDefault(String to, BigInteger amount, BigInteger nonce, Integer chainId); static Transaction create(String to, BigInteger amount, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit); static Transaction create(String to, BigInteger amount, BigInteger nonce, BigInteger gasPrice,
                                     BigInteger gasLimit, Integer chainId); static final int HASH_LENGTH; static final int ADDRESS_LENGTH; static final MemSizeEstimator<Transaction> MemEstimator; }
@Ignore @Test public void encodeReceiptTest() { String data = "f90244a0f5ff3fbd159773816a7c707a9b8cb6bb778b934a8f6466c7830ed970498f4b688301e848b902000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dbda94cd2a3d9f938e13cd947ec05abc7fe734df8dd826c083a1a1a1"; byte[] stateRoot = Hex.decode("f5ff3fbd159773816a7c707a9b8cb6bb778b934a8f6466c7830ed970498f4b68"); byte[] gasUsed = Hex.decode("01E848"); Bloom bloom = new Bloom(Hex.decode("0000000000000000800000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")); LogInfo logInfo1 = new LogInfo( Hex.decode("cd2a3d9f938e13cd947ec05abc7fe734df8dd826"), null, Hex.decode("a1a1a1") ); List<LogInfo> logs = new ArrayList<>(); logs.add(logInfo1); TransactionReceipt receipt = new TransactionReceipt(stateRoot, gasUsed, bloom, logs); assertEquals(data, Hex.toHexString(receipt.getEncoded())); }