form1.cn
Make a little progress every day

ubuntu中搭建USDT钱包同步节点说明

22th of November 2018 Linux Command 10053

usdt是基于omni发的token,omni是比特币的侧链,所有omni实际上跟BTC是同一条链,可以吧omni上面的币理解为BTC的token,usdt就是众多token种的一个。那么,我们要测试usdt转账,就需要BTC资产,因为token转账是消耗BTC的。


USDT的转账实际上是代号为31的OmniCore令牌转账。Omnicore提供了多套api实现令牌转账功能,v0.3.1版本之前,

可以使用omni_send和omni_sendall。这种方式必须保证发送地址上不仅需要有令牌余额,还需要有一定数量的比特币用于支付手续费。

从v0.3.1版本开始,Omnicore提供了两个新的api omni_funded_send和omni_funded_sendall,这种方式的好处在于可以指定手续费的支付方,

所有的令牌交易都可以使用统一的地址进行支付比特币手续费,而不需要发送者自身拥有比特币。

但这里并未设定手续费的具体数量,系统将根据在配置文件中的关于手续费的配置文件进行动态设定。


官网:

http://www.omnilayer.org/


同步节点详细:

https://www.jianshu.com/p/bd573e2df746


参考:

Tether USDT 节点钱包的安装与使用:https://blog.csdn.net/guokaikevin/article/details/79440230  

usdt钱包对接,如何rpc调用usdt:https://ask.csdn.net/questions/682665

运行程序:https://github.com/OmniLayer/omnicore/releases

usdtRPC:https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md

同步2:https://blog.csdn.net/ffzhihua/article/details/80706661


USDT(omniCore)测试环境搭建:https://blog.csdn.net/m0_37754981/article/details/82498151?utm_source=blogxgwz0

编译时出现的问题解决:

https://blog.csdn.net/rion_chen/article/details/51104727    

https://blog.csdn.net/abcdad/article/details/80388371


./omnicored -testnet 连接test3测试网络,会同步test3网络的区块数据(约20G)

./omnicored -regtest 单机运行,不需要连接其他网络,区块数据在本地运行。

./omnicored连接比特币主网网络,会同步真实区块数据(约180G)

./omnicored -testnet -conf=/home/usdt/tsdata/ --datadir=/home/usdt/tsdata/


./omnicored -testnet -datadir=/datafile/webomnicore/data/


启动之后,可以在%datadir%/omnicore.log下面查看日志。


1,从阿里云下载文件 或 从usdt官网下载  git clone https://github.com/OmniLayer/omnicore.git

2,安装依赖包

依赖包:https://www.jianshu.com/p/bd573e2df746

3,编译源码,makeinstall之后可以运行

编译时出现的问题解决:https://blog.csdn.net/rion_chen/article/details/51104727    https://blog.csdn.net/abcdad/article/details/80388371
运行完上边的这个命令之后,你就可以知道你的系统中都少什么库,下边就是安装缺少的库的方法
If you encounter configure: error: libdb_cxx headers missing
提示少libdb_cxx头,这个时候运行下边令命安装db的C++开发库
 sudo apt-get install libdb5.1++-dev  ubuntu16.04 需要 5.3的 用tab查一下
If you encounter configure: error: Found Berkeley DB other than 4.8, required for portable wallets (–with-incompatible-bdb to ignore), run the following command instead. You can always send your bitcoins to another wallet.
如果提示安装的DB不是4.8的版本,则使用下边的命令跳过DB的版本检测
./configure --with-incompatible-bdb

4,写配置文件,默认在/root/.bitcoin/bitcoin.conf

5,运行程序 ./omnicored -datadir=/datafile/webomnicore/data/ -conf=可以指配置文件路径   #默认情况下:~/.bitcoin/

6,运行后需要等待1个小时左右,然后开始同步区块到 /datafile/webomnicore/data/ 日志要这个下面看 omnicore.log


7,可查看./omnicore-cli getinfo   ./omnicore-cli omni_getinfo   查看底层bitcoin信息和上层omni信息



apt-get update仅更新包列表。您需要apt-get dist-upgrade升级实际的包。人们经常将两者结合起来sudo apt-get update && sudo apt-get dist-upgrade


编辑一个.sh文件

/datafile/webomnicore/src/omnicored -datadir=/datafile/webomnicore/data/ -conf=/datafile/webomnicore/bitcoin.conf


查看底层bitcoin信息和上层omni信息

./omnicore-cli -conf=/datafile/webomnicore/bitcoin.conf getinfo

./omnicore-cli -conf=/datafile/webomnicore/bitcoin.conf omni_getinfo



以下配置文件

server=1  

txindex=1 

rpcuser=root

rpcpassword=123456

rpcallowip=127.0.0.1    rpcallowip=0.0.0.0/0

rpcport=8332

paytxfee=0.00006

minrelaytxfee=0.00006

datacarriersize=80

logtimestamps=1

omnidebug=tally  

omnidebug=packets

omnidebug=pending

server=1代表开启RPC访问


参数说明:

txindex=1代表事务初始索引

recuser和rpcpassword 代表rpc访问的身份验证,

rpcallowip 和rpcport代表允许访问钱包的ip地址及端口。

paytxfee和minrelattxfee控制bitcoin交易的手续费,Omni交易也属于一种特殊的比特币交易,打包与广播也需要向矿工支付费用。手续费设置过低会造成交易确认慢甚至交易失败,手续费过高会造成资源的浪费(以2018.09.13的BTC价格换算,每多消耗0.0001btc需要浪费4rmb),所以设置动态配置交易手续费十分必要。预估比特币交易手续费可以使用下面的网址bitcoinfees.earn,buybitcoinworldwide。假设当前预估的比特币交易费率为0.0000001BTC/Byte,那么需要设置paytxfee=0.00001BTC/kByte。