• Z
    zkxhappy

    Note: The best development experience is under the MacOS system
    

    1. Download and install robin integrated development framework

    sudo npm install -g robin-framework
    

    Type robin or robin -h or robin --help,and there help information outing,it means robin framework has been installed successfully;
    image

    If you are prompted that the version of robin is too old,please install robin again:

    2. Initialize a contract project and install dependencies using the robin command line

    2.1. First create an empty directory and cd to the new directory to execute:

    robin init
    

    or

    robin init --name MyContract
    

    2.2. Then install dependencies via npm:

    npm install
    

    2.3. Finally, open the contract project the IDE WebStorm or VsCode

    3. Download and install the longclaw local desktop chain environment

    3.1. Longclaw depends on the docker environment, please install docker first, if it is installed, please skip this step;

    Download and install from docker center: https://docs.docker.com/docker-for-mac/install/

    3.2. If you already have a docker environment, please add docker's China warehouse image address.

    For users using macOS, click the Docker for mac app icon -> Perferences... -> Daemon -> Registry mirrors in the taskbar. Fill in the accelerator address https://registry.docker-cn.com in the list. After the modification is complete, click the Apply & Restart button and Docker will restart and apply the configured mirror address.

    image

    3.3. Download the longclaw installation file from the developer portal

    image

    3.4. Install and start longclaw, this process takes about two minutes to build a local consensus network environment and initialize data

    image

    4. Develop a contract with reference to developer documentation and contract templates

    4.1. Development documentation reference developer portal

    4.2. Development Support Forum

    image

    5. Use robin for syntax and security checks and bug fixes

    > robin lint
    

    robin lint The command will automatically check for syntax errors and try to fix it.。

    image

    6. Compile contract for webassembly target format file

    If the test cases are passed, the next step is to compile and run the command:

    > robin build
    

    robin build will generate *.abi, *.wast, *wasm three target files。

    7. Deploy contract target files to longclaw(local ultrain environment)

    > robin deploy
    

    Before executing robin deploy, you need to modify or confirm the configuration information related to chain interaction, such as configuration items: httpEndpoint, logger, broadcast, sign, chainId, keyProvider etc.

    Note: httpEndpoint and httpEndpoint_history are the ultrain realtime api service node and history api service node, If you have a longclaw running, you need not to change them. The chainId you can get using u3, like

        const u3 = createU3();
        await u3.getChainInfo((err, info) => {
           console.log(info);
        });
    

    If the deployment is successful, the corresponding transaction information will be displayed in longclaw, and after 10 seconds, the block confirmation message will be generated.

    8. Write test cases with tools such as u3.js and u3-utils

    Test cases can be written with reference to token.spec.js or index.test.js in u3.js. At the same time, it relies on tools such as u3-utils. Run test cases to use commands:

    > robin test 
    

    9. Deploy the contract to the test network and the main network separately for contract accuracy verification

    posted in Longclaw read more
  • Z
    zkxhappy

    注意:最佳开发体验是在MacOS系统下。
    

    1. 下载并安装robin集成开发测试框架

    sudo npm install -g robin-framework
    

    如果输入robinrobin -hrobin --help,有帮助信息输出,则说明robin框架安装成功;
    yarn global add robin-framework

    如果提示robin的版本过于旧,请重新安装robin:

    2. 使用robin命令行初始化一个合约项目并安装依赖

    2.1. 首先创建一个空的目录,并cd到新目录下执行:

    robin init
    

    或者

    robin init --name MyContract
    

    2.2. 然后通过npm安装依赖:

    npm install
    

    2.3. 最后,使用Javascript开发IDE WebStorm或VsCode,打开合约项目。

    3. 下载并安装longclaw本地超脑链环境

    3.1. longclaw依赖docker环境,请先安装docker,如果已安装,请跳过这一步;

    从 docker center下载并安装: docker: https://docs.docker.com/docker-for-mac/install/

    3.2. 如果已有docker环境,请添加docker的中国仓库镜像地址.

    对于使用 macOS 的用户,在任务栏点击 Docker for mac 应用图标 -> Perferences... -> Daemon -> Registry mirrors。在列表中填写加速器地址 https://registry.docker-cn.com。修改完成之后,点击 Apply & Restart 按钮,Docker 就会重启并应用配置的镜像地址了。
    配置镜像

    3.3. 从 开发者门户网 下载longclaw安装文件

    下载longclaw安装文件

    3.4. 安装并启动longclaw,此过程需要等待大约两分钟,用来构建本地共识网络环境及初始化数据

    安装并启动longclaw,

    4. 参考开发者文档及合约模板开发一个合约

    4.1. 开发文档参考

    4.2. 开发支持论坛

    开发文档参考

    5. 使用robin进行语法及安全性检查并进行错误修复

    > robin lint
    

    robin lint命令会自动检查语法错误并尝试修复。

     robin lint

    6. 编译合约为webassembly目标格式文件

    如果测试用例都通过,接下来就是编译,运行命令:

    > robin build
    

    robin build会生成*.abi, *.wast, *wasm三个目标文件。

    7. 部署合约目标文件至longclaw本地超脑链环境

    > robin deploy
    

    执行robin deploy前需要修改或确认链交互相关的配置信息,比如配置项:httpEndpointloggerbroadcastsignchainId, keyProvider等。如果部署成功,在longclaw中会显示对应的交易信息,而10秒之后,出产生块确认信息。

    注意: httpEndpoint and httpEndpoint_history 分别是超脑链实时数据接口节点与历史数据接口节点,如果你已经启动longclaw,那么你不必修改它们. chainId 你可以像下面这样获得

        const u3 = createU3();
        await u3.getChainInfo((err, info) => {
           console.log(info);
        });
    

    8. 借助u3.js、u3-utils等工具类编写测试用例

    测试用例的编写可以参考token.spec.js,或者u3.js中的index.test.js。同时借助于u3-utils等工具类。运行测试用例可以使用命令:

    > robin test 
    

    9. 将合约分别部署至测试网络与主网络并进行合约准确性验证

    posted in Longclaw read more
  • Z
    zkxhappy

    概述

    Longclaw是一个用于ULTRAIN开发的个人链环境,可用于部署合约、开发应用程序和运行测试。

    Longclaw是一个桌面应用程序。目前已经兼容Mac, Windows, Linux系统。

    Longclaw目前可以做到:

    • 自动模拟8个测试帐户。

    • 实时日志分析和事务跟踪。

    • 自动化集成本地docker环境。

    快速启动

    1. 首先在机器上安装docker。从docker官方网站下载 docker进行安装:

    2. 点击运行mac应用系统中的docker应用,通过taskbar -> Perferences... -> Daemon -> Registry 添加镜像地址:https://registry.docker-cn.com,添加修改完成后,单击Apply&Restart按钮,Docker将重新启动并应用配置的镜像地址。

    3. 从开发者门户下载Longclaw安装文件并将其安装到您的电脑上,只需要等待几分钟,您将会见到优雅的操作界面

    posted in Longclaw read more