区块链中文技术社区

Heco链调研

官网

https://www.hecochain.com/zh-cn/

项目介绍

https://docs.hecochain.com/#/intro

白皮书

https://www.hecochain.com/developer.133bd45.pdf

区块浏览器

测试网

https://testnet.hecoinfo.com/

正式网

https://hecoinfo.com/

测试币水龙头

https://scan-testnet.hecochain.com/faucet

开发文档

https://docs.hecochain.com/#/

开源代码

链代码

https://github.com/HuobiGroup/huobi-eco-chain

系统合约

https://github.com/HuobiGroup/huobi-eco-contracts

链相关指数

  1. TPS: 500+
  2. 出块间隔:3s
  3. 共识机制: HPoS
  4. 最大验证节点数: 21
  5. 链上原生代币:HT
  6. 交易消耗: 手续费
  7. 出块节点更新时间:200区块
  8. 最小质押:32HT
  9. 赎回质押:86400区块

链接口和合约兼容

目前与ETH目前重叠部分基本一致

genesis

https://docs.hecochain.com/#/genesis

基于ETH的链修改调研

调研背景

目前有个项目计划基于ETH做链修改,完成类似DPOS版本的ETH,
主要是为了整合现有的ETH生态,以及一些商业需求。
也为后面EOS商业链中间层组件(IBC Relayer)做储备。

现有三方项目

https://github.com/HuobiGroup/huobi-eco-chain
https://github.com/meitu/go-ethereum
https://github.com/mingjingc/dpos-go-ethereum
https://github.com/TTCECO/gttc
https://github.com/linapex/ethereum-dpos-chinese

参考文档

https://zhuanlan.zhihu.com/p/38013479
https://www.jianshu.com/p/d99c0a5afbe8

WSL中设置DNS

由于公司gitlab搬到了vpn内,虽然Windows运行了Vpn软件,并在对应的VPN网卡上设置了域DNS,但是WSL走的子系统单独的DNS,所以虽然能ping通gitlab所在服务器IP,但是无法解析gitlab对应的域名。

设置WSL子系统DNS

1. 启动WSL,进入目录,创建wsl.conf
bash
cd ~/../../etc
sudo vim wsl.conf
sudo touch wsl.conf
2. 将这些行添加到wsl.conf中
[network]
generateResolvConf=false
3. 退出WSL,关闭WSL
exit
wsl --shutdown

此时,由于有了wsl.conf,run/resolvconf应该不再存在,并且将不再被创建

4. 删除现有的符号链接文件
cd ~/../../etc
sudo rm resolv.conf
5. 创建一个新的resolv.conf
sudo vim resolv.conf
sudo touch resolv.conf
将自己的DNS,添加到resolv.conf
nameserver 8.8.8.8 // 用您喜欢的功能名称服务器替换8.8.8.8。
重启WSL
exit
wsl --shutdown
再次启动WSL
bash

此时WSL解析内网域名就OK了

参考

https://github.com/microsoft/WSL/issues/5256#issuecomment-666545999

eos 链改 2.0.x 升级2.1.x的修改点

  1. eosio::name 声明变量的N() 取消了,统一用 ""_n
  2. fc::optional替换成 std::optional
  3. t->packed_trx()->get_signed_transaction() 改成v0 获取,修改为
    t->packed_trx()->to_packed_transaction_v0()->get_signed_transaction()
  4. mongo_db_plugin 相关被删除,包括mongo异常信息类型
  5. bs->block->id(); 使用V0
    bs->block->to_signed_block_v0()->id();

持续总结

dfuse-eosio 常用GraphQL API接口整理

测试例子

https://github.com/dfuse-io/docs/tree/master/quickstarts

@ dfuse/client使用例子

global.fetch = require('node-fetch');
global.WebSocket = require('ws');

// CODE:BEGIN:quickstarts_javascript_node_eos_section1
const { createDfuseClient } = require('@dfuse/client');

const client = createDfuseClient({
  network: '39.106.103.152:8080',
  authentication: false,
  secure: false,
});
// CODE:END:quickstarts_javascript_node_eos_section1
// CODE:BEGIN:quickstarts_javascript_node_eos_section2
// You must use a `$cursor` variable so stream starts back at last marked cursor on reconnect!
const operation = `subscription($cursor: String!) {
  searchTransactionsForward(query:"receiver:eosio.token action:transfer -data.quantity:'0.0001 EOS'", cursor: $cursor) {
    undo cursor
    trace { id matchingActions { json } }
  }
}`;
// CODE:END:quickstarts_javascript_node_eos_section2
// CODE:BEGIN:quickstarts_javascript_node_eos_section3
async function main() {
  const stream = await client.graphql(operation, message => {
    if (message.type === 'data') {
      const {
        undo,
        cursor,
        trace: { id, matchingActions }
      } = message.data.searchTransactionsForward;
      matchingActions.forEach(({ json: { from, to, quantity } }) => {
        console.log(
          `Transfer ${from} -> ${to} [${quantity}]${undo ? ' REVERTED' : ''}`
        );
      });

      // Mark stream at cursor location, on re-connect, we will start back at cursor
      stream.mark({ cursor });
    }

    if (message.type === 'error') {
      console.log('An error occurred', message.errors, message.terminal);
    }

    if (message.type === 'complete') {
      console.log('Completed');
    }
  });

  // Waits until the stream completes, or forever
  await stream.join();
  await client.release();
}
// CODE:END:quickstarts_javascript_node_eos_section3
// CODE:BEGIN:quickstarts_javascript_node_eos_section4
main().catch(error => console.log('Unexpected error', error));
// CODE:END:quickstarts_javascript_node_eos_section4

接口文档

https://docs.dfuse.io/eosio/public-apis/reference/graphql-api/

常用接口整理

稍后补充

GraphQL 与 REST 相比的优势和短板

https://zhuanlan.zhihu.com/p/95521039