USDT test environment set up under Ubuntu

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/C_jian/article/details/85337467

Author: Chen Jinjian
blog address: https://jian1098.github.io
CSDN blog: https://blog.csdn.net/c_jian
Contact: [email protected]

About USDT

TEDA currency (USDT) is introduced Tether based stable value of money dollar (USD) token Tether USD (called USDT under), 1USDT = US $ 1, the user can always use USDT and USD 1: 1 exchange. Tether company strictly abide by the 1: 1 of the reserve to ensure that every USDT issued a token, their bank account will have a $ 1 funding. Users can query Tether funds platform, to ensure transparency.

Omni Layer is a communication protocol that uses intelligent bit block chain contract credits, and decentralized peer user currency exchange function. Omni Core bit credits its code base is fast, portable Omni layer based on. This implementation does not require external dependencies unrelated Bitcoin Core, and as with other credit bits node, which itself is bitcoin network. It currently supports wallet mode, and can be seamlessly used on three platforms: Windows, Linux and Mac OS. Omni Layer expansion interface disclosed by JSON-RPC.

Tether wallet is a web-based bitcoin block, in this network to build a consensus top network called Omni Layer, the main idea is bitcoin block were stained writing data needs to be stored.

Omnicore installation program

jian@ubuntu:/root# wget https://github.com/OmniLayer/omnicore/releases/download/v0.3.1/omnicore-0.3.1-x86_64-linux-gnu.tar.gz
jian@ubuntu:/root# tar -zvxf omnicore-0.3.1-x86_64-linux-gnu.tar.gz 
jian@ubuntu:/root# sudo install -m 0755 -o root -g root -t /usr/local/bin ./omnicore-0.3.1/bin/*

Configuration parameters bitcoin

jian@ubuntu:~$ mkdir .bitcoin	#创建主目录,如果目录已经存在请跳过
jian@ubuntu:~$ mkdir omnidata	#创建区块数据目录
jian@ubuntu:~$ cd .bitcoin/
jian@ubuntu:~/.bitcoin$ vi bitcoin.conf

The following information is all copy, and modify rpcuser (RPC user name), rpcpassword (RPC user password), rpcallowip (allows access to ip address) and save

# Generated by https://jlopp.github.io/bitcoin-core-config-generator/

# This config should be placed in following path:
# ~/.bitcoin/bitcoin.conf

# [rpc]
# Accept command line and JSON-RPC commands.
server=1

# Username for JSON-RPC connections
rpcuser=omnicorerpc

# Password for JSON-RPC connections
rpcpassword=omnicorerpc

# Listen for JSON-RPC connections on this port
rpcport=18332

# Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), 
# a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option 
# can be specified multiple times.cd /usr
rpcallowip=192.168.1.174
rpcallowip=192.168.1.179

# Run this node on the litecoin Test Network.
testnet=1

Start omnicore program

Set -confand -datadirmodify the path to your path

jian@ubuntu:~/.omni$ omnicored -conf=/home/jian/.bitcoin/bitcoin.conf -datadir=/home/jian/omnidata -txindex=1 -daemon
2018-11-22 10:46:09 Loading trades database: OK
2018-11-22 10:46:09 Loading send-to-owners database: OK
2018-11-22 10:46:09 Loading tx meta-info database: OK
2018-11-22 10:46:09 Loading smart property database: OK
2018-11-22 10:46:09 Loading master transactions database: OK
2018-11-22 10:46:09 Loading fee cache database: OK
2018-11-22 10:46:09 Loading fee history database: OK
2018-11-22 10:46:09 Loading persistent state: NONE (no usable previous state found)
2018-11-22 10:46:09 Omni Core initialization completed

Initialized two minutes after the start to see if the success, or else not output any information, you need to enter a password on the configuration step, the user name omnirpc instead configured user name you bitcoin.conf in:

jian@ubuntu:~$ curl --user omnicorerpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:18332

Can return the following information indicates a successful start

