MCPcopy Index your code

hub / github.com/dukedaily/go-bitcoin-demo / functions

Functions50 in github.com/dukedaily/go-bitcoin-demo

↓ 5 callersFunctionisValidAddress
(address string)
wallet.go:108
↓ 4 callersFunctionGetBlockChainInstance
获取区块链实例,用于后续操作, 每一次有业务时都会调用
blockchain.go:70
↓ 4 callersMethodNewIterator
将Iterator绑定到BlockChain
blockchain.go:156
↓ 4 callersMethodNext
给Iterator绑定一个方法:Next 1. 返回当前所指向的区块 2. 向左移动(指向前一个区块)
blockchain.go:168
↓ 4 callersMethodsetHash
# 获取交易ID 对交易做哈希处理
transaction.go:51
↓ 4 callersFunctionuintToByte
(num uint64)
utils.go:10
↓ 3 callersFunctionNewWalletManager
创建walletManager结构
walletmanager.go:25
↓ 3 callersFunctiongetPubKeyHashFromPubKey
给定公钥,得到公钥哈希值
wallet.go:72
↓ 3 callersMethodisCoinbaseTx
判断一笔交易是否为挖矿交易
transaction.go:99
↓ 3 callersFunctionisFileExist
判断文件是否存在
utils.go:24
↓ 3 callersFunctionnewTXOutput
由于没有办法直接将地址赋值给TXoutput,所以需要提供一个output的方法
transaction.go:39
↓ 2 callersMethodFindMyUTXO
获取指定地址的金额,实现遍历账本的通用函数 给定一个地址,返回所有的utxo
blockchain.go:207
↓ 2 callersFunctionNewBlock
创建一个区块(提供一个方法) 输入:数据,前区块的哈希值 输出:区块
block.go:45
↓ 2 callersFunctionNewCoinbaseTx
# 创建挖矿交易
transaction.go:73
↓ 2 callersFunctionNewProofOfWork
创建ProofOfWork block由用户提供 target目标值由系统提供
proofofwork.go:29
↓ 2 callersMethodPrepareData
拼接nonce和block数据
proofofwork.go:82
↓ 2 callersMethodSerialize
绑定Serialize方法, gob编码
block.go:76
↓ 2 callersFunctioncheckSum
得到4字节的校验码
wallet.go:100
↓ 2 callersMethodfindTransaction
(txid []byte)
blockchain.go:381
↓ 2 callersFunctiongetPubKeyHashFromAddress
通过地址,反推出公钥哈希,注意不是公钥
wallet.go:85
↓ 2 callersMethodtrimmedCopy
trim修剪, 签名和校验时都会使用
transaction.go:247
↓ 1 callersMethodAddBlock
提供一个向区块链中添加区块的方法
blockchain.go:109
↓ 1 callersFunctionCreateBlockChain
用于访问bolt数据库,得到最好一个区块的哈希值 创建区块,从无到有:这个函数仅执行一次
blockchain.go:25
↓ 1 callersFunctionDeserialize
反序列化,输入[]byte,返回block
block.go:92
↓ 1 callersMethodHashTransactionMerkleRoot
简易梅克尔根,把所有的交易拼接到一起,做哈希处理,最终赋值给block.MerKleRoot
block.go:108
↓ 1 callersMethodIsValid
()
proofofwork.go:100
↓ 1 callersFunctionNewTransaction
创建普通交易 1. from/*付款人*/,to/*收款人*/,amount输入参数/*金额*/
transaction.go:110
↓ 1 callersMethodRun
挖矿函数,不断变化nonce,使得sha256(数据+nonce) < 难度值 返回:区块哈希,nonce
proofofwork.go:47
↓ 1 callersMethodRun
const Usage1 = "" + "./block" + "" 负责解析命令的方法
cli.go:33
↓ 1 callersMethodaddBlock
(data string)
commandline.go:5
↓ 1 callersMethodcreateBlockChain
(address string)
commandline.go:16
↓ 1 callersMethodcreateWallet
()
walletmanager.go:41
↓ 1 callersMethodcreateWallet
()
commandline.go:148
↓ 1 callersMethodfindNeedUTXO
输入:地址,金额 返回:map[string][]int, float64
blockchain.go:297
↓ 1 callersMethodgetAddress
- ==根据私钥生成地址==
wallet.go:54
↓ 1 callersMethodgetBalance
(address string)
commandline.go:68
↓ 1 callersMethodlistAddress
()
commandline.go:164
↓ 1 callersMethodlistAddresses
()
walletmanager.go:121
↓ 1 callersMethodloadFile
读取wallet.dat文件,加载wm中
walletmanager.go:95
↓ 1 callersFunctionnewWalletKeyPair
- ==创建秘钥对==
wallet.go:33
↓ 1 callersMethodprint
()
commandline.go:30
↓ 1 callersMethodprintTx
()
commandline.go:177
↓ 1 callersMethodsaveFile
()
walletmanager.go:67
↓ 1 callersMethodsend
(from, to string, amount float64, miner, data string)
commandline.go:99
↓ 1 callersMethodsign
实现具体签名动作(copy,设置为空,签名动作) 参数1:私钥 参数2:inputs所引用的output所在交易的集合: > key :交易id > value:交易本身
transaction.go:194
↓ 1 callersMethodsignTransaction
签名函数
blockchain.go:327
↓ 1 callersMethodverify
具体校验
transaction.go:269
↓ 1 callersMethodverifyTransaction
校验单笔交易
blockchain.go:352
MethodString
()
transaction.go:319
Functionmain
()
main.go:3