计算机工程与应用 ›› 2022, Vol. 58 ›› Issue (20): 263-269.DOI: 10.3778/j.issn.1002-8331.2103-0029

• 工程与应用 • 上一篇    下一篇

基于XGBoost的以太坊交易智能定价模型

冯云霞,薛蓉蓉   

  1. 青岛科技大学 信息科学技术学院,山东 青岛 266061
  • 出版日期:2022-10-15 发布日期:2022-10-15

XGBoost_Based Smart Price Model for Ethereum Transactions

FENG Yunxia, XUE Rongrong   

  1. School of Information Science and Technology, Qingdao University of Science and Technology, Qingdao, Shandong 266061, China
  • Online:2022-10-15 Published:2022-10-15

摘要: 以太坊采用交易收费的策略来保证计算资源的合理利用,而由于涉及智能合约的交易消耗计算资源差别较大,引入Gas机制。以太坊用户在发起交易时需自主设置Gas总量和Gas价格,而矿工基于利益最大化的原则,优先选择Gas价格高的交易。Gas价格设置高则打包时间短,反之则时间长。由于交易的价格由交易发起者自主确定,这使得需要打包的交易的Gas价格可能相差较大,因而交易共识时间难以掌握。因此,现有的交易机制并不能平衡交易Gas成本和共识时间之间的冲突。为了解决上述问题,对以太坊交易机制进行了研究,分析影响Gas价格的因子,通过网格搜索算法对极端梯度增强模型(extreme gradient boosting,XGBoost)进行参数优化,构建基于XGBoost的以太坊交易智能定价模型,将该模型用于交易Gas价格预测中。通过搭建节点接入以太坊网络获取交易数据作为实验数据,实验结果表明,ETH_XGB模型能够帮助用户平均节省约72.5%的交易成本,交易成功率在92%,相较于原机制提高17.1%。

关键词: 以太坊, 智能合约, 极端梯度增强模型(XGBoost), Gas价格

Abstract: Ethereum adopts the strategy of transaction fees to ensure the reasonable use of computing resources, and because transactions involving smart contracts consume computing resources, the Gas mechanism is introduced. Ethereum users need to independently set the total amount of Gas and Gas price when initiating a transaction, and based on the principle of maximizing profit, miners prefer transactions with high Gas prices. If the Gas price is set high, the packing time is short, and vice versa, the time is long. Since the transaction price is determined independently by the transaction initiator, the Gas price of the transaction that needs to be packaged may vary greatly, and the transaction consensus time is difficult to grasp. Therefore, the existing transaction mechanism cannot balance the conflict between transaction Gas cost and consensus time. In order to solve the above problems, the Ethereum transaction mechanism is studied, the factors affecting the Gas price are analyzed, and the extreme gradient boosting model(extreme gradient boosting, XGBoost) is optimized through the grid search algorithm, and the Ethereum transaction intelligence based on XGBoost is constructed. Pricing model, which is used in Gas price forecasting. By building a node to access the Ethereum network to obtain transaction data as experimental data, the experimental result shows that the ETH_XGB model can help users save about 72.5% of transaction costs on average, and the transaction success rate is 92%, which is 17.1% higher than the original mechanism.

Key words: Ethereum, smart contract, extreme gradient boosting(XGBoost), Gas price