{"id":15949,"date":"2022-02-09T16:55:00","date_gmt":"2022-02-09T16:55:00","guid":{"rendered":"https:\/\/hederav2stg.wpenginepowered.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/"},"modified":"2025-12-10T05:14:22","modified_gmt":"2025-12-10T05:14:22","slug":"how-to-get-event-information-from-hedera-smart-contracts","status":"publish","type":"post","link":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/","title":{"rendered":"How to Get Event Information from Hedera Smart Contracts"},"content":{"rendered":"<div class=\"body-text BodyCopy mb-40 style-1\">\n<p>Events in Solidity provide a way to log things and actions that take place in your smart contracts. In this article, you will learn how to get human-readable event information from contract logs using <strong><u>transaction records <\/u><\/strong>and<strong><u> mirror nodes<\/u><\/strong>. <\/p>\n<p>You will use the Hedera JavaScript SDK and mirror node REST API with libraries like <em>web3.js<\/em> and <em>ethers.js<\/em>.<\/p>\n<h4 class=\"color-ultraviolet\">Try It Yourself<\/h4>\n<ul>\n<li>Get a <a href=\"https:\/\/portal.hedera.com\/register\" target=\"_blank\">Hedera testnet account<\/a><\/li>\n<li>This <a href=\"https:\/\/codesandbox.io\/s\/hedera-example-contract-event-info-web3js-rskhs?file=\/index.js\" target=\"_blank\">Codesandbox<\/a> is already setup for you to try this example\n<ul>\n<li>Remember to provide your testnet account credentials in the .env file<\/li>\n<li>And open a new terminal to execute index.js<\/li>\n<\/ul>\n<\/li>\n<li>Get <a href=\"https:\/\/github.com\/hashgraph\/hedera-smart-contracts-libs-lab\/tree\/main\/javascriptWithWeb3js\" target=\"_blank\">the code from GitHub<\/a>\n<ul>\n<li>Includes index.js, stateful.sol, abi.json, bytecode.json, and more.<\/li>\n<li><a href=\"https:\/\/github.com\/hashgraph\/hedera-smart-contracts-libs-lab\" target=\"_blank\">This repository<\/a> implements this same example with other languages and libraries<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4 class=\"color-ultraviolet\">How Are Events Used?<\/h4>\n<p>Here\u2019s how you declare and emit events in Solidity:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">\/\/Declare an Event\nevent Deposit(address indexed _from, bytes32 indexed _id, uint _value);\n\n\/\/Emit an event\nemit Deposit(msg.sender, _id, msg.value);\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p>When an event is emitted, it stores the arguments in a special on-chain data structure called the transaction log. Logs are associated with the address of a contract; however, logs and their event data are not accessible from within contracts. <\/p>\n<p>Logs are composed of <strong><em>topics<\/em><\/strong> and <strong><em>data<\/em><\/strong>. When you use the attribute <strong>indexed<\/strong> for event arguments, they are added to the <em>topics<\/em> part of the log, not the <em>data<\/em>. Doing this can be useful because <em>topics<\/em> allow you to search for events. On the other hand, all arguments that don\u2019t use the <strong>indexed<\/strong> attribute are added to the <em>data<\/em> part of the log.<\/p>\n<h4 class=\"color-ultraviolet\">Access Event Information from a Hedera Contract<\/h4>\n<p>The contract to deploy is called <strong>StatefulContract<\/strong>, and it is simply a getter-setter contract that changes and reads the state variable <strong>message<\/strong>, which is of type string. In addition, the contract has the event <strong>SetMessage<\/strong> that captures changes to the state variable. <\/p>\n<p>The contract looks like this:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">pragma solidity ^0.6.12;\n\ncontract StatefulContract {\n    \/\/ sample event\n    event SetMessage(address indexed from, string message);\n\n    \/\/ the message we're storing\n    string message;\n\n    constructor(string memory message_) public {\n        emit SetMessage(msg.sender, message_);\n        message = message_;\n    }\n\n    function set_message(string memory message_) public {\n        emit SetMessage(msg.sender, message_);\n        message = message_;\n    }\n\n    \/\/ return a string\n    function get_message() public view returns (string memory messageOut) {\n        messageOut = message;\n    }\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p>Now, <a href=\"https:\/\/github.com\/hashgraph\/hedera-smart-contracts-libs-lab\/tree\/main\/javascriptWithWeb3js\" target=\"_blank\">this entire example in JavaScript<\/a> runs through the seven steps below, but we\u2019ll focus only on steps six and seven:<\/p>\n<ol>\n<li>Deploy the contract on Hedera with a \u201cHello Hedera\u201d message (this      emits a SetMessage event)<\/li>\n<li>Query the contract for the current message value<\/li>\n<li>Set the contract message to \u201cHello again\u201d (this emits a SetMessage      event)<\/li>\n<li>Use a query to fetch the contract&#8217;s current message value      (get_message)<\/li>\n<li>Use a transaction to fetch the contract&#8217;s current message value      (get_message)<\/li>\n<li><strong>Call set_message with the      current date time as a parameter (this emits a SetMessage event) AND fetch      the emitted event using a record<\/strong><\/li>\n<li><strong>Fetch all the events for the contract      using a mirror node query<\/strong><\/li>\n<\/ol>\n<p>Here is the console output when you run the entire example:<\/p>\n<\/div>\n<figure class=\"blog-image mb-40\"><img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-1.png\" alt=\"\"\/><\/figure>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p>Here is the <strong>main<\/strong><br \/>\nfunction that implements those seven steps:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">async function main() {\n\t\/\/ deploy the contract to Hedera from bytecode\n\tconst contractId = await deployContract();\n\n\t\/\/ query the contract's get_message function\n\tawait queryGetMessage(contractId);\n\n\t\/\/ call the contract's set_message function\n\tawait callSetMessage(contractId, \"Hello again\");\n\n\t\/\/ query the contract's get_message function\n\tawait queryGetMessage(contractId);\n\n\t\/\/ call the contract's get_message function\n\tawait callGetMessage(contractId);\n\n\t\/\/ get call events from a transaction record\n\tawait getEventsFromRecord(contractId);\n\n\t\/\/ get contract events from a mirror node\n\tawait getEventsFromMirror(contractId);\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<h4 class=\"color-ultraviolet\"><strong>Get Event Information Using Transaction Records<\/strong><\/h4>\n<p>Let\u2019s take a closer look at the function <strong>getEventsFromRecord <\/strong>(see below). This function sets the state variable, <strong>message<\/strong>, to the current date and time by calling the <strong>set_message<\/strong> function of the contract with the <strong>ContractExecuteTransaction()<\/strong> module. <\/p>\n<p>From the Solidity code, doing this emits a <strong>SetMessage<\/strong> event. A record of the transaction is then obtained because it contains the output of the function as well as events. The changes to the contract state variable are checked by calling the <strong>queryGetMessage<\/strong><br \/>\nfunction. <\/p>\n<p>Finally, the events contained in the record are decoded (parsed) using web3.js to get human-readable information. Note that both the <strong>data<\/strong> and <strong>topics<\/strong> from the event logging exists in <strong>record.contractFunctionResults.logs<\/strong>.<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">async function getEventsFromRecord(contractId) {\n\tconsole.log(`nGetting event(s) from record`);\n\n\t\/\/ calling \"set_message\" with the current date\/time to generate a new event\n\tconst newMessage = new Date().toLocaleString();\n\t\/\/ generate function call with function name and parameters\n\tconst functionCallAsUint8Array = encodeFunctionCall(\"set_message\", [newMessage]);\n\n\tconsole.log(`Calling set_message to trigger new event`);\n\t\/\/ execute the transaction calling the set_message contract function\n\tconst transaction = await new ContractExecuteTransaction()\n\t\t.setContractId(contractId)\n\t\t.setFunctionParameters(functionCallAsUint8Array)\n\t\t.setGas(100000)\n\t\t.execute(client);\n\n\t\/\/ a record contains the output of the function\n\t\/\/ as well as events, let's get events for this transaction\n\tconst record = await transaction.getRecord(client);\n\n\t\/\/ query the contract's get_message function to witness update\n\tawait queryGetMessage(contractId);\n\n\t\/\/ the events from the function call are in record.contractFunctionResult.logs.data\n\t\/\/ let's parse the logs using web3.js\n\t\/\/ there may be several log entries\n\trecord.contractFunctionResult.logs.forEach((log) => {\n\t\t\/\/ convert the log.data (uint8Array) to a string\n\t\tlet logStringHex = \"0x\".concat(Buffer.from(log.data).toString(\"hex\"));\n\n\t\t\/\/ get topics from log\n\t\tlet logTopics = [];\n\t\tlog.topics.forEach((topic) => {\n\t\t\tlogTopics.push(\"0x\".concat(Buffer.from(topic).toString(\"hex\")));\n\t\t});\n\n\t\t\/\/ decode the event data\n\t\tconst event = decodeEvent(\"SetMessage\", logStringHex, logTopics.slice(1));\n\n\t\t\/\/ output the from address stored in the event\n\t\tconsole.log(\n\t\t\t`Record event: from '${AccountId.fromSolidityAddress(event.from).toString()}' update to '${event.message}'`\n\t\t);\n\t});\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<h4 class=\"color-ultraviolet\"><strong>Auxiliary Functions<\/strong><\/h4>\n<p>Below are the functions (and dependencies) used by the <strong>getEventsFromRecord<\/strong> function. Note that the usage of <em>web3.js<\/em> is shown in the last three functions to encode and decode function results, parameters, and events.<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">async function queryGetMessage(contractId) {\n    console.log(`nget_message Query`);\n    \/\/ generate function call with function name and parameters\n    const functionCallAsUint8Array = encodeFunctionCall(\"get_message\", []);\n\n    \/\/ query the contract\n    const contractCall = await new ContractCallQuery()\n        .setContractId(contractId)\n        .setFunctionParameters(functionCallAsUint8Array)\n        .setQueryPayment(new Hbar(2))\n        .setGas(100000)\n        .execute(client);\n\n    let results = decodeFunctionResult(\"get_message\", contractCall.bytes);\n    console.log(results);\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\"><\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function decodeFunctionResult(functionName, resultAsBytes) {\n    const functionAbi = abi.find((func) => func.name === functionName);\n    const functionParameters = functionAbi.outputs;\n    const resultHex = \"0x\".concat(Buffer.from(resultAsBytes).toString(\"hex\"));\n    const result = web3.eth.abi.decodeParameters(functionParameters, resultHex);\n    return result;\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\"><\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function encodeFunctionCall(functionName, parameters) {\n    const functionAbi = abi.find((func) => func.name === functionName && func.type === \"function\");\n    const encodedParametersHex = web3.eth.abi.encodeFunctionCall(functionAbi, parameters).slice(2);\n    return Buffer.from(encodedParametersHex, \"hex\");\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\"><\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function decodeEvent(eventName, log, topics) {\n    const eventAbi = abi.find((event) => event.name === eventName && event.type === \"event\");\n    const decodedLog = web3.eth.abi.decodeLog(eventAbi.inputs, log, topics);\n    return decodedLog;\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<h4 class=\"color-ultraviolet\"><strong>Get Event Information Using Mirror Nodes<\/strong><\/h4>\n<p>Now let\u2019s take a closer look at the function <strong>getEventsFromMirror <\/strong>(see below). This function introduces a delay of 10 seconds to allow transaction propagation to the mirror nodes. After the 10 seconds, a URL is created with the mirror node REST API (learn more about the mirror node API <a href=\"https:\/\/hedera.com\/blog\/how-to-look-up-transaction-history-on-hedera-using-mirror-nodes-back-to-the-basics\" target=\"_blank\">here<\/a>) and the <a href=\"https:\/\/www.npmjs.com\/package\/axios\" target=\"_blank\">axios<\/a> client is used to obtain the logs from the mirror query. Iterating through the logs is necessary in case there are multiple log entries, which is true in this case. Finally, decoding the events with the <strong>decodeEvent<\/strong><br \/>\nfunction is the last step before outputting a human-readable message to the console with information from each event. <\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">async function getEventsFromMirror(contractId) {\n\tconst delay = (ms) => new Promise((res) => setTimeout(res, ms));\n\tconsole.log(`nGetting event(s) from mirror`);\n\tconsole.log(`Waiting 10s to allow transaction propagation to mirror`);\n\tawait delay(10000);\n\n\tconst url = `https:\/\/testnet.mirrornode.hedera.com\/api\/v1\/contracts\/${contractId.toString()}\/results\/logs?order=asc`;\n\n\taxios\n\t\t.get(url)\n\t\t.then(function (response) {\n\t\t\tconst jsonResponse = response.data;\n\n\t\t\tjsonResponse.logs.forEach((log) => {\n\t\t\t\t\/\/ decode the event data\n\t\t\t\tconst event = decodeEvent(\"SetMessage\", log.data, log.topics.slice(1));\n\n\t\t\t\t\/\/ output the from address and message stored in the event\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Mirror event(s): from '${AccountId.fromSolidityAddress(event.from).toString()}' update to '${event.message}'`\n\t\t\t\t);\n\t\t\t});\n\t\t})\n\t\t.catch(function (err) {\n\t\t\tconsole.error(err);\n\t\t});\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p>To see the output of this function, check step seven in the console output image above. In addition, the <em>Auxiliary Functions <\/em>section shows the <strong>decodeEvents<\/strong> function and how it uses web3.js to decode the contract log.<\/p>\n<p><strong>Now you know how to get event information from hedera smart contracts using transaction records and mirror nodes!<\/strong><\/p>\n<p>For feedback on this article or future articles you would like to see, let us know via the <a href=\"https:\/\/hedera.com\/discord\" target=\"_blank\">Hedera Discord server<\/a>.<\/p>\n<\/p>\n<h4 class=\"color-ultraviolet\">Check Out the Code and Try It<\/h4>\n<ul>\n<li>Check out <a href=\"https:\/\/github.com\/hashgraph\/hedera-smart-contracts-libs-lab\/tree\/main\/javascriptWithWeb3js\" target=\"_blank\">the code in GitHub<\/a><\/li>\n<\/ul>\n<ul>\n<li>Try the code in <a href=\"https:\/\/codesandbox.io\/s\/hedera-example-contract-event-info-web3js-rskhs?file=\/index.js\" target=\"_blank\">Codesandbox<\/a> (remember to provide your account credentials in the .env file)<\/li>\n<\/ul>\n<h4 class=\"color-ultraviolet\">Continue Learning about Smart Contracts<\/h4>\n<ul>\n<li><a href=\"https:\/\/hedera.com\/blog\/how-to-deploy-smart-contracts-on-hedera-part-2-a-contract-with-hedera-token-service-integration\" target=\"_blank\">How to Deploy Smart Contracts on Hedera \u2013 Part 2: A Contract with Hedera Token Service Integration<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"https:\/\/docs.hedera.com\/hedera\/core-concepts\/smart-contracts\/hyperledger-besu-evm\" target=\"_blank\">Smart Contracts (Core Concepts &#8211; Hedera Documentation)<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"https:\/\/hedera.com\/learning\/what-are-smart-contracts\" target=\"_blank\">What Are Smart Contracts? (Hedera Learning Center)<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Events in Solidity provide a way to log things and actions that take place in your smart contracts. In this article, you will learn how to get human-readable event information from contract logs using transaction records and mirror nodes.<\/p>\n","protected":false},"author":10,"featured_media":18091,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[1],"tags":[45],"ppma_author":[43],"class_list":["post-15949","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-technical"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Get Event Information from Hedera Smart Contracts | Hedera<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Event Information from Hedera Smart Contracts | Hedera\" \/>\n<meta property=\"og:description\" content=\"Events in Solidity provide a way to log things and actions that take place in your smart contracts. In this article, you will learn how to get human-readable event information from contract logs using transaction records and mirror nodes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\" \/>\n<meta property=\"og:site_name\" content=\"Hedera\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-09T16:55:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-10T05:14:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hedera Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\"},\"author\":{\"name\":\"Hedera Team\",\"@id\":\"https:\/\/hedera.com\/#\/schema\/person\/2dc6146f9f20a44d3de58c834d52e9f4\"},\"headline\":\"How to Get Event Information from Hedera Smart Contracts\",\"datePublished\":\"2022-02-09T16:55:00+00:00\",\"dateModified\":\"2025-12-10T05:14:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\"},\"wordCount\":854,\"publisher\":{\"@id\":\"https:\/\/hedera.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png\",\"keywords\":[\"technical\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\",\"url\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\",\"name\":\"How to Get Event Information from Hedera Smart Contracts | Hedera\",\"isPartOf\":{\"@id\":\"https:\/\/hedera.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png\",\"datePublished\":\"2022-02-09T16:55:00+00:00\",\"dateModified\":\"2025-12-10T05:14:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage\",\"url\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png\",\"contentUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png\",\"width\":2560,\"height\":1440},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hedera.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Get Event Information from Hedera Smart Contracts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hedera.com\/#website\",\"url\":\"https:\/\/hedera.com\/\",\"name\":\"Hedera\",\"description\":\"Hello future\",\"publisher\":{\"@id\":\"https:\/\/hedera.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hedera.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/hedera.com\/#organization\",\"name\":\"Hedera\",\"url\":\"https:\/\/hedera.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hedera.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png\",\"contentUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png\",\"width\":500,\"height\":375,\"caption\":\"Hedera\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Get Event Information from Hedera Smart Contracts | Hedera","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/","og_locale":"en_US","og_type":"article","og_title":"How to Get Event Information from Hedera Smart Contracts | Hedera","og_description":"Events in Solidity provide a way to log things and actions that take place in your smart contracts. In this article, you will learn how to get human-readable event information from contract logs using transaction records and mirror nodes.","og_url":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/","og_site_name":"Hedera","article_published_time":"2022-02-09T16:55:00+00:00","article_modified_time":"2025-12-10T05:14:22+00:00","og_image":[{"width":2560,"height":1440,"url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png","type":"image\/png"}],"author":"Hedera Team","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#article","isPartOf":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/"},"author":{"name":"Hedera Team","@id":"https:\/\/hedera.com\/#\/schema\/person\/2dc6146f9f20a44d3de58c834d52e9f4"},"headline":"How to Get Event Information from Hedera Smart Contracts","datePublished":"2022-02-09T16:55:00+00:00","dateModified":"2025-12-10T05:14:22+00:00","mainEntityOfPage":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/"},"wordCount":854,"publisher":{"@id":"https:\/\/hedera.com\/#organization"},"image":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage"},"thumbnailUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png","keywords":["technical"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/","url":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/","name":"How to Get Event Information from Hedera Smart Contracts | Hedera","isPartOf":{"@id":"https:\/\/hedera.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage"},"image":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage"},"thumbnailUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png","datePublished":"2022-02-09T16:55:00+00:00","dateModified":"2025-12-10T05:14:22+00:00","breadcrumb":{"@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#primaryimage","url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png","contentUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-scaled.png","width":2560,"height":1440},{"@type":"BreadcrumbList","@id":"https:\/\/hedera.com\/blog\/how-to-get-event-information-from-hedera-smart-contracts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hedera.com\/"},{"@type":"ListItem","position":2,"name":"How to Get Event Information from Hedera Smart Contracts"}]},{"@type":"WebSite","@id":"https:\/\/hedera.com\/#website","url":"https:\/\/hedera.com\/","name":"Hedera","description":"Hello future","publisher":{"@id":"https:\/\/hedera.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hedera.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/hedera.com\/#organization","name":"Hedera","url":"https:\/\/hedera.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hedera.com\/#\/schema\/logo\/image\/","url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png","contentUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png","width":500,"height":375,"caption":"Hedera"},"image":{"@id":"https:\/\/hedera.com\/#\/schema\/logo\/image\/"}}]}},"featured_image_src":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-600x400.png","featured_image_src_square":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/2022-Smart-Contracts-Events-Tx-Rec-Image-0-Thumbnail_2022-02-09-173346_ppuc-600x600.png","author_info":{"display_name":"Hedera Team","author_link":"https:\/\/hedera.com\/blog\/author\/hedera-team\/"},"authors":[{"term_id":43,"user_id":10,"is_guest":0,"slug":"hedera-team","display_name":"Hedera Team","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/7ed01931dc9498365746508c4ca49ed0507ef65e04e0b82ffe88c50ef9242b1d?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":""}],"_links":{"self":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts\/15949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/comments?post=15949"}],"version-history":[{"count":0,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts\/15949\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/media\/18091"}],"wp:attachment":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/media?parent=15949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/categories?post=15949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/tags?post=15949"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/ppma_author?post=15949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}