林建入_《区块链实验课》
如何计算文件哈希
1 | # 命令格式如下 |
如何加解密文件
1 | # base64加密 |
如何建立安全通信
1 | # 生成私钥 |
如何编译比特币
准备
1 | # 切换管理员身份 |
Ubuntu18.04报错GCC不支持C++20
1 | # 报错信息 |
Ubuntu18.04报错Boost is not available!
1 | # 报错信息 |
编译
1 | git clone https://github.com/bitcoin/bitcoin.git |
启动
1 | bitcoind |
如何测试Bitcoin
准备
1 | # 下载官方编译好的Bitcoin压缩包 |
启动服务节点
1 | # -regtest指定测试网络,-fallbackfee指定交易手续费 |
创建钱包
1 | # 创建钱包 |
模拟挖矿
1 | # 查看当前状态 |
模拟转账
1 | # 发起转账1个比特币 |
重新实验
1 | rm -rf ~/.bitcoin/regtest |
认识比特币脚本
官网
-
Transactions OpCodes:https://developer.bitcoin.org/reference/transactions.html
-
Script - Bitcoin Wiki:https://en.bitcoin.it/wiki/Script
-
Bitcoin Source Code Script.h:https://github.com/bitcoin/bitcoin/blob/master/src/script/script.h
-
Bitcoin Source Code Interpreter.cpp:https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp
-
Bitcoin IDE:https://siminchen.github.io/bitcoinIDE/build/editor.html
调试比特币脚本
准备
1 | # 更新系统,安装工具 |
启动btcdeb并交互执行
1 |
|
启动btcdeb并单步调试
1 | btcdeb '[1 2 OP_ADD]' |
如何理解P2PKH
参考资料
- Scripting a P2PKH:https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/09_4_Scripting_a_P2PKH.md
- P2PKH:https://learnmeabitcoin.com/technical/script/p2pkh/
- btcdeb signature checking:https://github.com/bitcoin-core/btcdeb/blob/master/doc/btcdeb.md
如何编译以太坊
准备
1 | # 更新系统,安装工具 |
编译
1 | git clone https://github.com/ethereum/go-ethereum.git |
启动
1 | cd build/bin |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 水木时!