zoukankan      html  css  js  c++  java
  • IOTA私有链简单搭建

    IOTA

    参考:https://github.com/iotaledger/wallet
    参考:https://github.com/iotaledger/iota.js
    参考:https://github.com/schierlm/private-iota-testnet
    参考:https://docs.iota.org/

    基础环境

    npm install -g electron
    npm install -g bower
    npm install ajv@^5.0.0
    

    构建自己的Snapshot.txt

    进入private-iota-tetstnet-master文件目录
    mvn package
    分配2,779,530,283,277,761个可用的iota到指定的地址上
    java -jar target/iota-testnet-tools-0.1-SNAPSHOT-jar-with-dependencies.jar SnapshotBuilder
    将Snapshot.txt文件与iri-1.4.2.4.jar放在一个文件夹后开启服务
    java -jar iri-1.4.2.4.jar --testnet --testnet-no-coo-validation --snapshot=Snapshot.txt -p 11219
    创建里程碑
    java -jar target/iota-testnet-tools-0.1-SNAPSHOT-jar-with-dependencies.jar Coordinator localhost 11219

    搭建钱包

    git clone https://github.com/iotaledger/wallet
    cd wallet
    git clone https://github.com/iotaledger/iri
    cd iri       //放进 iri.jar 更改名字为
    //更改testnet.json 覆盖 .json
    npm install   //会比较久
    npm start
    

    安装库

    npm install iota.lib.js

    可能遇到的问题

    1. Could not resolve dependencies for project com.iota:iri:jar:1.7.0-DEV-${git.commit.id.abbrev}: Could not find artifact com.sun:tools:jar:1.8 at specified path /usr/lib/jvm/java-11-openjdk-amd64/../lib/tools.jar -> [Help 1]
    • ubuntu默认安装JAVA的openjdk版本没有tools.jar的问题
      sudo apt-get install openjdk-8-jdk
    1. /home/xxx/wallet/node_modules/electron/dist/electron: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
    • ubuntu默认没有该库
      +sudo apt -y install libgconf2-4
    1. Gtk-Message: 04:25:25.218: Failed to load module "canberra-gtk-module"

      • sudo apt-get install libcanberra-gtk-module
    2. context mismatch in svga_sampler_view_destroy

      • echo "export SVGA_VGPU10=0" >> ~/.bashrc

    示例脚本

    const IOTA = require('iota.lib.js')
    const iota = new IOTA({
        host: 'http://127.0.0.1',
        port: 11219
    })
    const seed = 'APMXGGWAIIQFKV9CYSKKDYUOFZC9FYMGQAELAUJBDW9SMXNNRIYPLOMQYT9SMNLUVFWSHJFDYMGBSMBAL';
    const Depth = 3 /* constant defined by IOTA - how deep to look for the tips in the Tangle*/
    const MinWeightMagnitude = 13 /* constant defined by IOTA Testnet - the difficulty of PoW*/
    const transfers = [
        {
            // where are we sending the transaction to?
            address: 'OHCEFHHAKKNSINQTNK9DPEERVIPOBPKKJWNIFLUEMTJGFZUGASHRMZUGSOGQEJRVFSMFFH9PGBBILNHPZSOILTDFLW',
    
            // how many tokens are we transferring?
            value: 100,
            
            // do we want to comment on this transaction?
            message: iota.utils.toTrytes('Hello World!')        
        }
    ]
    iota.api.getNodeInfo((error, nodeInfo) => {
        if (error) {
            console.error('getNodeInfo error', error)
        } else {
            console.log('getNodeInfo result', nodeInfo)
        }
    });
    iota.api.sendTransfer(seed, Depth, MinWeightMagnitude, transfers, (error, transactions) => {
      if (error) {
         console.error('sendTransfer error', error)
      } else {
         console.log('transactions sent!', transactions)
      }
    });
    
  • 相关阅读:
    eclipse中如何复制用点分隔的全类名
    win7 64下暗黑世界V1.1 服务器端及客户端的安装及运行 成功
    Firefly Http通信简单介绍
    win7 不能启动 memcached 总是反回failde to start service
    win7 安装 memcached
    memcached完全剖析–1. memcached的基础
    【Firefly API 新版文档】Package dbentrust
    《暗黑世界GM管理后台系统》部署+功能说明
    [官方教程] 暗黑世界 客户端 配置文档
    MAC下《暗黑世界》客户端版本编译说明!!
  • 原文地址:https://www.cnblogs.com/joeat1/p/11008167.html
Copyright © 2011-2022 走看看