Submit a message
Now you are ready to submit your first message to the topic. To do this, you will use TopicMessageSubmitTransaction(). For this transaction, you will provide the topic ID and the message to submit to
Step 1 : Imports
const {
PrivateKey,
TopicMessageSubmitTransaction,
Client
} = require("@hashgraph/sdk");
require('dotenv').config({ path: 'Consensus_Service/.env' });Step 2 : Environment Variables Retrieval
const myAccountId = process.env.MY_ACCOUNT_ID;
const myPrivateKey = PrivateKey.fromString(process.env.MY_PRIVATE_KEY);
const topicId = process.env.TOPIC_ID;Step 3 : Validation
Step 4 : Main Function
Last updated