首页 > 资料专栏 > IT > IT技术 > 数据存储 > 一种改进的比特币挖矿方案及其可行性研究报告DOC

一种改进的比特币挖矿方案及其可行性研究报告DOC

kubite
V 实名认证
内容提供者
资料大小:2159KB(压缩后)
文档格式:DOC
资料语言:中文版/英文版/日文版
解压密码:m448
更新时间:2021/4/14(发布于北京)

类型:金牌资料
积分:--
推荐:升级会员

   点此下载 ==>> 点击下载文档


文本描述
I 摘要 自 2009 年初开始 Bitcoin 的出现吸引了人们广泛的关注,与此同时分布式虚拟货币的 受欢迎程度迅速增加。从那时起业内一直保持了活跃的 Bitcoin 挖矿状态,而在 Bitcoin 挖 矿的硬件方面,大家犹如军备竞赛般地不断投入和改良。而这其中的重中之重就是散列率 和采矿设备的能源消耗,这直接关系到 Bitcoin 挖矿的利润是否可观。而从计算机角度来看, Bitcoin 挖矿实质上就是关于双重 SHA256 散列的计算问题,即多次输入一定的数据流反复 混合求得最终结果。截至目前,在 Bitcoin 挖矿方法的优化领域,大量的研究致力于对 SHA256 散列标准实现的硬件优化,少有对 Bitcoin 特定 SHA256 挖掘算法的软件优化。 本文主要研究 Bitcoin 采矿过程和 SHA256 散列算法的优化问题,以便提高挖掘效率。 创新之处是从软件思路出发,提出并分析了改进 Bitcoin 双 SHA256 散列算法采矿协议的若 干步骤,然后进行了部分代码测试。根据初步估算,在同样硬件条件下采用这些优化建议 后,Bitcoin 挖矿过程将仅需大约 1.86 倍,而不是正常情况下 2 倍的 SHA256 运行时间。另 外我们也对 Bitcoin 挖矿的奖励方法提出了改进意见,由跳跃式的奖励模式改为线性奖励模 式,长远来看这样会带来更好的公平性。另外为了提高加密运算的抗碰撞性及散列结果的 雪崩效应,我们也对 SHA256 算法本身提出了一种改进方案。 报告前半部分介绍了 Bitcoin 产生的历史背景和研究现状,阐述了 Bitcoin 和 SHA256 算法的概念、组成、功能设计,提出了未来改进思路;后半部分讨论 Bitcoin 块头散列算法 及其含义,详细叙述我们对现有 Bitcoin 挖矿算法的优化和改进,即在特定阶段引入特定的 优化方法以减少特定轮的调度损耗, 但最终仍能实现与传统 SHA256 算法相同的计算结 果。经过估算我们预期, 如果采矿设备能实现上述优化方案, 挖矿速度将有所提高,一般 每次挖矿仅需大约 1.86 倍,而不是原来 2 倍的 SHA256 算法运行时间。考虑到矿机单位时 间内需要完成巨大数量的 SHA256 计算,上述改进将带来非常可观的效益。 关键词,Bitcoin,SHA256,挖矿,优化Abstract II Abstract Since early 2009, the emergence of Bitcoin has attracted the attention of large number of users, at the same time the popularity of distributed virtual currency increases rapidly. For a long time, in order to keep active state of the Bitcoin mining arena, mining hardware has been in a state of continuous optimization and improvement. Thereof most important is the hash rate and the energy consumption of mining equipment, which is directly related to mining profitability. From the point of view of computation, Bitcoin mining is essentially a calculation problem of dual SHA256 hash, namely a flow of big input data is compressed into some final predefined labels. So far in the Bitcoin mining area, a lot of research has been committed to the hardware enhancement for SHA256 hash, but rarely to SHA256 specific Bitcoin mining algorithm optimization. This thesis mainly focus on Bitcoin mining and SHA256 hash algorithm. As some first trial, our study will not be based on the improvement of hardware, but focus on the specific SHA256 hash mining protocol optimization, in order to make mining faster and more efficient. The first part will introduce the background of Bitcoin development status quo, as well as the importance of this research; we will focus on the Bitcoin and SHA256 itself in the concept, composition and function of the necessary instructions; The fourth chapter mainly discusses Bitcoin related algorithm and the meaning of its block header; The fifth chapter details my improvements on normal Bitcoin mining algorithm, for a specific stage with a variety of optimizations, trying to reduce the message scheduling consumption, but eventually obtain the same calculation results as that of normal SHA256. Through some quantitative analyses we found that, Bitcoin equipments will significantly increase the speed of mining, if they can realize the optimization scheme above: For a typical Bitcoin mining cycle, they need usually to spend only about 1.86 times, rather than the original 2 times of SHA256 calculation time. Keywords: Bitcoin, SHA256, Mining, Optimization目录 1 目 录 摘要............................................................................................................................................... I Abstract....................................................................................................................................... II 第一章 绪论................................................................................................................................. 1 1.1 引言................................................................................................................................... 1 1.2 Bitcoin 研究背景........................................................................................................... 3 1.3 国内外 Bitcoin 研究现状............................................................................................... 4 1.3.1 Bitcoin 特征........................................................................................................ 4 1.3.2 Bitcoin 风险........................................................................................................ 5 1.3.3 Bitcoin 市场价值................................................................................................ 6 1.3.4 Bitcoin 挖矿现状................................................................................................ 6 1.3.5 Bitcoin 散列函数研究进展................................................................................ 7 1.4 报告内容与结构............................................................................................................... 8 第二章 Bitcoin 概述.................................................................................................................... 9 2.1 什么是 Bitcoin................................................................................................................ 9 2.1.1 Bitcoin 交易........................................................................................................ 9 2.1.2 目标与难度.......................................................................................................... 10 2.2 Bitcoin 协议框架......................................................................................................... 10 2.2.1 梅克尔树和梅克尔根.......................................................................................... 11 2.2.2 Bitcoin 地址...................................................................................................... 13 2.3 Bitcoin 采矿................................................................................................................. 13 2.3.1 采矿奖励和交易费.............................................................................................. 14 2.3.2 采矿奖励的改进建议.......................................................................................... 14 第三章 SHA256 散列算法及其改进............................................................................................ 15 3.1 SHA256 概述................................................................................................................... 15 3.1.1 安全散列算法 SHA............................................................................................... 15 3.1.2 单向散列算法...................................................................................................... 15 3.1.3 SHA256 在 Bitcoin 系统中的应用.................................................................... 16 3.2 SHA256 基本架构........................................................................................................... 18 3.2.1 SHA256 预处理.................................................................................................. 18 3.2.2 SHA256 消息调度程序........................................................................................ 19 3.2.3 SHA256 消息压缩功能........................................................................................ 19 3.3 涉及 SHA256 的操作分析.............................................................................................. 23 3.4 一种可能的 SHA256 改进方案...................................................................................... 24 第四章 Bitcoin 块头散列算法.................................................................................................. 26目录 2 4.1 Bitcoin 块头散列算法概述......................................................................................... 26 4.2 Bitcoin 块头的细节..................................................................................................... 28 4.2.1 版本...................................................................................................................... 29 4.2.2 hashPrevBlock and hashMerkleRoot............................................................. 29 4.2.3 时间戳和目标...................................................................................................... 29 4.2.4 随机数以及填充长度.......................................................................................... 29 第五章 SHA256 算法优化............................................................................................................ 31 5.1 SHA256 的初始计算和早期排斥................................................................................... 31 5.2 SHA256 增量计算........................................................................................................... 33 5.3 节省随机数增量与硬编码............................................................................................. 34 5.4 恒消息调度与增量信息表............................................................................................. 38 5.5 对 SHA256 通过动态硬编码的处理............................................................................... 39 5.6 双重 SHA256 优化效果的估计....................................................................................... 39 第六章 总结与展望..................................................................................................................... 43