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.
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.
Check out the Java API documentation. Here's the relevant ManageDataOperation builder.
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();