golang[45]-区块链-挖矿困难度

栏目: Go · 发布时间: 7年前

/*
*计算挖矿difficulty
 */
func CalculateDifficulty(strTargetHash string) string {
	strGeniusBlockHash := "00000000ffff0000000000000000000000000000000000000000000000000000" // 创世块编号

	var biGeniusHash big.Int
	var biTargetHash big.Int
	biGeniusHash.SetString(strGeniusBlockHash, 16)
	biTargetHash.SetString(strTargetHash, 16)

	difficulty := big.NewInt(0)
	difficulty.Div(&biGeniusHash, &biTargetHash)
	//fmt.Printf("%T \n" , difficulty)
	return fmt.Sprintf("%s", difficulty)
}

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Semi-Supervised Learning

Introduction to Semi-Supervised Learning

Xiaojin Zhu、Andrew B. Goldberg / Morgan and Claypool Publishers / 2009-6-29 / USD 40.00

Semi-supervised learning is a learning paradigm concerned with the study of how computers and natural systems such as humans learn in the presence of both labeled and unlabeled data. Traditionally, le......一起来看看 《Introduction to Semi-Supervised Learning》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器