⛓️Challenges
1. Using Tronweb when we follow the documentation of Tronweb there is an error while instantiating Tronweb error is like ' TronWeb' is not a constructor after some debugging , came with the following code , which works perfectly fine for javascript as well as typescript
const TronWebModule = require('tronweb');
const TronWeb = TronWebModule.default.TronWeb; 2. Connection with Btfs
During the process of connecting with the BTFS (BitTorrent File System) server, we faced several challenges. A major difficulty was navigating outdated and incomplete documentation, which made it hard to find accurate commands for basic tasks like adding, retrieving, or persisting files on the network. Many of the instructions were unclear or scattered, leading to significant trial and error.
We also encountered issues with establishing stable connections to the network. Peers would disconnect frequently, making it difficult to ensure that files remained accessible and persisted on the network. Pinning files was another challenge, as they would sometimes disappear or become unreachable due to network instability.
Additionally, scalability became an issue when working with larger datasets, as upload and retrieval speeds began to degrade. Ensuring that others could reliably access files added to the network involved configuring nodes properly and adjusting settings like firewalls and peer discovery, which added complexity.
Despite these challenges, through persistence and collaboration, we successfully connected to the BTFS network and ensured file availability. This process deepened our technical understanding and demonstrated the importance of perseverance in working with decentralized systems.
3. Integrating with Sunswap
we tried integrating sunswap in our project , we have written all necessary functions to let user convert other currencies to tron , but as i tried on nile testnet calling a function exactInput of a contract whose address TFkswj6rUfK3cQtFGzungCkNXxD2UCpEVD
async function trial2() {
try {
const router = await tronWeb.contract().at('TFkswj6rUfK3cQtFGzungCkNXxD2UCpEVD');
const deadline = Math.floor(Date.now() / 1000) + 600;
console.log("Deadline:", deadline);
await router.methods.swapExactInput(
['TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf', 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR'], // Path (USDT -> WTRX)
['v3'], // Pool version
[2], // Adjacent pool length
[100, 10], // Fee rates
['100000000000000000', '0', 'TAPsixpGU5gwhYd4kftVPGRYGmN16zt7ac', deadline] // AmountIn, MinOut, Recipient, Deadline
).send({
feeLimit: 10000 * 1e6, // Fee limit in TRX (10000 TRX)
shouldPollResponse: true // Poll response for confirmation
});
console.log("Swap executed successfully");
} catch (error) {
console.error("Error executing swap:", error);
}
}But due to some problems (showing incorrect input parameters) i couldnt successfully swap
The main issue we encountered was that the Nile testnet is seldom used, which contrasts with the expected performance on the mainnet. Despite ensuring that all input parameters matched those of the actual contract code and confirming there were no errors on our part, we faced difficulties with our swap function not executing as intended. This discrepancy between the testnet and mainnet environments led us to temporarily redirect users to Sunswap while we continue to investigate and resolve the underlying issues.
Last updated