Submit a message
Methods
Method
Type
Description
Requirement
//Create the transaction
TopicMessageSubmitTransaction transaction = new TopicMessageSubmitTransaction()
.setTopicId(newTopicId)
.setMessage("hello, HCS! ");
//Sign with the client operator key and submit transaction to a Hedera network, get transaction ID
TransactionResponse txResponse = transaction.execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0//Create the transaction
await new TopicMessageSubmitTransaction({
topicId: createReceipt.topicId,
message: "Hello World",
}).execute(client);
//v2.0.0Get transaction values
Method
Type
Description
Last updated