Transaction extends NeoSerializable { public byte[] toArrayWithoutWitnesses() { try (ByteArrayOutputStream ms = new ByteArrayOutputStream()) { try (BinaryWriter writer = new BinaryWriter(ms)) { serializeWithoutWitnesses(writer); writer.flush(); return ms.toByteArray(); } } catch (IOException ex) { throw new UnsupportedOperationException(ex); } } Transaction();  Transaction(Neow3j neow, byte version, long nonce, long validUntilBlock, List<Signer> signers,
            long systemFee, long networkFee, List<TransactionAttribute> attributes, byte[] script,
            List<Witness> witnesses); byte getVersion(); long getNonce(); long getValidUntilBlock(); List<Signer> getSigners(); ScriptHash getSender(); long getSystemFee(); long getNetworkFee(); List<TransactionAttribute> getAttributes(); byte[] getScript(); List<Witness> getWitnesses(); void addWitness(Witness witness); String getTxId(); NeoSendRawTransaction send(); @Override int getSize(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); byte[] toArrayWithoutWitnesses(); byte[] getHashData(); @Override byte[] toArray(); static final int HEADER_SIZE; }
@Test public void toArrayWithoutWitness() { List<Signer> signers = new ArrayList<>(); signers.add(Signer.calledByEntry(account3)); Transaction tx = new Transaction(neow, (byte) 0, 226292130L, 2103398, signers, 9007990L, 1244390L, new ArrayList<>(), Numeric.hexStringToByteArray( "110c146cd3d4f4f7e35c5ee7d0e725c11dc880cef1e8b10c14c6a1c24a5b87fb8ccd7ac5f7948ffe526d4e01f713c00c087472616e736665720c1425059ecb4878d3a875f91c51ceded330d4575fde41627d5b5238"), new ArrayList<>()); byte[] expectedUnsignedBytes = Numeric.hexStringToByteArray( "00a2f17c0d7673890000000000e6fc1200000000006618200001c6a1c24a5b87fb8ccd7ac5f7948ffe526d4e01f7010055110c146cd3d4f4f7e35c5ee7d0e725c11dc880cef1e8b10c14c6a1c24a5b87fb8ccd7ac5f7948ffe526d4e01f713c00c087472616e736665720c1425059ecb4878d3a875f91c51ceded330d4575fde41627d5b5238"); assertThat(tx.toArrayWithoutWitnesses(), is(expectedUnsignedBytes)); }