论文标题
模式匹配区块链中的算法,以减少网络费用
Pattern matching algorithms in Blockchain for network fees reduction
论文作者
论文摘要
近年来,区块链受到了广泛的关注,并且仍在增长。第二代区块链(例如以太坊)允许在以太坊虚拟机(EVM)中执行几乎所有程序,使其成为分布式应用程序的全局协议。代码部署和EVM执行的每个操作都花费了称为GAS的网络费用,价格会有所不同,并且可能很重要。这就是为什么代码优化和精心选择的算法对于在区块链上编程至关重要的原因。本文评估了以太坊虚拟机上几种精确模式匹配算法的气体使用情况。我们还建议在固体/YUL语言中有效地实施算法。我们评估了所有算法的气体费用(例如图案长度,字母大小和文本大小)。与Stringutils(流行的固体弦库)相比,我们显示出大量的气体费用和缩短的较低的气体费用和55倍的加速使用时间。
Blockchain received a vast amount of attention in recent years and is still growing. The second generation of blockchain, such as Ethereum, allows execution of almost any program in Ethereum Virtual Machine (EVM), making it a global protocol for distributed applications. The code deployment and each operation performed in EVM cost the network fee called gas, which price varies and can be significant. That is why code optimization and well-chosen algorithms are crucial in programming on the blockchain. This paper evaluates the gas usage of several exact pattern matching algorithms on the Ethereum Virtual Machine. We also propose an efficient implementation of the algorithms in the Solidity/YUL language. We evaluate the gas fees of all the algorithms for different parameters (such as pattern length, alphabet size, and text size). We show a significant gas fee and execution time reduction with up to 22-fold lower gas usage and 55-fold speed-up comparing to StringUtils (a popular Solidity string library).