BountyOneBounties / Issues

4 stars 0 forks source link

Best Ways to Save Gas When Interacting with Contracts #7

Closed thebkr7 closed 6 years ago

thebkr7 commented 6 years ago

We are offering a bounty for the best suggestions/research on ways to improve gas efficiency for contract interaction. An example of a project tackling this would be the Gas Token.

calchulus commented 6 years ago

Would be really interesting to try and incorporate data from EthGasStation. Does that have an API? If not, it could be scraped. https://ethgasstation.info/

Ameerrosic commented 6 years ago

@calchulus Good question!!

calchulus commented 6 years ago

Found API https://github.com/ethgasstation/ethgasstation-api

tissor commented 6 years ago

Introduce bytecode compression for gigantic contracts https://github.com/ethereum/solidity/issues/3432 0x602C04cE20c66D90ea61aBA9bE8467876A278be6

tissor commented 6 years ago

Gas saving in smart contracts.docx Sori for writing - English is not my native language 0x602C04cE20c66D90ea61aBA9bE8467876A278be6

tissor commented 6 years ago

It is necessary to understand in which economic model a smart contract will be used. For the construction of Dapps on Ethereum, - the optimization of a smart contract + will be suitable to reduce the number of calls to a smart contract using side chain ... for example sdk loom ... https://medium.com/loom-network/announcing-zombiechain-an-eos-like-dpos-sidechain-for-ethereum-dapps-e0eba6c244da?__s=xdbvmszp6pxftvppqbzk in June, start sdk ... this is not a project advertisement - at this stage this is the only working solution for launching DAPPs

tissor commented 6 years ago

1) You can save on gas by creating new contract instances from the already loaded bytecode. And / or using bytecode libraries already downloaded on the air. But here the main thing that did not turn out as with Parity 2) Try not to complicate things. For the "competent object-oriented programming" will have to pay. 3) Think about taking out off-chain more. After all, when someone enters into a relationship with you, most likely, without any action on your part, it will not work anyway, and therefore the off-chain may well be a suitable solution. 4) The more gas required for the contract method, the higher the gas price. The fact is that each block has a gas limit and, as a consequence, the number of operations that can be performed. So, if you need 10% of the block's gas to perform the method, then in a highly competitive condition (like with recent cryptocitties, for example) - to get this amount of gas - you will have to pay more for it than participants with less voracious transactions

https://medium.com/joyso/solidity-save-gas-in-smart-contract-3d9f20626ea4 https://ethereum.stackexchange.com/questions/28813/how-to-write-an-optimized-gas-cost-smart-contract?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

tissor commented 6 years ago

Thoughts on launching a token gas:

The gas is used in the Ethereum network to reward the miners for processing transactions. Gas costs are paid by the user in ETH Each ecosystem (project) rewards its users with a token for what is important to the network.

«As society gives you money for giving society what it wants, blockchains give you coins for giving the network what it wants», «Blockchains pay in coin, but the coin just tracks the work done. And different blockchains demand different work», «Bitcoin pays for securing the ledger. Ethereum pays for (executing and verifying) computation». - Naval Ravikant

Based on this, I would consider the launch of the gas token (ERC20) in the Ethereum network as a kind of surrogate (ersatz) on the network - a path to nowhere. Any token that has value can be easily exchanged for ETH and cover gas costs for transactions (0xprotocol, etc.).

There are two options (when you start your project):

  1. The launch of its ecosystem with its crypto currency - fork Ethereum allow Ethereum Gold, and the conditions for the formation of gas prices (POS / POW) - but this is quite a costly story to launch its nodes, validators, etc. (plus gas costs are determined by miners ), and it is difficult to compete with the smaller platform with other platforms (the miners will use their capacities where they pay higher, and the POS validators will be on the network - where they will get more reward for their deposits) - a dead end.

  2. In addition to the previously described gas optimizations, we proceed from the fact that each project is interested in gas optimization - for everyone to adopt the technology of blockchein, everyone must have a user experience without friction (without paying for each action) ... Each ecosystem that runs has its own economic model and the expected increase in users (demand for ecosystem services / goods). The growth of users under Metcalfe's law and brings ecosystem value. Then, gas savings can be considered an ecosystem as an additional motivation for users - rewarding those who bring the greatest value to the ecosystem - does what is important to the ecosystem. How to achieve this - with the initial distribution of the token on the ICO, it is necessary to provide a project support fund and send 15% of all the issue of the token to reward users with the motivation "reduction of gas costs". This story under the deflationary token has its limits - the fund has its bottom - but at the start and in the first year it is possible to achieve substantial maintenance of its users - after which, when the project is scaled - the value of the project's token should compensate for the costs of gas - the user in the ecosystem will be rewarded with a token on higher cost.

tissor commented 6 years ago

Very interesting was the issue of saving gas and that's what I found - bingo! I really liked the idea - cool)

‘Zero user-fees’:

In their research report, Multicoin Capital touts EOS’ lack of user fees as a core advantage over systems like BTC and ETH, which require users to pay fees on each transaction.

This idea of ‘zero user-fees’ is disingenuous because it suggests that economic incentives are no longer required to maintain the network. Fees, whether in the form of inflation through block rewards, transaction fees, or a hybrid transaction fee/block reward model, are ultimately what allows blockchains to exist: they incentivize economically rational actors to continue validating and maintaining the state of the blockchain.

EOS recognizes this. EOS does indeed have fees, but they are hidden in the form of inflation. This is not necessarily a bad thing in itself: indeed, both $BTC and $ETH are inflationary at this point in their life cycles, although both assets will ultimately have their supplies capped and rely instead on transaction fees.

So EOS does have fees in the form of inflation. Yes, their system does mean that users do not have to pay transaction fees each time they interact with an EOS-based application.

However, projects will nonetheless have to own some EOS tokens in order to guarantee some level of network bandwidth, so the on boarding process is not entirely frictionless as perhaps suggested.

Moreover, the Ethereum community is already working on solutions to abstract transaction fees away from the user. and here is the solution itself....Eureka https://medium.com/zastrin/how-to-save-your-ethereum-dapp-users-from-paying-gas-for-transactions-abd72f15e14d https://github.com/maheshmurthy/ethereum_voting_dapp/tree/master/chapter4 it reminds me of transaction batching... I hope this idea will come in handy to you - to me already))) 0x602C04cE20c66D90ea61aBA9bE8467876A278be6

thebkr7 commented 6 years ago

@tissor You have been awarded the bounty! Congratulations!

tissor commented 6 years ago

https://youtu.be/Vhh_GeBPOhs