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)
      }
    });
    
  • 相关阅读:
    MySQL体系结构
    详解MySQL的用户密码过期/锁定解锁功能
    MySQL5.7 密码安全策略
    Python终端如何输出彩色字体
    flashback
    PXC 部署前置检查
    CentOS7 安装docker
    CentOS7 安装ifconfig
    CentOS 7 网络配置
    VMware虚拟机克隆Linux系统引起的网卡问题
  • 原文地址:https://www.cnblogs.com/joeat1/p/11008167.html
Copyright © 2011-2022 走看看