1

I am new to stellar. I want to add a data to my stellar account as a key value pair. As in "Name"(Key) - "John"(Value). How can I achieve this?

Pointing me to a sample code would be really helpful. Thank You.

1
  • I've been asked to do this using "Manage Data" functionality in stellar
    – Ifham Pain
    Commented Apr 5, 2019 at 14:06

2 Answers 2

2

Check out the Java API documentation. Here's the relevant ManageDataOperation builder.

1
  • I have tried to read the documentation regarding it. But it is still too complicated for me. An example on how it is done will be really helpful. Like they have on TutorialsPoint relating java
    – Ifham Pain
    Commented Apr 6, 2019 at 16:08
0

I have found the way to do it by re-reading the documents.

What I needed to do was to attach the operation created by using ManageDataOperation.Builder() to the transaction. I have attached the sample code for future references.


ManageDataOperation.Builder manageDataOperation = new ManageDataOperation.Builder("Ownership", bt);

            Transaction tt = new Transaction.Builder(sourceAccount)
                    .addOperation(manageDataOperation.build())
                    .addMemo(Memo.text("Test Transaction")).setTimeout(1000)
                    .build();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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