Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

104
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda