0%

chainmaker

配置长安链

长安链部署和配置

安装

安装kubectl

本地安装长安链2.3.1

  • 官方文档:https://docs.chainmaker.org.cn/v2.3.1/html/

  • 安装go

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    wget https://golang.google.cn/dl/go1.18.10.linux-amd64.tar.gz

    sudo rm -rf /usr/local/go
    sudo tar -C /usr/local -xzf go1.16.13.linux-amd64.tar.gz

    vi /etc/profile
    # 加入配置
    export PATH=$PATH:/usr/local/go/bin
    # 配置生效
    source /etc/profile

    # 换源
    go env GO11MODULE=on
    go env -w GOPROXY=https://goproxy.cn
  • 安装7.3版本以上的gcc

  • 安装7zip

    • ```bash
      sudo apt-get install p7zip-full p7zip-rar
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45

      - 安装docker,参考https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
      - 下载gitlab的pre仓库
      - https://gitlab.distribute-compute.cn/chenzhu/pre
      - 安装完毕后测试智能合约是否能部署

      ## 部署到云

      - 修改改k8sconfg/4.yml和Makefile里面的版本/命名空间
      - build docker
      - `make docker-solo`

      - 提交docker,这部分需要
      - `docker login -u xxx -p xxx xxx.myhuaweicloud.com`

      - `make push`

      - 进入docker执行命令
      - `kubectl exec docker-name -it /bin/bash -n mj`

      - 停止运行
      - `make configFdown`
      - 在dockerfile中设置需要打包为docker的文件

      # SealEVM

      长安链EVM有两个开源仓库,不尽相同

      - github:https://github.com/SealSC/SealEVM
      - gitlab:https://git.chainmaker.org.cn/chainmaker/vm-evm

      gitlab的报错且没有文档

      ```bash
      # chainmaker.org/chainmaker/vm-evm/v2/evm-go/storage
      evm-go/storage/contractStorage.go:92:36: too many arguments in call to c.Ctx.CallContract
      have (*common.Contract, *common.Contract, string, nil, map[string][]byte, number, common.TxType)
      want (*common.Contract, string, []byte, map[string][]byte, uint64, common.TxType)
      evm-go/storage/contractStorage.go:206:13: undefined: "chainmaker.org/chainmaker/utils/v2".NameToAddrInt
      evm-go/storage/contractStorage.go:351:36: too many arguments in call to c.Ctx.CallContract
      have (*common.Contract, *common.Contract, string, []byte, map[string][]byte, uint64, common.TxType)
      want (*common.Contract, string, []byte, map[string][]byte, uint64, common.TxType)
      evm-go/storage/contractStorage.go:359:36: too many arguments in call to c.Ctx.CallContract
      have (*common.Contract, *common.Contract, string, []byte, map[string][]byte, uint64, common.TxType)
      want (*common.Contract, string, []byte, map[string][]byte, uint64, common.TxType)

github的SealEVM能运行

1
2
3
4
go mod download 
cd example
./example
go get: added chainmaker.org/chainmaker/common/v2
  • 不支持PUSH0,因此虚拟机不支持shanghai分叉,支持使用solc 0.8.23 设定evm version为paris

  • gas计价混乱,只出现了0x3和SSTORE的两个值

    • STOP计价为0x3
    • image-20240204144319468

vm-evm

单测可以通过

image-20240204143844766