二维码

6.3 实战:多重签名交易 - 数据结构 - 机器学习

1255 人阅读 | 时间:2021年01月15日 01:19
6.3 实战:多重签名交易 - 数据结构 - 机器学习 #daohang ul li t,.reed .riqi,a.shangg,a.xiatt,a.shangg:hover,a.xiatt:hover,a.shang,a.xiat,a.shang:hover,a.xiat:hover,.reed-pinglun-anniu,span.now-page,#daohangs-around,#caidan-tubiao,#daohangs,#daohangs li,#btnPost{background-color:#D10B04;} .dinglanyou1 h3{border-bottom:3px solid #D10B04;} #dibuer{border-top:2px solid #D10B04;}.cebianlan .rongqi h3{border-bottom:1px solid #D10B04;} #edtSearch{border:1px solid #D10B04;} #daohang .zuo ul li{border-right:1px solid #;} #daohang ul li t a{border-top:1px solid #;border-right:1px solid #D10B04;} #daohang ul li t a:hover{border-right:1px solid #;} #daohang .you ul li a:hover,#daohang .zuo ul li a:hover,.reed-pinglun-anniu:hover{background-color:#;} a:hover,.reed h6 a:hover,#dibuer a:hover,.reed .riqiding,.cebianlan .rongqi li a:hover,#pinglun-liebiao ul.fubens li.depth-1 dl dd span.shu a,#pinglun-liebiao ul.fubens li.depth-1 dl dd span.huifuliuyan a:hover,.reed-biaoti h6 span{color:#D10B04;} .reed .kan a{color:#0A0AF5;}.reed .kan a:hover{color:#D10101;} @media screen and (max-width:1492px){a.shang,a.xiat{background:none;} a.xiat:hover,a.shang:hover{background-color:#f9f9f9;background-image:none;text-decoration:none;}} var _hmt = _hmt || [];(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?b19db5ba3b437a9e8698d2bc8fc64334"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})(); var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?b19db5ba3b437a9e8698d2bc8fc64334"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?2d748c9763cfc72fb7d1ccab29f0770d"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f6d451f3f1be23f3abf240c64c469c1b"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();

当前位置:首页 » 区块链精品文章 » 正文

(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646201", container: s }); })();
(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646162", container: s }); })();

6.3 实战:多重签名交易

1236 人参与  2018年09月30日 14:28  分类 : 区块链精品文章  评论

本节以比特币测试网络作为开发试验环境,结合Node.js实现开源项目ODIN的标识注册功能,说明如何利用多重签名交易形式来嵌入自定义数据,签名广 播后,再被矿工节点确认存入区块链后,最终能被读取、解析,得到注册结果。这样就实现了一个从写入区块链到从区块链读取的完整过程。

6.3.1 将ODIN标识注册到区块链上的实例解析

ODIN是Open Data Index Name即“开放数据索引命名标识”的缩写,第10章中会介绍ODIN更多的技术细节。广义上说,ODIN是指在网络环境下标识和交换数据内容索引的一种 开放式系统。ODIN的实现关键是把数据嵌入比特币交易的多重签名输出数据块中,对于1-of-N输出,每个数据块的第1个公钥固定是发送者的,第2~N 个公钥的地址空间用来存放编码的ODIN消息数据。下面一段文字是ODIN技术规范里对于“新注册ODIN标识”的具体消息定义。

其中:

·比特币源地址对应ODIN标识注册者。

·比特币目的地址对应ODIN标识拥有者。

6.3.2 运行示例程序

示例程序包括两部分。

(1)OdinMonitorTestnet.js

监测比特币测试网络Testnet相关区块链数据的变化,从中解析出新注册的ODIN标识。

源码可以从下述网址下载:http://ppkpub.org/sample/OdinMonitorTestnet.js

(2)OdinRegisterTestnet.js

在比特币测试网络Testnet注册一个新的ODIN标识。

源码可以从下述网址下载:http://ppkpub.org/sample/OdinRegisterTestnet.js

将上述示例代码下载并保存到测试环境下(保存文件名为OdinRegisterTestnet.js和OdinMonitorTestnet.js)。在开发测试环境的命令行下输入以下命令,启动监测示例程序。


node OdinMonitorTestnet.js


然后新开启一个文本终端窗口,在命令行下输入以下命令运行注册示例程序。


node OdinRegisterTestnet.js


运行上述注册示例程序后,到比特币测试网络的Docker运行环境的命令行下输入“make generate BLOCKS=10”,模拟产生新的区块记录,刚产生的交易记录就会得到有效的确认,并被存入区块链中。这时在监测程序的运行界面上就会提示解析到新的 ODIN标识注册记录,如图6-22所示。

6.3 实战:多重签名交易 - 数据结构 - 机器学习

刚接触比特币及其底层区块链技术的开发者常常会面临问题:如何上手比特币区块链应用开发技术?如何了解它的关键技术实践点?本章用简短的篇幅,结合笔者在 PPk ODIN开源项目中的实践经验,用具体案例来阐述和介绍相关开发知识。读者通过学习本章,可以理解RPC协议接口和关键的比特币“交易”数据结构,进而举 一反三,就可以灵活应用到自己的开发实践中。

来源:我是码农,转载请保留出处和链接!

本文链接:http://www.54manong.com/?id=1011

(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646208", container: s }); })();
(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646147", container: s }); })();
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdPic":"","bdStyle":"0","bdSize":"16"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
区块链是什么  

微信号:qq444848023    QQ号:444848023

加入【我是码农】QQ群:864689844(加群验证:我是码农)

<< 上一篇 下一篇 >>
(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646186", container: s }); })();
(function() { var s = "_" + Math.random().toString(36).slice(2); document.write('
'); (window.slotbydup = window.slotbydup || []).push({ id: "u3646175", container: s }); })();
搜索

网站分类

标签列表

最近发表

    (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https'){ bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else{ bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();

全站首页 | 数据结构 | 区块链| 大数据 | 机器学习 | 物联网和云计算 | 面试笔试

var cnzz_protocol = (("https:" == document.location.protocol) ? "https://" : "http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1276413723'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s23.cnzz.com/z_stat.php%3Fid%3D1276413723%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));本站资源大部分来自互联网,版权归原作者所有!

jQuery(document).ready(function($){ /* prepend menu icon */ $('#daohangs-around').prepend('
'); /* toggle nav */ $("#caidan-tubiao").on("click", function(){ $("#daohangs").slideToggle(); $(this).toggleClass("active"); }); });

©著作权归作者所有:来自ZhiKuGroup博客作者没文化的原创作品,如需转载,请注明出处,否则将追究法律责任 来源:ZhiKuGroup博客,欢迎分享。

评论专区
  • 昵 称必填
  • 邮 箱选填
  • 网 址选填
◎已有 0 人评论
搜索
作者介绍
30天热门
×
×
本站会员尊享VIP特权,现在就加入我们吧!登录注册×
»
会员登录
新用户注册
×
会员注册
已有账号登录
×