Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

103
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda