Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Time complexity issue when reading smart contract data

I have a contract that allows user to create a campaign and people can bid. I am reading the data to frontend using etherjs. It take time to load campaigns and as more campaigns are created it becomes slower.

This is my createCampaign code

struct Campaign {
    uint256 campaignID;
    string brand;
    uint256 budget;
    mapping(uint => Bidder[]) bidders;
}

struct Bidder {
    bool bided;
    uint256 bid;
    string name;
    address bidderAddress;
}


Campaign[] public campaigns;
uint totalCampaign = 0; //same with one above

//-------Creating a Campaign-------//
function createCampaign(
    string memory _brand,
    uint256 _budget
    ) public  {
    Campaign storage _initialCampaign = campaigns.push();
    _initialCampaign.campaignID = totalCampaigns += 1;
    _initialCampaign.brand = _brand;
    _initialCampaign.budget = _budget;
    totalCampaign++;
}

How can I read data faster to frontend?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of returning them all return them one by one and fetch them in the front end when they reach or you can save the president data from you mango or sql database and then retrieve other data when needed from blockchain

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!