Welcome to BlockDAG Dashboard! 👋

notification0
Notifications
logout

Dev Release 107

August 29, 2024

Greetings BlockDAG Community,

In our continuous effort to enhance the functionality and performance of the BlockDAG explorer, this release focuses on establishing a comprehensive system for managing blockchain addresses, retrieving account balances, and calculating the total value of transactions within specific blocks. Below, we provide a detailed overview of the schema design, algorithmic approaches, and technical considerations that underpin these new features.
 

1. Detailed Schema Design for Handling Accounts
The core objective of this update is to create a robust and scalable schema that efficiently handles the relationship between blockchain addresses and their transactions. This design enables us to maintain accurate account balances and allows easy access to transaction histories.
Schema Components:

  • Accounts Table:
  • Purpose: To store unique addresses along with their current balances and metadata.
  • Fields:
  • id: An integer that serves as the primary key and auto-increments for each new account.
  • address: A string that uniquely identifies a blockchain address. This field is indexed and set to be unique to prevent duplicate entries.
  • balance: A decimal value representing the current balance of the account. This field is updated dynamically based on incoming and outgoing transactions.
  • created_at: A timestamp indicating when the account record was created. This helps in tracking the account's age and can be useful for auditing purposes.

     
  • Transactions Table:
  • Purpose: To log all transactions associated with each account, detailing the flow of funds in and out of the address.
  • Fields:
  • id: Primary key, auto-incremented for unique identification of each transaction.
  • account_id: A foreign key that links the transaction to the Accounts table, establishing the relationship between an address and its transactions.
  • amount: A decimal value indicating the transaction's amount. Positive values represent credits (incoming funds), and negative values represent debits (outgoing funds).
  • type: An enumeration that specifies the transaction type, either credit or debit.
  • timestamp: A timestamp recording when the transaction occurred, essential for tracking the chronological order of events.
     

Schema Relationships:

  • The relationship between Accounts and Transactions is defined by the account_id foreign key in the Transactions table. This link allows us to query all transactions related to a specific address efficiently.

 

2. Algorithm for Showing the Balance of a Particular Address:
To enable users to query the balance of any blockchain address, we implemented an API that interacts with our newly designed Accounts schema. The API fetches the current balance by directly querying the Accounts table, ensuring quick and reliable access to this data.
Algorithm Steps:

Input Validation:

  • Accept the address as an input parameter.
  • Validate the address format to ensure it adheres to blockchain standards (length, characters, etc.).

Account Lookup:

  • Query the Accounts table using the input address to find the corresponding account record.
  • If the address exists in the table, proceed; otherwise, return an error indicating the address is not found.

Retrieve and Calculate Balance:

  • Extract the balance field from the fetched account record.
  • For accuracy, balances can be recalculated by summing transaction values from the Transactions table, especially if on-the-fly updates are necessary.

Return Data:

  • Output the address along with its current balance.


Example Workflow:

  • User requests the balance for address 0x123...abc.
  • API validates the address format.
  • The system queries the Accounts table for 0x123...abc.
  • If found, it retrieves the balance (e.g., 100.5678 BDAG).
  • Returns JSON: { "address": "0x123...abc", "balance": "100.5678" }.

 

 

3. Algorithm for Summing Total Transaction Values in a Particular Block
To provide insights into the financial activity within specific blocks, we have implemented an API that calculates the total value of transactions in a given block. This feature is useful for users wanting to understand the volume and flow of funds in particular blocks.
Algorithm Steps:

Input Validation:

  • Accept the block ID as an input parameter.
  • Validate the block ID format to ensure it matches the expected structure.

Fetch Transactions:

  • Query the Transactions table, filtering by the given block ID.
  • Retrieve all transactions associated with the block.

Calculate Total Value:

  • Initialize a variable total_value to zero.
  • Iterate through each transaction record:
  • Add each transaction’s amount to total_value.
  • Consider transaction type (credit or debit) if adjustments are needed (e.g., applying negative values for debits).

Return Data:

  • Output the block ID along with the total summed value of transactions.

 

Example Workflow:

  • User requests the total transaction value for block ID 1001.
  • API validates the block ID format.
  • The system queries the Transactions table for all transactions where block_id = 1001.
  • Transactions found with values [50.25, 20.75, -15.00].
  • Total value is calculated as 50.25 + 20.75 - 15.00 = 56.00.
  • Returns JSON: { "block_id": "1001", "total_value": "56.00" }.

Summary and Next Steps

