# Query via Transaction ID
## Querying by Contract Events
You can query a contract for events and sort the results based on parameters passed in.
Case 1 |
Pass `since ` or `fromTimestamp `
**Example:**
<br>
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?since=1551779730000
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?fromTimestamp=1551779730000
<br>
**Result:** Returns all events that occurred before the specified timestamp, starting from the specified timestamp, in order of most recent on top (descending). |
Case 2 |
Pass `since ` or `fromTimestamp ` & `sort=-block_timestamp `
**Example:**
<br>
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?since=1551779730000&sort=-block_timestamp
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?fromTimestamp=1551779730000&sort=-block_timestamp
<br>
**Result:** Returns all events that occurred before the specified timestamp, starting from the specified timestamp, in order of most recent on top (descending). |
Case 3 |
Pass `since ` or `fromTimestamp ` & `sort=block_timestamp `
**Example:**
<br>
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?since=1551779730000&sort=block_timestamp
_ https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3?fromTimestamp=1551779730000&sort=block_timestamp
<br>
**Result:** Returns all events that occurred after the specified timestamp, starting from the specified timestamp, in order of most recent on the bottom of the page (ascending). |
Case 4 |
No Value Passed **Example:** https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3 **Result:** Returns all events starting with most recent on top of the page (descending order). |
# Example Contract
Deploy contract using TronWeb, TronBox, or directly using RPC or HTTP call:
After triggering `fibonacciNotify
` and event notify:
Return Value:
Return Format:
# Blockchain Interaction
Use Tron-Web & Tron-Grid to interact with the Blockchain: