博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IOTA私有链简单搭建
阅读量:5222 次
发布时间:2019-06-14

本文共 2834 字,大约阅读时间需要 9 分钟。

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 electronnpm install -g bowernpm 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/walletcd walletgit clone https://github.com/iotaledger/iricd iri       //放进 iri.jar 更改名字为//更改testnet.json 覆盖 .jsonnpm 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)  }});

转载于:https://www.cnblogs.com/joeat1/p/11008167.html

你可能感兴趣的文章
com.fasterxml.jackson.databind.JsonMappingException
查看>>
【UVa 540】Team Queue
查看>>
排序算法(二)
查看>>
Python内置函数(36)——iter
查看>>
HTML标签_1
查看>>
jsp组成元素
查看>>
排序算法(转)
查看>>
windows自带的可生成各种数据库连接字符串工具打开方法
查看>>
Python命名规范
查看>>
滚动条
查看>>
程序员的自我修养九Windows下的动态链接
查看>>
Codeforces Round #361 (Div. 2)
查看>>
细说WebSocket - Node篇
查看>>
Extjs控件之 grid打印功能
查看>>
枚举类型(不常用)递归
查看>>
minggw 安装
查看>>
Jquery操作cookie,实现简单的记住用户名的操作
查看>>
[BZOJ1196][HNOI2006]公路修建问题 二分答案+最小生成树
查看>>
【原创】大数据基础之Zookeeper(4)应用场景
查看>>
静态变量数组实现LRU算法
查看>>