I am creating a multi-sign transaction. When I am submitting the transaction to Stellar, response.isSuccess()
returns false
. Could anyone tell me where I am going wrong? link https://www.stellar.org/developers/js-stellar-base/reference/base-examples.html#multi-signature-account
public static void main(String[] args) {
Network.useTestNetwork();
Server server = new Server("https://horizon-testnet.stellar.org");
KeyPair source = KeyPair.fromSecretSeed("SC4EJSKMHQLHRUWFYC7O62OP2QPQ2HD7IOXCHKR2STVPAQ6E5MBXXRAI");
KeyPair source1 = KeyPair.fromSecretSeed("SCR5ARAIDZ6EW4NRVFUP35CY444S3D4H52GIVKW46D736UFFVQFLLVY4");
KeyPair secondary1 = KeyPair.fromAccountId("GAU3GFO7L3TECSZ2ARAHACTQ44QKHKU355PHWBLRIWHXIDXBRHMNOYVQ");
KeyPair destination = KeyPair.fromAccountId("GCFOSKTU4N4OPOXFGA473V2DG36QBCHNPHXOLU4W2BZL5TZH4GCZS5BN");
try {
server.accounts().account(destination);
} catch (IOException e1) {
e1.printStackTrace();
}
AccountResponse sourceAccount = null;
try {
sourceAccount = server.accounts().account(source);
sourceAccount = server.accounts().account(source1);
} catch (IOException e1) {
e1.printStackTrace();
}
Transaction transaction = new Transaction.Builder(sourceAccount)
.addOperation(new SetOptionsOperation.Builder().setSigner(secondary1.getXdrSignerKey(), 1)
.setMasterKeyWeight(1).setLowThreshold(0)
.setMediumThreshold(2).setHighThreshold(2).build())
.build();
transaction.sign(source);
transaction = new Transaction.Builder(sourceAccount)
.addOperation(new PaymentOperation.Builder(destination, new AssetTypeNative(), "11").build())
.addMemo(Memo.text("Test Transaction"))
.build();
transaction.sign(source);
transaction.sign(source1);
try {
SubmitTransactionResponse response = server.submitTransaction(transaction);
System.out.println(response.isSuccess());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}