Nervos Appchain 101
Nervos AppChain 是一个成熟的应用公链解决方案,Layer1(CKB), 在这个层级,只做最简单的一条基础公链,关注共识和安全,是整个网络的安全基石,采用了 新型的POW共识 算法机制实现。Layer2(Nervos AppChain),在这个层级主要关注性能,运行效率是最高诉求,每秒最高可以达到 15000TPS,采用了 BFT 共识算法。
-
CITA 是什么
CITA是秘猿科技的区块链产品, Nervos Appchain的核心基于cita改良,
能够提供基础链以及发币事项。 -
对外测试环境已经部署完成
①IP和端口号:121.196.200.225:1337
②举例说明:
查询有几个节点:
curl -X POST —data
‘{“jsonrpc”:“2.0”,“method”:“net_peerCount”,“params”:[],“id”:74}’ 121.196.200.225:1337
其他命令请查看相关API文档
https://cryptape.github.io/cita/zh/usage-guide/rpc/
Nervos AppChain 文档:
https://docs.nervos.org/nervos-appchain-docs/
– 测试链相关信息 –
- 测试链配置:4个节点,4核8G,10M带宽
- IP和端口号:121.196.200.225:1337 (或 https://node.cryptape.com)
- 举例说明:
查询有几个节点:
curl -X POST —data
‘{“jsonrpc”:“2.0”,“method”:“net_peerCount”,“params”:[],“id”:74}’ 121.196.200.225:1337
其他命令请查看相关API文档 :https://docs.nervos.org/cita/
Nervos AppChain Document Description: https://docs.nervos.org/#/README
-
能帮忙找一下那个transaction data在窗口被打印出来的地方吗?
这个transaction data应该是在 appchain-truffle-migrate的
contract/contract.js中的return contract.deploy({ data: self.bytecode,
arguments: args }).send(tx)被打印出来的问题已经解决了,需要把
“@nervos/chain” 升级到 “^0.17.18”,transaction data就不会被打印出来了 -
一般来说一个 dapp 要赢得外界信任,都要公开哪些东西?合约地址、合
约源码,前端和后端代码要开源嘛?
首选公开的是合约,因为你在DApp里调用合约的时候会让你需要确认,如
果合约的输入没问题,即表示合约没问题,那前后端是什么情况问题就不大
了。
5.我在Ubuntu 16.04里搭建一个CITA环境,遇到一些问题,希望能得到解答,开始./env.sh tests/integrate_test/cita_start.sh是可以在container里面用peer_count.py确认CITA在运行,可是后来就一直得到check height growth: failed to get_height(old),虽然过后显示CITA start OK,peer_count.py查不到节点的存在了,应该怎么解决这个问题?第二,开始虽然peer_count.py有查到节点,可是并没有新的container增加,这是因为是test环境吗?第三,我没有理解cita-run和cita-build image的区别,有相关的文档吗?谢谢!peer_count.py返回0?
1)在cita start是在一个container里运行4个节点起,初始搭建共识节点数量占基数的2/3,共识才能出块。
2)cita-run是cita的运行环境
3)cita-build是cita的编译环境
4)peer_count.py返回的是CITA is not working
5)ps aux | grep cita
6)看下是否cita进程运行了,是不是启动的时候失败了
应该是运行了:root 15919 0.0 0.1 36660 3940 pts/0 Sl+ 04:03 0:00 cita-forever
root 15921 0.0 0.1 36660 3832 pts/0 Sl+ 04:03 0:00 cita-forever
root 15923 0.0 0.1 36660 3780 pts/0 Sl+ 04:03 0:00 cita-forever
root 15924 0.0 0.2 36660 5492 pts/0 Sl+ 04:03 0:00 cita-forever
root 15932 1.1 4.5 331268 92400 pts/0 Sl+ 04:03 0:02 cita-jsonrpc -c jsonrpc.toml
root 15933 8.2 3.8 406492 77180 pts/0 Sl+ 04:03 0:17 cita-executor -g genesis.json -c executor.toml
root 15934 2.5 3.7 342008 75436 pts/0 Sl+ 04:03 0:05 cita-auth -c auth.toml
root 15936 1.1 3.5 338420 70976 pts/0 Sl+ 04:03 0:02 cita-chain -c chain.toml
root 15937 3.1 3.2 331192 66564 pts/0 Sl+ 04:03 0:06 cita-bft -c consensus.toml -n ntp.toml
root 15938 1.4 3.4 316716 70384 pts/0 Sl+ 04:03 0:03 cita-network -c network.toml
root 15945 3.1 3.3 331200 66656 pts/0 Sl+ 04:03 0:06 cita-bft -c consensus.toml -n ntp.toml
root 15946 8.2 3.8 406492 77704 pts/0 Sl+ 04:03 0:17 cita-executor -g genesis.json -c executor.toml
root 15953 1.1 4.5 331268 92448 pts/0 Sl+ 04:03 0:02 cita-jsonrpc -c jsonrpc.toml
root 15954 1.3 3.5 316716 71504 pts/0 Sl+ 04:03 0:03 cita-network -c network.toml
root 15955 1.2 3.5 338420 70944 pts/0 Sl+ 04:03 0:02 cita-chain -c chain.toml
root 15956 2.5 3.7 344056 75432 pts/0 Sl+ 04:03 0:05 cita-auth -c auth.toml
root 15962 3.1 3.2 331196 66484 pts/0 Sl+ 04:03 0:06 cita-bft -c consensus.toml -n ntp.toml
root 15963 1.1 4.5 331268 92656 pts/0 Sl+ 04:03 0:02 cita-jsonrpc -c jsonrpc.toml
root 15964 8.2 3.8 406500 77400 pts/0 Sl+ 04:03 0:17 cita-executor -g genesis.json -c executor.toml
root 15965 1.1 3.5 338420 70636 pts/0 Sl+ 04:03 0:02 cita-chain -c chain.toml
root 15966 2.5 3.7 342008 75504 pts/0 Sl+ 04:03 0:05 cita-auth -c auth.toml
root 15967 1.3 3.4 316716 70564 pts/0 Sl+ 04:03 0:03 cita-network -c network.toml
root 15969 1.2 3.4 338420 70592 pts/0 Sl+ 04:03 0:02 cita-chain -c chain.toml
root 15970 3.1 3.3 331196 66716 pts/0 Sl+ 04:03 0:06 cita-bft -c consensus.toml -n ntp.toml
root 15971 8.2 3.8 406500 77524 pts/0 Sl+ 04:03 0:17 cita-executor -g genesis.json -c executor.toml
root 15972 2.5 3.7 342008 75536 pts/0 Sl+ 04:03 0:05 cita-auth -c auth.toml
root 15975 1.4 3.5 316716 71552 pts/0 Sl+ 04:03 0:03 cita-network -c network.toml
root 15976 1.1 4.7 333316 96064 pts/0 Sl+ 04:03 0:02 cita-jsonrpc -c jsonrpc.toml
-
container里面的logs是在container外也保留吗?
是的,因为是共享了cita这个目录,用docker的话,共享在容器里面。 -
请问目前节点的具体性能配置是?
接近版本1的配置
8.8.1在测试部署cita侧链时,常遇到一些问题,如:
按照https://crytape.github.io/cita/zh/getting __ started/index.html
的教程变异了docker版本,按照文档,应该有target/install/bin/admintool.sh/来进行节点配置,可
是没有发现这个文件,怎么办?
8.2另外,准备了4台vps,每台只有一个IP地址,怎么把这些配置分配到4台vps组成网络运行呢?
具体可查阅下列文档地址,查找信息,若有其他疑问,可继续在https://forms。nervos.org
或查阅github上的信息翻阅。
https://cryptape.github.io/cita/zh/getting_started/index.html#_6
-
能帮忙找一下那个transaction data在窗口被打印出来的地方吗?
需要把"@nervos/chain" 升级到 “^0.17.18”,transaction data就不会被打印
出来了。 -
请问一下 0.18支持到solidity多少版本了?现在支持国密么?
支持0.4.24 版本 -
目前Appchain的交易签名和 ethereumjs-tx 签名方法兼容吗?
appchain的交易签名算法和etc一致,和eth有略微区别,另外,appchain的签名对象中加入了chainid,所以同一个数据签出来的内容etc上不会产生重放攻击。 -
那个container里面的logs是在container外也保留着?
是的,因为是共享了cita这个目录,用docker的话,共享在容器里面。 -
现在的教程是在一台电脑上启动4个docker进行测试,我现在准备在4个vps上,每个vps启动一个节点组成网络进行测试,该怎么处理呢?
回答:首先cita 对外有三个东西,一个是 jsonrpc的 http 端口,一个是 jsonrpc 的 websocket 端口,最后一个是 network 的对外端口,前两个对人,后一个是节点间通信,如果是四台vps,每台一个节点,那么直接用 —net=host 就行了,docker容器使用宿主机的网络 -
部署了4个节点,都启动了,但是发现4台vps指定的端口都没有在监听,这个是什么问题?
回答:如果是四台vps,每台一个节点,那么直接用 —net=host 就行了,docker容器使用宿主机的网络。 -
scripts/release.sh debug 这个命令教程里面没有,我需要执行么?还是按教程执行create_cita_config.py配置节点然后启动节点就好?
这个不用执行的,配置节点就好了。 -
参考新文档配置docker,结果报错,帮忙看看什么问题吧
./env.sh ./scripts/create_cita_config.py create --nodes
“127.0.0.1:4000,127.0.0.1:4001,127.0.0.1:4002,127.0.0.1:4003”
docker container cita_build_data_cita is already running
sh: 1: create_key_addr: not found
sh: 1: create_key_addr: not found
Traceback (most recent call last):
File “./scripts/create_cita_config.py”, line 450, in
main()
File “./scripts/create_cita_config.py”, line 438, in main
args = parse_arguments()
File “./scripts/create_cita_config.py”, line 405, in parse_arguments
authorities, signers = generate_authorities(len(args.nodes))
File “./scripts/create_cita_config.py”, line 67, in generate_authorities
with open(address_path, ‘rt’) as stream:
FileNotFoundError: [Errno 2] No such file or directory: ‘/tmp/tmpuqhskd62’
回答:install 目录东西不全, 请检查下是否 bin 文件下没有 create_key_addr 这个可执行文件,若果有,建议重新执行一下make debug,或者直接用 0.16 版本,也许是中间哪个 commit 改错了。 -
如 ./env.sh ./bin/cita setup node/0
docker container cita_run_mnt_cita_target_install is already runningsetup 这个提示是正常的吗?
./env.sh ./bin/cita setup node/1
Start docker container cita_run_mnt_cita_target_install …
Unable to find image ‘cita/cita-run:ubuntu-18.04-20180523’ locally
Repository cita/cita-run already being pulled by another client. Waiting显示已经在运行,要等待3和4在正常pull看起来是正常的,请给出建议,谢谢。
回答:第一个正常的,第二个要先拉镜像。第二个等了一段时间之后完成了。
未完,待续。。。
后续更多技术问题解答会继续整理成合集,有任何问题欢迎积极提问!
我们会提供热情的服务!