String privateKey = "x9oZ6jrUVEBDP5C0005fPseqPwLshQbb9io7Upg8sNM=";
String space = "space1";
String key = "key1";
BloqlyClient bloqlyClient = new BloqlyClient("http://localhost:8082");
Optional<SignedTransaction> txOpt = bloqlyClient.getLastTransaction(space, key);
Long nonce = txOpt.map(tx -> tx.getNonce() + 1).orElse(1L);
KeyPair keyPair = KeyPair.fromPrivateKeyEncoded(privateKey);
Transaction tx = new Transaction();
tx.setSpace(space);
tx.setKey(key);
tx.setNonce(nonce);
tx.setMemo("memo");
tx.setTimestamp(Instant.now().toEpochMilli());
tx.setValue("test-value");
List<String> tags = new ArrayList<>();
tags.add("tag1");
tags.add("tag2");
tx.setTags(tags);
SignedTransaction signedTx = keyPair.signTransaction(tx);
bloqlyClient.submitTransaction(signedTx);