Spark chain Info

TBASparkChain AI is a decentralized network that empowers users to share their unused internet bandwidth and computing resources, helping to build a more efficient and transparent AI ecosystem. With a simple setup, SparkChain AI allows users to contribute their idle internet bandwidth. This bandwidth is used by data processors and AI systems to organize and structure web data. In return, users earn SPARK tokensbased on factors like bandwidth usage and network demand. Importantly, your personal data remains private and secure.

Spark chain Logo

TrustNet Score

The TrustNet Score evaluates crypto projects based on audit results, security, KYC verification, and social media presence. This score offers a quick, transparent view of a project's credibility, helping users make informed decisions in the Web3 space.

80.00
Poor Excellent

Real-Time Threat Detection

Real-time threat detection, powered by Cyvers.io, is currently not activated for this project.

This advanced feature provides continuous monitoring and instant alerts to safeguard your assets from potential security threats. Real-time detection enhances your project's security by proactively identifying and mitigating risks. For more information, click here.

Security Assessments

"Static Analysis Dynamic Analysis Symbolic Execution SWC Check Manual Review"
Contract address
N/A
Network N/A
License N/A
Compiler N/A
Type N/A
Language Rust
Onboard date 2025/07/02
Revision date 2025/07/02

Summary and Final Words

No crucial issues found

The contract does not contain issues of high or medium criticality. This means that no known vulnerabilities were found in the source code.

Contract owner cannot mint

It is not possible to mint new tokens.

Contract owner cannot blacklist addresses.

It is not possible to lock user funds by blacklisting addresses.

Contract owner cannot set high fees

The fees, if applicable, can be a maximum of 25% or lower. The contract can therefore not be locked. Please take a look in the comment section for more details.

Contract cannot be locked

Owner cannot lock any user funds.

Token cannot be burned

There is no burning within the contract without any allowances

Ownership is not renounced

The owner retains significant control, which could potentially be used to modify key contract parameters.

Contract is not upgradeable

The contract does not use proxy patterns or other mechanisms to allow future upgrades. Its behavior is locked in its current state.

Scope of Work

This audit encompasses the evaluation of the files listed below, each verified with a SHA-1 Hash. The team referenced above has provided the necessary files for assessment.

The auditing process consists of the following systematic steps:

  1. Specification Review: Analyze the provided specifications, source code, and instructions to fully understand the smart contract's size, scope, and functionality.
  2. Manual Code Examination: Conduct a thorough line-by-line review of the source code to identify potential vulnerabilities and areas for improvement.
  3. Specification Alignment: Ensure that the code accurately implements the provided specifications and intended functionalities.
  4. Test Coverage Assessment: Evaluate the extent and effectiveness of test cases in covering the codebase, identifying any gaps in testing.
  5. Symbolic Execution: Analyze the smart contract to determine how various inputs affect execution paths, identifying potential edge cases and vulnerabilities.
  6. Best Practices Evaluation: Assess the smart contracts against established industry and academic best practices to enhance efficiency, maintainability, and security.
  7. Actionable Recommendations: Provide detailed, specific, and actionable steps to secure and optimize the smart contracts.

A file with a different Hash has been intentionally or otherwise modified after the security review. A different Hash may indicate a changed condition or potential vulnerability that was not within the scope of this review.

Final Words

The following provides a concise summary of the audit report, accompanied by insightful comments from the auditor. This overview captures the key findings and observations, offering valuable context and clarity.


Ownership Privileges
  • The initializer can set the end time.
  • The owner can create the token vault.
  • The owner can fund the vault.
  • The owner can initialize the backend authority.
  • The owner can update the backend authority status.

Note - This audit report consists of a security analysis of the token sale contract. This analysis did not include functional testing (or unit testing) of the token’s logic. Furthermore, we only audited the mentioned contract associated with this project. Other contracts related to this project were not audited by our team. We recommend investors conduct their own research before engaging with the token.

Files and details

Functions
public

/

State variables
public

/

Total lines
of code

/

Capabilities
Hover on items

/

Functions
public

/

State variables
public

/

Total lines
of code

/

Capabilities
Hover on items

/

Functions
public

/

State variables
public

/

Total lines
of code

/

Capabilities
Hover on items

/

Findings and Audit result

high Issues | 1 findings

Resolved

#1 high Issue
Risk of Fund Loss Due to Unsafe Use of Floating-Point Arithmetic
lib.rs
L10-27
Description

The program utilizes f64 (floating-point) data types for core financial values, including rate and user score. This is a critical vulnerability for two primary reasons: lack of determinism and inevitable precision loss. Floating-point math is not guaranteed to produce bit-for-bit identical results across different hardware, which can break consensus on a blockchain. More practically, it cannot accurately represent many decimal values, leading to rounding and truncation errors in every calculation. This systematically causes users to receive fewer tokens than they are owed, with the residual "dust" becoming permanently locked and irrecoverable within the contract's token vault. For example, consider a scenario where the total_token_pool is 100,000,000 and the total_score is 3.0, contributed equally by three users each with a score of 1.0. When the first user claims their tokens, the calculation 1.0 / 3.0 results in an imprecise 0.333... value. Multiplying this by the token pool gives 33,333,333.333..., which is then truncated to 33,333,333 tokens when cast to a u64. After all three users claim, a total of only 99,999,999 tokens will have been distributed, leaving 1 token permanently lost.

medium Issues | 6 findings

Resolved

#1 medium Issue
Centralization Risk of Indefinite Fund Lock by Authority
lib.rs
L29-46
Description

The contract's set_commit_end_time function grants the authority unrestricted power to modify the sale's conclusion date at any time. This centralization of power creates a significant risk, as a malicious or compromised authority could abuse this function to indefinitely postpone the end of the sale, effectively locking up all committed funds. Participants cannot withdraw their deposited SOL and can only claim their tokens after the sale concludes. By repeatedly extending the deadline, the authority prevents the commit_period_ended condition from ever being met, thereby blocking both users from claiming tokens and the project team from withdrawing the raised SOL. For example, if a sale is scheduled to end on June 1st, the authority could execute a transaction on May 31st to move the commit_end_time to July 1st. They could then repeat this action in late June, pushing the date to August 1st, and so on. This creates a scenario where participants' funds are held hostage indefinitely with no recourse through the smart contract.

Resolved

#2 medium Issue
Premature Token Claiming Allows for Unfair Fund Drain
lib.rs
L97-137
Description

The claim_tokens function lacks any validation to ensure that the token sale has actually concluded. There is no check to see if the commit_end_time has passed or if the target_raise_sol has been met. This omission allows any participant to call this function and claim their tokens during the active sale period. Because a user's token allocation is calculated based on the total_score at the moment of the claim—a value that is still increasing as new participants join—this flaw can be exploited by an early participant to claim a dramatically larger share than they are fairly entitled to, potentially draining the entire token pool and leaving nothing for later contributors.

Resolved

#3 medium Issue
Re-Funding Vault Causes Permanent Token Lock
lib.rs
L157-187
Description

The fund_vault function contains a critical flaw in its state management logic that leads to a permanent loss of funds if the authority decides to fund the vault in more than one transaction. The line distribution_state.total_token_pool = amount; uses direct assignment instead of accumulation (+=). This causes the contract's record of the total token supply to be overwritten with the amount of the most recent deposit, rather than being a running total of all deposits. This creates a severe desynchronization between the contract's internal accounting and the actual number of tokens held in the vault. Consequently, all tokens from previous funding transactions become invisible to the claim_tokens logic and are permanently locked in the contract, irrecoverable by either the users or the authority. For example, if the authority first deposits 1,000,000 tokens, the state is correctly set to 1,000,000. If they then deposit an additional 500,000 tokens, the vault's true balance becomes 1,500,000, but the contract's state is incorrectly overwritten to 500,000. As a result, users will only be able to claim from this smaller pool, and the initial 1,000,000 tokens will be locked forever.