{"result":{"version":130200,"subversion":"/Satoshi:0.13.2/","protocolversion":70015,"localservices":"000000000000000d","localrelay":true,"timeoffset":0,"connections":2,"networks":[{"name":"ipv4","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"ipv6","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"onion","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false}],"relayfee":0.00001000,"localaddresses":[],"warnings":""},"error":null,"id":"curltest"}

Stop omnicore program

jian@ubuntu:~/.omni$ omnicore-cli -conf=/home/jian/.bitcoin/bitcoin.conf stop

Check the block synchronization information

Check the synchronization log (refresh):

jian@ubuntu:~$ cd ~/omnidata/testnet3/
jian@ubuntu:~/omnidata/testnet3$ tail -f debug.log 
2018-11-21T02:40:28Z net thread start
2018-11-21T02:40:31Z New outbound peer connected: version: 70015, blocks=1444366, peer=1
2018-11-21T02:40:31Z New outbound peer connected: version: 70015, blocks=1444366, peer=0
2018-11-21T02:40:32Z 108 addresses found from DNS seeds
2018-11-21T02:40:32Z dnsseed thread exit
2018-11-21T02:40:36Z New outbound peer connected: version: 70015, blocks=1444366, peer=2
2018-11-21T02:40:37Z New outbound peer connected: version: 70015, blocks=1444366, peer=5
2018-11-21T02:40:37Z New outbound peer connected: version: 70015, blocks=1444366, peer=3
2018-11-21T02:40:41Z New outbound peer connected: version: 70015, blocks=1444366, peer=4
2018-11-21T02:40:48Z New outbound peer connected: version: 70015, blocks=1414448, peer=6
.......

The number of queries to the current synchronization blocks:

jian@ubuntu:~/omnidata/testnet3$ curl --user omnicorerpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/

Since the BTC usdt is based on all test network can query block on the total credits bit test chain: https://www.blocktrail.com/tBTC

Note that only the block sync to the latest balance can be found in purse, to finish the synchronous block, it requires more than 70G hard disk space.

Create a wallet address

jian@ubuntu:~$ curl --user omnirpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": ["test"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/

{"result":"n1Axxy3WGwFci1GJffwdY55dRem92GKXAm","error":null,"id":"curltest"}

The return result "n1Axxy3WGwFci1GJffwdY55dRem92GKXAm" is the newly created USDT wallet, purse beginning m represents an address test chains, purse address on bus 1 at the beginning of the chain is generally

Check balances

Bitcoin balance inquiry

jian@ubuntu:~$ curl --user omnicorerpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/

USDT balance inquiries, please address into your wallet

jian@ubuntu:~$ omnicore-cli omni_getbalance "n1Axxy3WGwFci1GJffwdY55dRem92GKXAm" 1

or

jian@ubuntu:~$ curl --user omnicorerpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "omni_getbalance", "params": ["n1Axxy3WGwFci1GJffwdY55dRem92GKXAm", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/

Obtaining the test coin

Can be obtained in the following two test sites in a small number of Bitcoins, used to make USDT transaction fees testing is sufficient, then the block must be synchronized to the latest, otherwise not obtain Balance:

After the credits acquired bits with the following command to the moneyqMan7uh8FqdCA2BV5yZ8qVrc9ikLPtransmission bit USDT one o'clock credits can be tested, each can be obtained 1BTC USDT 100, a transmission USDT10 obtained here 0.1

jian@ubuntu:~$omnicore-cli -testnet sendtoaddress "moneyqMan7uh8FqdCA2BV5yZ8qVrc9ikLP" 0.1

You can find the bitcoin block chain browser btc balance: https://live.blockcypher.com/btc-testnet/address/2MtW8kA68TMrBLZb373WttjHbxfuRNdvHh7/ , but usdt test network can only use the command line to check in your local area finding the block chain browser.

Send transaction

Parameters are from, to, token id, number of transactions, the payment address btc fee

jian@ubuntu:~$ omnicore-cli "omni_funded_send" "n1Axxy3WGwFci1GJffwdY55dRem92GKXAm" "n4VTWrjPV1QaLmM1x8ZtyLiJoFk3KaCAsi" 1 "1" "n1Axxy3WGwFci1GJffwdY55dRem92GKXAm"

JSON-RPC

You can view: https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md, the need butt programming language, then you can use the api functions and parameters assembled into json data, e.g. balance inquiry herein json is {"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": [] }then submitted these json string as a parameter to the post ip and port node to return the corresponding json results.

Guess you like

Origin blog.csdn.net/C_jian/article/details/85337467