1

I am following the example described here:

https://github.com/iotaledger/iota.lib.java/blob/master/jota/src/test/java/jota/IotaMultisigTest.java

I put funds into a multisig. Now I want to move that funds out of the multisig address. Here is what I do:

private static final String TEST_SEED1 = "LRVLBLWMQWKDTDHDKTWXDDPUUECFSLIZPFXCSVHWOQQMG9GBMKRZSBHXFXYBENDHQSLUCNFCRHJTDRIED";
private static final String TEST_SEED2 = "BZOYLCAQGGAO9QI9HLWVXWQFZABMLFUCDPVZRYIBYGITEVWMVYVVYZPEJZFVCMVDERYRBPEUFXWDKLBBE";

private static final String REMAINDER_ADDRESS = "NZRALDYNVGJWUVLKDWFKJVNYLWQGCWYCURJIIZRLJIKSAIVZSGEYKTZRDBGJLOA9AWYJQB9IPWRAKUC9FBDRZJZXZG";
private static final String RECEIVE_ADDRESS = "GJQRMFGLIEQ9NKRKUUTGEZS9QEKERPLXPVMH9EYOPNDIWKHAWJEVPWXDUBEX9JXLAIAOWSUGJZCFBUVYX";
private static final String TEST_TAG = "JOTASPAM9999999999999999999";

private static String HOST = "13.58.231.155";
private static String PORT = "14265";
private static IotaAPI iotaAPI;
private static final String PROTOCOL = "http";



public static void main(String[] args) throws ArgumentException {
    iotaAPI = new IotaAPI.Builder().protocol(PROTOCOL).host(HOST).port(PORT).build();

       Multisig ms = new Multisig();

       String digestOne = ms.getDigest(TEST_SEED1, 3, 0);
       String initiatedMultisigDigests = ms.addAddressDigest(digestOne, "");
       System.out.println(initiatedMultisigDigests);
       String digestTwo = ms.getDigest(TEST_SEED2, 3, 0);
       String finalMultisigDigests = ms.addAddressDigest(digestTwo, initiatedMultisigDigests);
       String multiSigAddress = ms.finalizeAddress(finalMultisigDigests);

       List<Transfer> transfers = new ArrayList<>();
       transfers.add(new Transfer(RECEIVE_ADDRESS, 1, "", TEST_TAG));
       List<Transaction> trxs = iotaAPI.initiateTransfer(6, multiSigAddress, REMAINDER_ADDRESS, transfers, false);

       Bundle bundle = new Bundle(trxs, trxs.size());
       bundle = ms.addSignature(bundle, multiSigAddress, ms.getKey(TEST_SEED1, 0, 3));
       bundle = ms.addSignature(bundle, multiSigAddress, ms.getKey(TEST_SEED2, 0, 3));


       List<String> trytes = new ArrayList<>();
       for (Transaction tx : bundle.getTransactions()) {
            trytes.add(tx.toTrytes());
       }
       trxs = iotaAPI.sendTrytes(trytes.toArray(new String[trytes.size()]), 9,14,null);
}

This code executes fine and the transaction get posted to the tangle. You can see it here:

https://iotasear.ch/transaction/WSWISHOSHC9GVITFLEPGYUIMQNUMZFHXVBQPILNIYYJYCZPNIXGBLLILYXYPPCHIPVICZWPPURGQ99999

The big challenge is that this transaction doesn't seem valid. It is never confirmed and it does not even appear in the light wallet. Something is off that I can't figure out. I guess the question is mainly how to properly use the produced bundle so that it is properly processed by the network.

One thing I notice is that the signature of the bundle is 99999..9999; which means that it is empty.

Any insights would be appreciated.

  • 1
    Seems that (also on thetangle.org) only one of the 7 transactions of your bundle arrived. Incomplete bundles will not get confirmed, so make sure you get all transactions of your bundle posted. – mihi Apr 30 '18 at 18:27
0

quite late - but, I believe, your error occurred, because you did not reverse the order of your String array.

try a Collections.reverse(trytes) before sending the tx to the tangle with api.sendtrytes(). That most likely also explains, why thetangle.org did not properly pick up you bundle.

a good example can be found here (though in javascript): https://gist.github.com/domschiener/23b580d1bf4053c735c9e20721f8087b

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.