Resolved

#4 medium Issue
Denial of Service via Nonce Front-Running
lib.rs
L209-323
Description

The contract's replay protection mechanism is vulnerable to a front-running attack that can lead to a complete Denial of Service (DoS) for the sale. The core issue stems from using a single, global nonce_counter for all users combined with a strictly sequential check (nonce > nonce_counter). An attacker can exploit this by obtaining a valid proof with a nonce far in the future (e.g., nonce = 500) and then paying a high priority fee to a validator to ensure their transaction is processed before those of legitimate users. When the attacker's transaction succeeds, the global nonce_counter is updated to 500. This immediately invalidates the proofs of all other pending users (e.g., with nonces 51, 52), as their nonces are no longer greater than the counter. This forces all other users' transactions to fail, causing them to lose their transaction fees and effectively halting the entire sale.

Resolved

#5 medium Issue
Failure of Signature Verification Due to Hardcoded Offsets
lib.rs
L209-323
Description

The contract's signature verification logic is critically flawed and not future-proof. Instead of safely parsing the Ed25519 instruction according to the official Solana specification, the verify_ed25519_signature helper function uses hardcoded byte offsets to extract the public key and signature. This implementation dangerously assumes that every client wallet will construct the instruction in the exact same byte-for-byte layout as the web3.js library. This creates a "time bomb" that will cause the contract to fail for users of any other wallet or client library that orders the (still perfectly valid) instruction data differently, leading to a loss of functionality and user trust. For example, imagine a new popular wallet, "FutureWallet," is released that assembles the Ed25519 instruction with the signature data appearing before the public key data. When a user with FutureWallet sends a transaction, the Solana network will correctly validate their signature. However, when the transaction reaches the contract, the hardcoded logic will look for the public key at bytes 16-47 and will find the user's signature data there instead.

Resolved

#6 medium Issue
Unit Tests Do Not Validate Production Signature Verification Logic
lib.rs
L845-902
Description

The contract's unit tests for signature verification are critically flawed, providing a false sense of security. There is a fundamental contradiction between the data format the production verify_ed25519_signature function expects and the format its own test helper function, create_ed25519_instruction_data, generates. The production code is hardcoded to parse an instruction where the public key comes before the signature. In direct opposition, the test code creates and validates an instruction where the signature comes before the public key.

low Issues | 1 findings

Resolved

#1 low Issue
On-Chain score Calculation Ignores points Parameter
lib.rs
L209-323
Description

The contract contains a severe design flaw in its economic model that creates a misleading and punitive experience for its most engaged users. The system is built around earning off-chain points, which users are led to believe will grant them a larger share of the token sale. However, the on-chain commit_resources function calculates a user's final score—the sole determinant of their token allocation—based only on the sol_amount they contribute. The points value is only used as a minor gate for entry and has no impact on the final reward. This creates a "bait-and-switch" scenario that damages user trust and can lead to project failure. For example, consider two users. Alice, a loyal community member, earns 100,000 points and contributes the required minimum of 10 SOL, believing her points will grant her a large allocation. Bob, a speculator with 0 points, contributes 10,000 SOL. The contract will assign Alice a score of 10 and Bob a score of 10,000, causing Bob to receive 1,000 times more tokens. Alice's loyalty and effort were effectively worthless, and she will rightfully feel deceived, leading to a loss of community trust.

informational Issues | 1 findings

Resolved

#1 informational Issue
Incorrect Order of Operations in claim_tokens
lib.rs
L97-137
Description

The claim_tokens function violates the widely accepted "Checks-Effects-Interactions" security pattern. The function performs an external call (a CPI to the Token Program) before applying its own internal state changes (setting tokens_claimed to true). While Solana's runtime prevents a classic reentrancy attack, this ordering is still considered a vulnerability in principle. It creates a fragile design where the contract's final state depends on the successful execution of an external program. If the contract were ever to interact with a less-trusted program, this could lead to complex and exploitable bugs.