current position：Home>The execution process of smart contract is too long
The execution process of smart contract is too long
2022-02-03 23:11:48 【Q & A of Denglian community】
An interest bearing contract , Users log in every day eth Or token ,24 Click to call the method of calculating dividends in the contract , This method first calculates the amount of dividends everyone deserves , then for The cycle changes mapping Corresponding types address Medium balance value , If the user is particularly large , This method executes , It's impossible gas limit It's too big , If there is such a situation, how to deal with it better , Thank you very much ？
Take the answer 1：
A common question , The dividend calculation strategy needs to be modified （ Discuss with the product ）, There are usually two ways ：
Calculation converted to a public variable , such as ： Only calculate how much dividend should be paid per unit currency .
Into their respective users trigger their own computing logic .
The above is the recommended way , Here is
Not recommended way （ Use only if the above methods cannot be used ）： By passing in parameters , Piecewise calculation .
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
The sidebar is recommended
- The problem of obtaining the variable value in the structure state in the contract by web3js
- I want to transfer the token from the contract address to another address. How do you write this
- May I ask you a question about the duplicate name of erc20 token?
- May I ask you about the problem of solid code audit?
- Can the wallet address be traded at the private chain node at will?
- The mongodb database of EOS blockchain node is a separate host. Can this push the node's data to an independent database host
- The problem of keystore storage directory
- Deploy two smart contracts and how to call the functions in one JS
- I successfully created a local development chain to visit https://substrate-ui.parity.io When, it shows that I am not connected to the node.
- Event filtering in web3js
guess what you like
Information for learning ring signature
At present, can smart contracts only be implemented on the web? Use ether js。 If you want to make a good web page into a mobile app or wechat applet, is there any way
The send transactions' from 'field must be defined appears when calling the contract method (including parameters)!
Erc20 transfer to contract address
Store the data on the chain according to the structure format. The read string type data can be returned in the original format, while uint type data is BN type,
Running on win10 -- Practice Guide: an error occurred when building a zero knowledge proof DAPP demo
How smart contracts receive and transfer usdt (erc20)
Local simulation test open source code
Why is the transfer authorization unsuccessful
- How to find the page displayed after DAPP is opened in the open source code
- How can the results of smart contract execution be saved on the blockchain? I use truss + ganache
- Does one contract create a new transaction when calling another contract?
- Cannot structure property 'body' of 'undefined' as it is undefined
- I want to develop a blockchain project in wechat applet. How do I start?
- When I use metamask to connect the private chain, I report an error networkcontroller - unknown RPC type
- I found a magical thing. After getting started, the private chain deletes the data file stored in the whole block. Why can I find data on the chain
- There are three interface calls in the figure below the filecoin block browser. Which RPC interfaces are they???
- What is the storage mode of IPFs
- The problem of parameters in info printed by geth? How to create a new contract?
- How to choose the smart contract token standard (erc20, erc777, erc1155)
- Please teach me how to use openzeppelin to deploy smart contracts and learn to make a red envelope
- ERROR: 1.13.4 is required to build Fabric and you are using . Please update go
- Unable to get metamask account
- I don't know what the problem is
- There is a strange phenomenon in metamask wallet. The transferred eth automatically generates a transaction. Why?
- For cross-border e-commerce, since the transaction data volume is about 2 million orders per day, how to store it using blockchain technology?
- During the construction of DAPP project in pet shop, an error is reported when the truss test command is executed
- Why are blockchain applications, these dapps, all on the web side, without Android and IOS?
- Can we build an Ethereum private chain from the height of the current blockchain?
- Hello, may I have your contact information
- How to set IPFs friendly name
- How to pass in parameters when deploying smart contracts with geth
- Are there any public RPC service nodes in Ethereum?
- How to prove to users that the software uses blockchain technology
- Recruitment of low-level blockchain development posts of state-owned banks in Hangzhou
- How to build index based on wave field event log
- The contract I wrote has been compiled and deployed on the local gangche, but this error will be reported when setting the value to the fourth and fifth structures. Can you help me see the reason?
- Do you need self built nodes for wave field event monitoring
- Etherscan verification release source code problem
- Build a private chain on geth, which will always mine and generate new blocks. I run on the server and feel very resource consuming. After a period of time, I have to clear the blockchain data and restart it. Is there any solution
- Questions about fast mode and full mode of Ethereum
- Error: the network ID specified in the truss config (4447) does not match the one returned by the network (5777) Ensure that both the network and the provider are properly configured.
- I have a few questions to ask the great gods to help answer -- thank you
- How to prove to users that the software uses blockchain technology?
- Tendermint node restart problem
- Pgresolver appears when accessing the fabric go SDK connection chain (*randomLBP). Choose -＆gt; WARN No available peer groups err: Client Status Code: (6) NO_ PEERS_ FOUND. Description: targets were not provided, has anyone met them
- Can matlab be connected with solidity
- The NPM install truss contract command cannot be downloaded
- DAPP related language version update