这篇“Neo私链怎么部署”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“Neo私链怎么部署”文章吧。
NEO 私有链的部署至少需要 4 台服务器才能取得共识,每台服务器对应一个共识节点。在阿里云上可以买按量付费的虚拟机(机器都是window server)。
记录下四台机器的内网IP地址,后面要用。
172.xxx.xxx.142
如果你想让外部程序访问该节点的 API 需要开放防火墙端口:10331-10334, 20331-20334
阿里云的vpc如果在一个安全组内就不需要设置。也可以通过安全组开放所有入口。
阿里云安全组
运行环境
运行 NEO 节点需要安装 .NET Core Runtime,需要安装 1.0.1 或以上版本
Windows 系统下的安装方法
在 Windows 系统下安装 .NET Core 非常方便,直接下载运行即可。
NOTE
Windows可能还需要安装Microsoft Visual C++ 2015 Redistributable Update 3(https://www.microsoft.com/en-us/download/details.aspx?id=53840) ,否则后面无法启动Neo-CLI。
在四台机器上分别创建钱包数据库,数据库文件会默认生成在neo-cli的目录下面
create wallet wallet.json
db3后缀名的数据库文件不支持了
neo1
neo> create wallet wallet.db3 Wallet files in db3 format are not supported, please use a .json file extension. neo> create wallet wallet.json password: ******** password: ******** address: AS43TUy7VtuGpNJh3YC2NM3asTv3s6piyk pubkey: 02d57c9bbc42b45943867dff0180cb9df266b46db7d027a283eabc7c4b8819c86c
记录下另外几台机器的钱包公钥
neo2
address: AY35ZjJayg9JfmCeHg1nySN4LSMntFEq2h pubkey: 035022ce81faca930ebe6b9f8e830526150e47692f19f58affe1311e42cd0d43bb
neo3
address: AQZNtdGVXbfot5fSaR4ijBqrEwbnFQspmH pubkey: 029f21d56f9422e55f0ef7cf75c092854e01c99aeee73f0effeaa489a96fc7d2b1
neo4
address: AXctyT8ctWTXtWaUFM9o5FJas8BWdBbiqe pubkey: 02dc0e750e21c386537618079d89836eea39fad396206e2e56cfba16bdc014dc5d
{ "ProtocolConfiguration": { "Magic": 1, "AddressVersion": 23, "StandbyValidators": [ "02d57c9bbc42b45943867dff0180cb9df266b46db7d027a283eabc7c4b8819c86c", "035022ce81faca930ebe6b9f8e830526150e47692f19f58affe1311e42cd0d43bb", "029f21d56f9422e55f0ef7cf75c092854e01c99aeee73f0effeaa489a96fc7d2b1", "02dc0e750e21c386537618079d89836eea39fad396206e2e56cfba16bdc014dc5d" ], "SeedList": [ "172.24.198.142:10333", "172.24.198.141:10333", "172.24.198.140:10333", "172.24.198.139:10333" ], "SystemFee": { "EnrollmentTransaction": 0, "IssueTransaction": 0, "PublishTransaction": 0, "RegisterTransaction": 0 } } }
open wallet wallet.json start consensus
如果前面打开过cli,请删除chain目录下的文件,这样区块链高度会从1开始。
截取其中一个打印,后面方便调试的时候研究
neo> open wallet wallet.json password: ******** neo> start consensus [18:04:31] OnStart [18:04:31] initialize: height=1 view=0 index=0 role=Backup [18:04:47] OnChangeViewReceived: height=1 view=0 index=2 nv=2 [18:05:01] timeout: height=1 view=0 state=Backup [18:05:01] request change view: height=1 view=0 nv=1 state=Backup, ViewChanging [18:05:58] OnPrepareRequestReceived: height=1 view=0 index=1 tx=1 [18:05:58] send perpare response [18:06:01] OnPrepareResponseReceived: height=1 view=0 index=2 [18:06:01] relay block: 0x8515184285fa2e454b0eca441580b5cce01cc0e5cb5dd6d7ff53ef13ec7f665e [18:06:01] persist block: 0x8515184285fa2e454b0eca441580b5cce01cc0e5cb5dd6d7ff53ef13ec7f665e [18:06:01] initialize: height=2 view=0 index=0 role=Backup [18:06:16] OnPrepareRequestReceived: height=2 view=0 index=2 tx=1 [18:06:16] send perpare response [18:06:19] OnPrepareResponseReceived: height=2 view=0 index=1 [18:06:19] relay block: 0x35b163f4f524a1ebcc1ef3053e878f9bb37b1f4a8531a060ef18cfd6efefdf45 [18:06:19] persist block: 0x35b163f4f524a1ebcc1ef3053e878f9bb37b1f4a8531a060ef18cfd6efefdf45 [18:06:19] initialize: height=3 view=0 index=0 role=Backup [18:06:49] timeout: height=3 view=0 state=Backup [18:06:49] request change view: height=3 view=0 nv=1 state=Backup, ViewChanging [18:06:49] OnChangeViewReceived: height=3 view=0 index=1 nv=1 [18:06:53] OnChangeViewReceived: height=3 view=0 index=2 nv=1 [18:06:53] initialize: height=3 view=1 index=0 role=Backup [18:06:55] OnPrepareRequestReceived: height=3 view=1 index=2 tx=1 [18:06:55] send perpare response [18:06:55] OnPrepareResponseReceived: height=3 view=1 index=1 [18:06:55] relay block: 0x1766a0602903f513f76561c93fddf312f70d30801310abfecacc89feace5c412 [18:06:55] persist block: 0x1766a0602903f513f76561c93fddf312f70d30801310abfecacc89feace5c412 [18:06:55] initialize: height=4 view=0 index=0 role=Primary [18:07:10] timeout: height=4 view=0 state=Primary [18:07:10] send perpare request: height=4 view=0 [18:07:13] OnPrepareResponseReceived: height=4 view=0 index=3 [18:07:13] OnPrepareResponseReceived: height=4 view=0 index=2 [18:07:13] relay block: 0x5233d9086db97e59f86d73e8735093c1b3fe4569759697ff8a04e0eb8f389091 [18:07:13] persist block: 0x5233d9086db97e59f86d73e8735093c1b3fe4569759697ff8a04e0eb8f389091 [18:07:13] initialize: height=5 view=0 index=0 role=Backup
以上就是关于“Neo私链怎么部署”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。