Preface?序I co-founded Stellar Development Foundation(SDF) in early 2014 to build the Stellar network. From the very beginning and still today many of the most active contributors and supporters have been from the Chinese community. It took years of engineering effort by some of the most talented developers in the world to create and implement the Stellar network. But we got there and now Stellar is now growing rapidly and being used all over the world for a variety of things, cross border payments, tokenizing all kinds of assets, trading, etc. SDF is currently working on scalability. We are implementing things like payments channels and sub-networks to make the network scale way beyond its current capacity.It is also no longer just SDF pushing things forward. There are now many companies built on top of Stellar and contributing to the ecosystem. It has been an amazing journey so far and although there is still a lot to do we are getting close to achieving our goal of creating an internet level protocol for payments and financial activity. This will level the playing field for everyone and increase not just financial inclusion but economic participation and lead to all kinds of interesting innovation and benefits for everyone. Wenpeng Song, Ran Liang and Feng Han are all early participants in the Chinese technology community and Stellar community. I’m really excited that they are still involved and thank them for the books they brought to the Stellar technology community. Looking forward to the road ahead!Jed McCaleb 前 言 Preface当下,区块链技术受到越来越多的关注,区块链作为一种基础操作系统,是各种技术的黏合剂,是在不可信网络下实现可信交易(事务/业务)的一种手段,是在数据确权基础上的一种有效价值流通手段,是改变社会协作关系的一种有效途径。区块链技术在当前处于发展早期阶段,各种区块链基础协议层出不穷,各种技术和思想百家争鸣,为了讨论方便,书中的图尽量采用UML(统一建模语言)形式表达,同时,为达成共识,给出了以下统一基础术语:区块链技术:一种分布式记账技术,各类与区块链相关技术的统称。分布式记账技术:一种分布式技术,是区块链技术的超集和泛化。账页:通常认为是区块链数据中的一个区块,包含了事务集合和额外区块头信息。分布式账本:是账页的集合,区块链数据承载在分布式账本中。区块链基础协议:通常含有P2P、共识机制、密码学和智能合约等几部分的一种区块链技术完整实现。区块链网络:区块链基础协议的实例化部署,一个区块链基础协议可以部署任意个区块链网络。Stellar区块链基础协议自2014年创建以来,其技术成熟度逐步得到业界认可,自身的技术社区逐步发展壮大。Stellar自身的特征特点为开展区块链场景应用提供了很好的基础条件,为区块链基础协议开发提供了很好的实现参考依据。本书结构本书从逻辑上分为五部分:第一部分(第1~3章)重点从工程实践的角度来审视区块链技术,介绍了区块链的基础概念和Stellar区块链基础协议的概念。第二部分(第4、5章)给出了两个典型的应用场景案例,一个是数据确权的应用场景,一个是基于数据确权的价值流通应用场景,展现了区块链的两层应用,引导读者结合区块链开展工程实践应用。第三部分(第6章)给出了基于Stellar区块链技术的系统架构设计参考,从业务架构设计、逻辑架构设计、物理架构设计、数据架构设计和账户架构设计等几方面给出了关键架构设计要点。第四部分(第7、8章)详细说明了如何将一个stellar-core区块链节点接入已有的Stellar区块链网络中,并搭建horizon实例以实现对外提供访问区块链网络的服务能力,同时,给出了搭建一个新的Stellar区块链网络的详细步骤,并介绍了对关键代码的定制化改造。第五部分(第9章)介绍了Stellar技术社区已有的工具,以及将Stellar区块链技术和已有业务系统快速集成的方法。本书读者对象本书读者对象主要包括:区块链技术开发者;区块链应用产品经理;技术架构师和业务架构师;部分技术驱动型企业的中高层管理者。致谢本书的萌芽从2016年开始产生。笔者在进行基于Stellar的区块链系统开发过程中,基于Stellar官方文档,整理了大量的开发文档。为了方便区块链技术社区了解Stellar区块链技术,开阔思路,本书的三位作者,自2017年年底以来,经过一年多的讨论、收集社区反馈、对知识框架进行整理和重构,终于完成本书。本书成书过程中得到了Stellar技术社区的早期参与者程宽、Ella、走路、老虎、陈斌等的鼓励和帮助,同时也得到Stellar区块链技术创始人Jed McCaleb先生的大力支持,Stellar技术社区的小伙伴也提供了大量的反馈,在此一并谢过。感谢机械工业出版的杨福川主编、李良编辑和李艺编辑细心指导和卓有成效的付出,同时,感谢爱人和父母的理解和支持,感谢所有在本书创作过程中以不同形式参与的同学和朋友。区块链技术发展日新月异,各种区块链新技术不断提出,Stellar区块链技术自身也在快速迭代,本书无法及时同步最新的技术变化,所以存在不足不可避免,欢迎各位读者朋友批评指正。宋文鹏 2019年于北京
前 言 Preface当下,区块链技术受到越来越多的关注,区块链作为一种基础操作系统,是各种技术的黏合剂,是在不可信网络下实现可信交易(事务/业务)的一种手段,是在数据确权基础上的一种有效价值流通手段,是改变社会协作关系的一种有效途径。区块链技术在当前处于发展早期阶段,各种区块链基础协议层出不穷,各种技术和思想百家争鸣,为了讨论方便,书中的图尽量采用UML(统一建模语言)形式表达,同时,为达成共识,给出了以下统一基础术语:区块链技术:一种分布式记账技术,各类与区块链相关技术的统称。分布式记账技术:一种分布式技术,是区块链技术的超集和泛化。账页:通常认为是区块链数据中的一个区块,包含了事务集合和额外区块头信息。分布式账本:是账页的集合,区块链数据承载在分布式账本中。区块链基础协议:通常含有P2P、共识机制、密码学和智能合约等几部分的一种区块链技术完整实现。区块链网络:区块链基础协议的实例化部署,一个区块链基础协议可以部署任意个区块链网络。Stellar区块链基础协议自2014年创建以来,其技术成熟度逐步得到业界认可,自身的技术社区逐步发展壮大。Stellar自身的特征特点为开展区块链场景应用提供了很好的基础条件,为区块链基础协议开发提供了很好的实现参考依据。本书结构本书从逻辑上分为五部分:第一部分(第1~3章)重点从工程实践的角度来审视区块链技术,介绍了区块链的基础概念和Stellar区块链基础协议的概念。第二部分(第4、5章)给出了两个典型的应用场景案例,一个是数据确权的应用场景,一个是基于数据确权的价值流通应用场景,展现了区块链的两层应用,引导读者结合区块链开展工程实践应用。第三部分(第6章)给出了基于Stellar区块链技术的系统架构设计参考,从业务架构设计、逻辑架构设计、物理架构设计、数据架构设计和账户架构设计等几方面给出了关键架构设计要点。第四部分(第7、8章)详细说明了如何将一个stellar-core区块链节点接入已有的Stellar区块链网络中,并搭建horizon实例以实现对外提供访问区块链网络的服务能力,同时,给出了搭建一个新的Stellar区块链网络的详细步骤,并介绍了对关键代码的定制化改造。第五部分(第9章)介绍了Stellar技术社区已有的工具,以及将Stellar区块链技术和已有业务系统快速集成的方法。本书读者对象本书读者对象主要包括:区块链技术开发者;区块链应用产品经理;技术架构师和业务架构师;部分技术驱动型企业的中高层管理者。致谢本书的萌芽从2016年开始产生。笔者在进行基于Stellar的区块链系统开发过程中,基于Stellar官方文档,整理了大量的开发文档。为了方便区块链技术社区了解Stellar区块链技术,开阔思路,本书的三位作者,自2017年年底以来,经过一年多的讨论、收集社区反馈、对知识框架进行整理和重构,终于完成本书。本书成书过程中得到了Stellar技术社区的早期参与者程宽、Ella、走路、老虎、陈斌等的鼓励和帮助,同时也得到Stellar区块链技术创始人Jed McCaleb先生的大力支持,Stellar技术社区的小伙伴也提供了大量的反馈,在此一并谢过。感谢机械工业出版的杨福川主编、李良编辑和李艺编辑细心指导和卓有成效的付出,同时,感谢爱人和父母的理解和支持,感谢所有在本书创作过程中以不同形式参与的同学和朋友。区块链技术发展日新月异,各种区块链新技术不断提出,Stellar区块链技术自身也在快速迭代,本书无法及时同步最新的技术变化,所以存在不足不可避免,欢迎各位读者朋友批评指正。宋文鹏 2019年于北京序I co-founded Stellar Development Foundation(SDF) in early 2014 to build the Stellar network. From the very beginning and still today many of the most active contributors and supporters have been from the Chinese community. It took years of engineering effort by some of the most talented developers in the world to create and implement the Stellar network. But we got there and now Stellar is now growing rapidly and being used all over the world for a variety of things, cross border payments, tokenizing all kinds of assets, trading, etc. SDF is currently working on scalability. We are implementing things like payments channels and sub-networks to make the network scale way beyond its current capacity.It is also no longer just SDF pushing things forward. There are now many companies built on top of Stellar and contributing to the ecosystem. It has been an amazing journey so far and although there is still a lot to do we are getting close to achieving our goal of creating an internet level protocol for payments and financial activity. This will level the playing field for everyone and increase not just financial inclusion but economic participation and lead to all kinds of interesting innovation and benefits for everyone. Wenpeng Song, Ran Liang and Feng Han are all early participants in the Chinese technology community and Stellar community. I’m really excited that they are still involved and thank them for the books they brought to the Stellar technology community. Looking forward to the road ahead!Jed McCaleb