Introduction
In the world of blockchain, analyzing transactions efficiently is crucial for both developers and users. In this blog, we will walk through the development of a Telegram Mini App that allows users to analyze transactions on the Conflux network seamlessly. This application fetches transaction details using the ConfluxScan API and presents them in a user-friendly manner within Telegram.
Project Overview
The Telegram Mini App for Conflux transaction analysis enables users to enter a wallet address and retrieve recent transactions, including details like sender, receiver, amount, and timestamps. The application utilizes ConfluxScan API to fetch transaction data and presents it within a Telegram bot interface.
Technology Stack
-
Backend: Node.js with Express
-
API: ConfluxScan API for fetching transaction details
-
Frontend: Telegram Mini App framework
-
Hosting: Vercel or any cloud-based deployment platform
Implementation Steps
1. Setting Up the Telegram Mini App
To begin, create a new Telegram bot using BotFather. Once the bot is set up, obtain the API token, which will be used to authenticate requests from the bot.
2. Fetching Transaction Data from ConfluxScan
The core functionality of the app relies on fetching transaction details from the ConfluxScan API.
The API call is structured as follows:
const fetchTransactions = async (e: FormEvent) => {
e.preventDefault()
if (!address.trim()) {
setError("Please enter a valid address")
return
}
setIsLoading(true)
setError(null)
try {
const apiUrl = `https://evmapi-testnet.confluxscan.io/api?module=account&action=txlist&address=${address}&page=1&offset=100&sort=desc`
const response = await fetch(apiUrl)
if (!response.ok) {
throw new Error(`API request failed with status ${response.status}`)
}
const data: ApiResponse = await response.json()
if (data.status === "0") {
throw new Error(data.message || "Failed to fetch transactions")
}
setTransactions(data.result.slice(0, 10)) // Get only first 10 transactions
} catch (err: any) {
setError(err.message || "Failed to fetch transaction data")
setTransactions([])
} finally {
setIsLoading(false)
}
}
This function queries the ConfluxScan API, fetches the latest transactions for a given address, and returns the first 10 transactions.
Resources
ConfluxScan API Documentation: https://evmapi-testnet.confluxscan.io/doc
Telegram Mini App: https://t.me/cnfanalyst_bot/cfxanalysis
Live Link: https://conflux-transaction-analysis.vercel.app/
GitHub Repo: https://github.com/Vikash-8090-Yadav/ConfluxTransactionAnalysis
Conclusion
This Telegram Mini App simplifies transaction analysis on the Conflux network, offering users an intuitive way to retrieve their blockchain data. By leveraging the ConfluxScan API and Telegram’s messaging capabilities, we create a powerful and user-friendly solution. Future enhancements could include filtering transactions, real-time notifications, and more advanced analytics.
Thank you for reading! If you found this blog helpful, feel free to share it with the Web3 community. Stay tuned for more Web3 development tutorials!