@Test public void createWitness() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { byte[] message = new byte[10]; Arrays.fill(message, (byte) 10); ECKeyPair keyPair = ECKeyPair.createEcKeyPair(); Witness witness = Witness.createWitness(message, keyPair); SignatureData expectedSig = Sign.signMessage(message, keyPair); String expected = "" + PUSHDATA1.toString() + "40" + Numeric.toHexStringNoPrefix(expectedSig.getConcatenated()); assertArrayEquals( Numeric.hexStringToByteArray(expected), witness.getInvocationScript().getScript()); expected = "" + PUSHDATA1.toString() + "21" + Numeric.toHexStringNoPrefix(keyPair.getPublicKey().getEncoded(true)) + PUSHNULL.toString() + SYSCALL.toString() + InteropServiceCode.NEO_CRYPTO_VERIFYWITHECDSASECP256R1.getHash(); assertArrayEquals( Numeric.hexStringToByteArray(expected), witness.getVerificationScript().getScript()); }
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();  }