@Test public void serializeWithWitness() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { byte[] message = new byte[10]; Arrays.fill(message, (byte) 10); ECKeyPair keyPair = ECKeyPair.createEcKeyPair(); Witness witness = Witness.createWitness(message, keyPair); byte[] invScript = InvocationScript.fromMessageAndKeyPair(message, keyPair).getScript(); byte[] invScriptLen = BigInteger.valueOf(invScript.length).toByteArray(); byte[] veriScript = new VerificationScript(keyPair.getPublicKey()).getScript(); byte[] veriScriptLen = BigInteger.valueOf(veriScript.length).toByteArray(); byte[] expectedWitness = concatenate(invScriptLen, invScript, veriScriptLen, veriScript); assertArrayEquals(expectedWitness, witness.toArray()); }
public static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair) { InvocationScript i = InvocationScript.fromMessageAndKeyPair(messageToSign, keyPair); VerificationScript v = new VerificationScript(keyPair.getPublicKey()); return new Witness(i, v); }
Witness extends NeoSerializable { public static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair) { InvocationScript i = InvocationScript.fromMessageAndKeyPair(messageToSign, keyPair); VerificationScript v = new VerificationScript(keyPair.getPublicKey()); return new Witness(i, v); } }
Witness extends NeoSerializable { public static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair) { InvocationScript i = InvocationScript.fromMessageAndKeyPair(messageToSign, keyPair); VerificationScript v = new VerificationScript(keyPair.getPublicKey()); return new Witness(i, v); } Witness();  Witness(byte[] invocationScript, byte[] verificationScript);  Witness(InvocationScript invocationScript, VerificationScript verificationScript);  Witness(byte[] invocationScript, ScriptHash scriptHash); }
Witness extends NeoSerializable { public static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair) { InvocationScript i = InvocationScript.fromMessageAndKeyPair(messageToSign, keyPair); VerificationScript v = new VerificationScript(keyPair.getPublicKey()); return new Witness(i, v); } Witness();  Witness(byte[] invocationScript, byte[] verificationScript);  Witness(InvocationScript invocationScript, VerificationScript verificationScript);  Witness(byte[] invocationScript, ScriptHash scriptHash); static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair); static Witness createMultiSigWitness(int signingThreshold,
                                                  List<SignatureData> signatures,
                                                  List<ECPublicKey> publicKeys); static Witness createMultiSigWitness(List<SignatureData> signatures,
                                                  VerificationScript verificationScript); InvocationScript getInvocationScript(); VerificationScript getVerificationScript(); ScriptHash getScriptHash(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override int getSize(); }
Witness extends NeoSerializable { public static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair) { InvocationScript i = InvocationScript.fromMessageAndKeyPair(messageToSign, keyPair); VerificationScript v = new VerificationScript(keyPair.getPublicKey()); return new Witness(i, v); } Witness();  Witness(byte[] invocationScript, byte[] verificationScript);  Witness(InvocationScript invocationScript, VerificationScript verificationScript);  Witness(byte[] invocationScript, ScriptHash scriptHash); static Witness createWitness(byte[] messageToSign, ECKeyPair keyPair); static Witness createMultiSigWitness(int signingThreshold,
                                                  List<SignatureData> signatures,
                                                  List<ECPublicKey> publicKeys); static Witness createMultiSigWitness(List<SignatureData> signatures,
                                                  VerificationScript verificationScript); InvocationScript getInvocationScript(); VerificationScript getVerificationScript(); ScriptHash getScriptHash(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override int getSize();  }