优化不足的智能合约吞噬你的钱
Under-Optimized Smart Contracts Devour Your Money
摘要:
智能合约是在区块链上运行的成熟程序(例如,以太坊,最受欢迎的区块链之一)。在以太坊中,gas(以太币,一种类似比特币的加密货币)是执行费用,用于补偿矿工运行智能合约的计算资源。然而,我们发现,优化不足的智能合约的成本超过了必要的天然气,因此创建者或用户将被过度收费。在这项工作中,我们进行了第一次调查的Solidity,推荐的编译器,并揭示它未能优化气体昂贵的编程模式。特别是,我们确定了7个天然气昂贵的模式,并将它们分为2类。然后,我们提出并开发了GASPER,这是一种通过分析智能合约的字节码来自动定位天然气成本模式的新工具。从4,240份真实智能合约中发现3种代表性模式的初步结果显示,93.5%、90.1%和80%的合约分别受到这3种模式的影响。
英文摘要:
Smart contracts are full-fledged programs that run on blockchains (e.g., Ethereum, one of the most popular blockchains). In Ethereum, gas (in Ether, a cryptographic currency like Bitcoin) is the execution fee compensating the computing resources of miners for running smart contracts. However, we find that under-optimized smart contracts cost more gas than necessary, and therefore the creators or users will be overcharged. In this work, we conduct the first investigation on Solidity, the recommended compiler, and reveal that it fails to optimize gas-costly programming patterns. In particular, we identify 7 gas-costly patterns and group them to 2 categories. Then, we propose and develop GASPER, a new tool for automatically locating gas-costly patterns by analyzing smart contracts' bytecodes. The preliminary results on discovering 3 representative patterns from 4,240 real smart contracts show that 93.5%, 90.1% and 80% contracts suffer from these 3 patterns, respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。