I am trying to send a data hashed using SCryptUtil provided by com.lambdaworks.crypto.SCryptUtil, convert it into array of bytes and send it to the stellar network using ManageDataOperation.Builder

My code is as follows

        String hash = SCryptUtil.scrypt("HashData", 16384, 8, 1);

        byte[] hashByte = hash.getBytes();

        ManageDataOperation.Builder updateHashedData = new ManageDataOperation.Builder("Hashed Data", hashByte);

        Transaction tt = new Transaction.Builder(sourceAccount)

The data is not sent to the server. But when I use a simple string for the "hash" variable like "Password", it gets sent. What am I missing here? Is there a way to send long hashcodes to stellar account in this way?

  • I don't understand the example. You declare hash, assign it to hashedData, but you don't use that variable after that. You use the bytes from a new variable, hashedPass in the builder call. Where does hashedPass get set? What's in it? – ire_and_curses Apr 29 '19 at 22:35
  • Hi, sorry I made some adjustments in the code. Now it is correct. – Ifham Apr 29 '19 at 22:41
  • How long (in bytes) is hashByte? – ire_and_curses Apr 30 '19 at 23:02
  • It's length is 150. – Ifham May 4 '19 at 20:19

The value of ManageDataOperation is limited in length (hashByte.length <= 64), if the length is exceeded, the submission will fail.

  • Thank You! So if I want to store data larger than that, I should be storing them off the chain? – Ifham May 5 '19 at 10:24
  • You can store the data off the chain and store the hash of the file on Stellar, another option is to store the file on IPFS and then save the hash on Stellar. I hope this article can help you. – overcat May 6 '19 at 2:07
  • Relevant doc: stellar.org/developers/guides/concepts/… – ire_and_curses May 6 '19 at 4:14

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.