区块链应用开发技术思考及探索

InfoQ 2021-05-09 09:03:47 阅读数:210

本文一共[544]字,预计阅读时长:1分钟~
思考 技术 区块 开发 应用
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"至信链"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"谈到区块链,不得不说一个很经典的问题:区块链的数据到底可不可以更改呢?刚才有人回答说可以,有回答说不可以。其实这两个答案从不同角度解释都是对的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链是分布式的系统,单独对一个节点的数据修改是无法改变整个网络的数据状态的,这些修改必须达成全局共识,才能在区块链中生效。同时它是链式结构,后面的区块会包括前面区块的哈希,对前面区块的任何修改都会导致后面数据块全部需要修改。这些区块链特性,都保证了对于已存在链上的数据很难被修改。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/3e\/3e2a54db68157574d4e1db3b7a6ad9bc.webp","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"基于以上,怎么理解链上数据既不可以更改又可以更改呢?区块链其实可以类比我们的人生,如果把每天当成一个区块的话,这一天一旦结束,昨天的数据就是无法修改的。但是我们能够在今天把昨天想做的事情做得更好一点,也即我们可以在昨天的区块后再附上一个新的区块。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所以说区块链既不可以修改,又可以修改,不可修改主要是对于已经存在的数据,可以修改主要是指可以附加新的区块,整个历史可追溯。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链的技术特性包含以下几个部分:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"第一个是"},{"type":"text","marks":[{"type":"strong"}],"text":"分布式共识"},{"type":"text","text":",通过分布式共识,确保单个节点无法直接写入数据,需要多个节点共识后数据才能写进去。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"第二是"},{"type":"text","marks":[{"type":"strong"}],"text":"块链式结构"},{"type":"text","text":",增加了区块的修改难度,保证数据的完整性。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"第三是"},{"type":"text","marks":[{"type":"strong"}],"text":"智能合约"},{"type":"text","text":",有了在链上的智能合约以后,用户就可以把企业间合作的业务逻辑放在链上,结合链上可信的数据和透明的业务逻辑,加速整体业务流转。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最后一个是"},{"type":"text","marks":[{"type":"strong"}],"text":"密码学技术"},{"type":"text","text":",包括对称、非对称、零知识,同态加密等来保证链上的数据可信及交易隐私。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/79\/79bdefe75454fd7f42700228db772699.webp","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"区块链的数据难篡改,全程可追溯,全网透明等特性,天然适合应用在存证领域"},{"type":"text","text":"。随着信息互联网的发展,现在的信息越来越多,每天都有海量的信息在网络上产生,这些信息有部分可能会被用来做案件的电子证据。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们来看一下统计数据,2018年全国受理的总计2800万件的案件中,有73%的案件涉及到了电子数据,仅7%电子证据被认定。这背后的根本原因是什么?电子数据存在以下几个问题:首先它们大多是中心化的,很容易受到篡改。其次这些数据的量很大,很难有足够的人力去处理。另外电子数据的归属问题也难以解决。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"从电子数据到电子证据,这中间需要一些必要的转化过程,那么区块链是否可以助力实现这样的过程呢?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"从政策方面看,司法端在积极拥抱区块链技术,比如杭州互联网法院基于区块链做的一些判例,最高法对区块链的存证方式也表示了认可。"},{"type":"text","marks":[{"type":"strong"}],"text":"区块链存证既满足合规的需求,同时也有实际的应用需求,这就是至信链落地的背景"},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/96\/96c1820a57fd33b71ca0dd5a8a6d8dea.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"    "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链应用是一个分布式的应用,需要多个组织共同加入维护。我们选择跟一些公信力机构合作,包括网安、北明、工信部一所等权威机构,让他们也成为区块链的节点,来共同维护链上的数据。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另外我们也跟司法端进行打通,至信链的节点会部署到一些法院,比如四川高院、前海法院等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在满足存证的基本需求后,紧接着就会衍生一系列其他的需求。比如存证以后是不是有能力鉴别一下有没有侵权发生?是不是具备侵权监测的能力?如果侵权发生以后是不是能够取证?做完取证以后是不是还能及时的把数据上传到法院......"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"结合区块链技术,整个内容保护的生态形成了闭环。在整个闭环中,我们会在擅长的领域发力。同时我们也积极接入了其他的能力合作方,比如取证方,版权服务方等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"目前至信链整个内容生态已经加入了很多成员,比如腾讯系的企鹅号、腾讯音乐等,还有很多外部合作方,比如贝壳、得到等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们每个人每天在网上都会产生大量的信息,有些信息是有价值的。对于有价值的信息,我们需要及时保护,维护自己的利益。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/f4\/f4a7d2a6fc77463b8c22b9e133750aeb.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在至信链中,我们主要是用区块链来做存证。当用户产生数据以后,用户对数据进行哈希处理,然后存储在至信链上。哈希可以保证一个文件到哈希值是一对一的关系,而且很难从哈希值再反推回原文件,如果对原文件做任何修改也都会导致哈希值发生巨大变化。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/6f\/6f1c4cc14b738bb33c87089fab354048.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当用户认为某个数据很重要,比如一张图片很重要,用户可以把它哈希存储到至信链上。但是单纯的哈希值只能证明这个作品已存在,还不能证明它属于谁,所以还需要加上一些电子签名,同时附带上时间戳。这样我们就能知道:什么时候是谁拥有了什么东西。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"虽然无法知道在这个用户存证之前这张照片是否已经存在,但至少可以保证:如果你是照片拥有方,第一时间上链基本上就可以保证你的权益。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当上链以后,如果发现这张图片被其他人盗用了,版权拥有方就可以起诉侵权方。版权拥有方提交证据原文到法院端,法院端可以跟至信链打通进行链上的校验,保障版权拥有方的权益。至信链其实和我们的生活息息相关,它服务的不仅是供应链、金融,也包括我们个人的版权。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"联盟治理"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"1. 区块链部署方式"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链是一个多中心的分布式网络。当我们需要搭建一个区块链以及在区块链上做业务的时候,第一个遇到的问题就是:我们该怎么搭建这条链?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这里有几种方式,第一是"},{"type":"text","marks":[{"type":"strong"}],"text":"私有化"},{"type":"text","text":"。对于开发能力和运维能力很强的联盟,可能想要自己部署区块链网络把参与方的各个节点打通,同时所有的运维监控,包括智能合约部署全部都由自己的技术人员来负责。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这样操作是可行的,但是也会带来一些问题。主要问题是区块链的应用还没有正式开展的时候,就已经投入了大量的人力物力在区块链底层上,这也相对延缓了上链的进程。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另外一个方式是"},{"type":"text","marks":[{"type":"strong"}],"text":"公有云"},{"type":"text","text":",每个云厂商现在都提供了区块链整套的解决方案,只需要在公有云上轻轻地点击就可以帮助部署自己的区块链网络,包括部署智能合约,同时会自动的对区块链网络进行运维监控。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"用户不用关心底层链到底怎么实现,只需要关心业务层怎么转化成区块链认可的智能合约。这种方式相对比较快。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"随着业务的发展,会渐渐引入一些机构,这些机构或许对数据有一些合规性的要求,这个时候,可以在公有云上再拉一个节点到用户的IDC里面做混合云的解决方案。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/12\/126bad0a6a24fc498c7e2523d92d2307.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"2. 数据上链"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当我们的网络已经部署好了以后,就需要考虑数据的问题。我们在做区块链应用的时候需要考虑:到底要将哪些数据放到链上?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链本身的计算能力和存储是有限的,所以不要浪费有限的计算和存储,只需要把一些"},{"type":"text","marks":[{"type":"strong"}],"text":"关键的信息上链"},{"type":"text","text":"即可,而且关键信息如果很大的话,也可以把关键信息摘要进行上链。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另外对于有争议数据,比如是你单方产生的数据,但是其他方要使用,这时候建议上链;还有多方共同产生的数据,也建议放在链上;对于重要的数据,数据的整个生命周期都应在链上留痕;第三个是多方共同维护的不可拆分的数据也建议上链。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/32\/32cdffda67b30c0b52d701a970e60756.webp","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当这些数据上链以后,所有节点都有账本,所有的参与方都可以看到上链的数据。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链的透明性是一把双刃剑,所有节点都可以看到就意味着隐私性无法得到保护。这就要考虑怎么在数据上链和隐私安全之间做一个权衡。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"数据上链有几种方式。第一种方式是"},{"type":"text","marks":[{"type":"strong"}],"text":"明文上链"},{"type":"text","text":",数据只要制度上保证联盟参与方不泄露,且不涉及到用户隐私是可以明文上链。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果明文上链不可行,还可以选择"},{"type":"text","marks":[{"type":"strong"}],"text":"密文上链"},{"type":"text","text":"。数据的原文参与方是看不到的,而且它是不可操作的,并且缺少明文和对应的私钥也是无法验证的。密文上链的典型场景是存证,哈希存证就是密文上链。当然也可以用对称、非对称的方法加密上链。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"还有一些涉及到账户操作的,比如虽然是密文,但是需要对它进行加减操作。这时候可以引入同态加密的方式。链上的数据都是加密的,这些加密的数据可以和其他一些数据直接操作,比如密文跟明文相加,或者密文跟密文相加,得到的是密文的结果。持有相关私钥的用户,可以解出正确的结果。区块链在其中负责运算的过程,这就可以做到密文可操作。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"密文可操作的缺点在于不可验证。比如用户在链上转了100的资产,这时候其实并不知道用户是否具有100的资产,区块链只是单纯的做了资产相减的操作。这时候"},{"type":"text","marks":[{"type":"strong"}],"text":"希望密文除了可操作,并且还要做到可验证"},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"例如说链上资产需要减去100,这个时候不需要知道具体的资产数额,但只要能证明链上资产大于100就可以满足要求了。我们可以引入"},{"type":"text","marks":[{"type":"strong"}],"text":"零知识"},{"type":"text","text":"来满足对应的需求。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/68\/68388831115b7b08550d0d3f4718b67c.webp","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这些加密算法并不是说每个应用都要全部使用到,主要是根据业务场景需求。在遇到这些场景的时候再结合云厂商提供的方案一起整合到智能合约里,让开发更加顺畅。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"3. 数据膨胀"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"数据上链以后,另外一个挑战就是关于数据膨胀的问题。区块链是一个链式结构,数据存上去以后,后面会不停增加新的区块,它必然会导致大量数据的膨胀,该如何处理呢?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这里有几个解决方案:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"第一个方案是:"},{"type":"text","marks":[{"type":"strong"}],"text":"减少区块本身的大小"},{"type":"text","text":"。这样做一方面是优化区块链底层,在区块链底层引擎里把一些不必要的数据去掉或者存储在另外一个地方,只要能证明该区块的有效性就可以。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另一方面是"},{"type":"text","marks":[{"type":"strong"}],"text":"减少区块里业务层的数据"},{"type":"text","text":",放在区块链里面的数据应该尽量精简,要珍惜有限的存储资源。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"此外我们还可以把存储放在云上的块设备里或者放在分布式存储设备里,这样可以支持很大的存储空间。另外如果本身的存储量已经很大了,可以考虑将一些不常用的存储或者几年前的存储归档存放起来。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/e1\/e1b0573d183749a8003fb213791f2b67.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最后,我们可以以从另外一个角度来考虑,比如数据单链很多,我们可以对区块链进行拆分,这也是做应用常见的方法:当一个库解决不了,就要分库,迁移到这里就是"},{"type":"text","marks":[{"type":"strong"}],"text":"分链"},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"比如存证应用,特定的存证放在不同的链上,底层可以有多条链,通过底层多链的结构解决单链膨胀的问题。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/f9\/f9a3dca2f57c6dfe167ea7b49d0d15d6.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"4. 跨链机制"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"随着区块链技术的发展,以后涉及到的可能不仅是存证,还存在链上数据交易之类的场景。如果单纯的做接入层分层的话很难保证业务的原子性操作,这时就要引入跨链机制,需要有一个跨链事务层解决链和链之间的事务。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"怎么样保证跨链的一致性呢?比如从这条链扣减了,到另外一条链增加,在整个过程要么全成功,要么全失败,所以一定要有一个跨链事务层。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"联盟链网络有身份管理,跨链管理也有跨链身份的管理,将它们结合起来就是跨链的治理平台。我们搭建区块链应用的时候,如果场景需要,也要考虑跨链的技术。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/dc\/dce13b6b9fa4df13334f0b72cb5e0d47.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"5. 业务合规    "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在业务合规层,明文上链会导致一些敏感词在链上。因为区块链的不可篡改,虽然可以在后续的区块里面增加新的数据,但是它不可以修改原来的数据,这个敏感词就永远留在链上。我们建议:在做业务的过程中要考虑敏感词过滤处理。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另外一个点是:你的业务跟区块链的关系是强同步,还是可以接受异步。强同步的意思就是业务数据是强依赖于区块链数据的,当每次做一个业务,数据都必须从区块链上取,这时候你就需要强同步。但由于区块链本身是异步系统,如果做强同步的话,等待时间可能会影响到业务的体验,这是要考虑的问题。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果是做异步的话,比如做存证的场景,虽然短时间产生了大量的数据,但是却可以慢慢地把这些数据推到链上。不过这里有个前提:在数据产生过程中,我们需要尽快得产生时间戳。因为只有附上时间戳才能定位数据产生的时间点。后续虽然是慢慢把数据推到链上,但至少证明在某个时间点上已经有了,这解决数据的及时性问题。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"另外在区块链应用中还需要考虑整个业务该怎么取消或者撤回,这其实也是合约层需要考虑的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"停止服务在区块链里面是非常难的,因为最多可以停止业务层的服务,但是停止不了底层链,如果停止底层链就需要跟各方协作。所以我们一定要"},{"type":"text","marks":[{"type":"strong"}],"text":"设置兜底方案"},{"type":"text","text":",当整个业务层遇到问题该怎么兜底,是不是能引入保险机构或者其他机构,特别是在极端异常情况下能够补偿用户的损失。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/0c\/0c898a559830fe4dc44f77c11eaa81fe.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"6. 腾讯云联盟链治理"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最后来跟大家介绍一下腾讯云联盟链治理的历程。我们在最开始搭建至信链的时候是跟网安、北明和司法机构一起合作。合作首先要达成一个共识,这个共识就是:我们到底要用区块链做什么。最后达成了统一的共识:从可信电子存证开始。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在此之后,我们跟相关的合作方共同设置一个组织架构,包括定义运作流程和相关的负责人,这样大家就可以一起去推进这个事情。我们知道,即使是一个公司不同的部门如果想协同做好一件事情也是很难的。当涉及到多个公司的时候,如果不设立章程制度的话是很难推进的,所以这点很重要。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当我们已经有了流程架构以后,接下来就要研究我们做的事情是否合规,这就要从政策和合规性去解读,如果有些事情不合规就不能做。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果合规了我们也还要考虑一个点:它的兜底方案是什么。区块链有那么多特性,比如在供应链场景我们可以结合IoT、AI等能力,证明仓库货物存在。但是不排除这里面会存在某些问题。因为涉及到资金,所以一定要有兜底方案存在。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当有了合规体系构建以后,我们还需要长期的运营投入。搭建好了应用以后,后面就是不停的迭代过程,在迭代过程中也需要其他机构的配合。在这个过程中,需要提前定义好各参与方的利益分配,另外考核评估制度也要定义好。有了这些以后,才能把应用一直往前推。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"前面三个点多是文件和组织架构性质的,看起来会和业务不太相关。但是如果没有前面三点打好的基础,后面的第四点就是空中楼阁了,当有前面三个点作为铺垫以后才真正进入到技术规范,在技术规范里面包括联盟网络、节点规划、上链数据、隐私保护、外部系统接入和智能合约等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/86\/86b61bec9e689473c284ee55598a41fd.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"未来思考"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在做至信链的过程中,我们也在考虑区块链未来到底是什么样的形态,区块链以后是不是没有链了呢?我个人认为"},{"type":"text","marks":[{"type":"strong"}],"text":"区块链未来会成为一种底层的基础设施,用户不需要自己去建链,区块链跟其他的技术,如物联网、大数据、视频服务和人工智能会结合在一起,共同服务于复杂的业务场景"},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/16\/16a0e6466493513c6047250344eb39d2.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"区块链承载的是数据和业务的可信性,链的底层维护方是谁,是不是都需要为自己业务搭建一条独立的链,这也是们需要考虑的问题。从我个人的角度来说,我认为未来区块链不是每个业务都需要搭建一条链,而很可能会公用部分链。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"    "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"那么至信链未来的发展定位是什么?目前我们和权威机构共同搭建一条数据存证链,保证了数据的可信,同时让可信的数据能够及时流转到法院端,用来更好地服务于内容机构、金融机构,目前的服务包括内容的存证、侵权取证、维权之类等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"后续我们会再结合其他的生态能力,比如版权的、合同的,把强相关的各种能力也做到这条链上,完善至信链服务种类。当这些能力完善后,至信链会为其他不同的产业区块链服务。比如用户可能有自己的区块链应用,但是需要做司法保护的时候,就可以运用至信链跨链把这些数据传过来。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/00\/00ef32b9b05d22dfcccc1f79338aa81f.png","alt":"Image","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"horizontalrule"},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"头图:Unsplash"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"作者:李亮"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"原文:https:\/\/mp.weixin.qq.com\/s\/PaehAdgNNacl0z65dhMCKA"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"原文:区块链应用开发技术思考及探索"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"来源:云加社区 - 微信公众号 [ID:QcloudCommunity]"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"转载:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。"}]}]}
版权声明:本文为[InfoQ]所创,转载请带上原文链接,感谢。 https://www.infoq.cn/article/LbWi78VJpA4ztp8GG8Ja?utm_source=rss&utm_medium=article