This update to the BlockDAG explorer introduces a well-structured schema and efficient algorithms for managing blockchain addresses and transactions, significantly enhancing the explorer's functionality and performance. By implementing the Accounts and Transactions tables with clear relationships, we have ensured that the system can efficiently manage large volumes of data while maintaining accuracy and integrity. The API for retrieving account balances provides a fast and reliable way for users to access their current balance information, while the algorithm for summing transaction values in a particular block offers valuable insights into block-level activity.

 

Upcoming Enhancements:

  • Performance Optimization: Introduce caching mechanisms (e.g., Redis) for frequently accessed data to improve response times.
  • Scalability: Evaluate sharding strategies for the database to handle growing data volumes efficiently.
  • Security Enhancements: Implement advanced security measures, including encryption for sensitive data and rate limiting to prevent abuse.

These enhancements represent our ongoing commitment to delivering a top-tier blockchain explorer that is both reliable and user-friendly. By focusing on scalability, security, and performance, we aim to make the BlockDAG explorer a leading tool in the blockchain space, capable of supporting a wide array of use cases from casual exploration to in-depth blockchain analysis.

BlockDAG X1 App Update: Onboarding Flow Improvements and Crash Fixes

As part of our ongoing commitment to improving the BlockDAG X1 app, we have focused on refining the onboarding experience and addressing critical bugs identified during testing and stakeholder feedback sessions. This update outlines the changes made to the onboarding flow, fixes for app crashes related to OTP input, and other UI enhancements. Additionally, we provide insights into the root cause analysis and the steps taken to resolve key issues affecting the user experience.
Key Updates and Fixes
1. Enhancements to the Onboarding Flow:
The onboarding process is a crucial touchpoint for new users, and ensuring a smooth and intuitive experience is vital for user retention. Based on stakeholder feedback and internal testing, we identified and implemented several improvements:

  • Removing Regex Validation During Login:
  • Issue: Users reported difficulties logging in due to overly restrictive regex validations that were unnecessarily blocking valid inputs, such as certain special characters in usernames or passwords.
  • Solution: We have removed the restrictive regex validation on the login screen to streamline the process. This change ensures that users can log in without unnecessary hurdles while still maintaining essential security measures through backend validation and checks.
  • UI Fixes in the Onboarding Flow:
  • Feedback: Stakeholders highlighted minor inconsistencies in the UI, such as misaligned buttons, incorrect color schemes, and non-uniform font sizes, which detracted from the overall onboarding experience.
  • Actions Taken:
  • Corrected alignment issues for buttons and input fields to ensure a cohesive look.
  • Updated the color scheme to match the app's branding guidelines, enhancing visual consistency.
  • Standardized font sizes and styles across all onboarding screens for a polished and professional appearance.

 

2. Fixing App Crash When User Enters OTP:
One of the critical bugs identified was the app crashing when users attempted to enter their OTP during the verification step. This issue was not only frustrating for users but also blocked them from completing the onboarding process.

  • Root Cause Analysis:
  • Through debugging and crash analytics, we identified that the app was crashing due to improper handling of OTP inputs, particularly when users entered inputs rapidly or attempted to paste OTPs from the clipboard.
  • Further investigation revealed that the crash was linked to a third-party frontend library used for handling input fields, which was not adequately managing asynchronous updates during rapid user interactions.
  • Solution:
  • We replaced the problematic library with a more robust alternative that better handles input events and supports clipboard pasting without causing crashes.
  • Additionally, the new library offers improved accessibility features, enhancing the overall usability for a diverse user base.
  • Rigorous testing was conducted to ensure that the replacement library integrates smoothly with our existing codebase and that no new issues were introduced.

 

3. Resolving Loader Issues:
During the testing phase, we observed that the loading spinner would sometimes freeze or not display correctly, leading to a confusing user experience where actions seemed unresponsive.

  • Identified Problem:
  • The loader issue was traced back to the frontend library managing UI state updates. The library was not handling state transitions effectively, causing the loader to become stuck or fail to render under certain conditions.
  • Steps to Address:
  • We evaluated several alternative libraries to replace the current solution. Our criteria included performance, compatibility, ease of integration, and active community support.
  • After selecting a suitable replacement, we updated the app to use the new library, which offered more reliable state management and smoother transitions for loaders.
  • Comprehensive testing was conducted across various devices and operating systems to ensure consistent behavior of the loader, particularly under heavy load scenarios.

This update marks a significant step forward in enhancing the BlockDAG X1 app's user experience and reliability. By addressing these critical issues promptly, we are setting a strong foundation for future improvements and continued growth. We look forward to your continued support and feedback as we strive to deliver the best possible experience with the BlockDAG X1 app. 

BlockDAG LogoBlockDAG Logo