Transaction extends NeoSerializable { @Override public int getSize() { return HEADER_SIZE + IOUtils.getVarSize(this.signers) + IOUtils.getVarSize(this.attributes) + IOUtils.getVarSize(this.script) + IOUtils.getVarSize(this.witnesses); } 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 getSize() { List<Signer> signers = new ArrayList<>(); signers.add(Signer.global(account1)); signers.add(Signer.calledByEntry(account2)); List<Witness> witnesses = new ArrayList<>(); witnesses.add(new Witness(new byte[]{0x00}, new byte[]{0x00})); Transaction tx = new Transaction(neow, (byte) 0, 0x01020304L, 0x01020304L, signers, BigInteger.TEN.pow(8).longValue(), 1L, new ArrayList<>(), new byte[]{(byte) OpCode.PUSH1.getCode()}, witnesses); int expectedSize = 1 + 4 + 8 + 8 + 4 + 1 + 1 + 20 + 1 + 20 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assertThat(tx.getSize(), is(expectedSize)); }