# usdt交互
## 官方邮件指引
```
Hello Laily
We ask that all integrators first please take a look at and fill in the following questionnaire: https://goo.gl/forms/ipTVe1xzv4UgXVSt1
For the technical side part of the integration we have the following information:
Tether Tokens exist on two different blockchain and should be treated equally and interchangeably.
For our Bitcoin blockchain based token you will need to use the Omnicore client.
Tether is an asset created and issued on the Omni protocol (Property ID 31), so it's fully compatible to use with Omni Core:https://bintray.com/omni/OmniBinaries/OmniCore/view
Omni Core is a Bitcoin core clone that supports Bitcoin as well as all the Omni protocol currencies, so if you are building an exchange and integrating Bitcoin/Bitcoin core, the integration path/requirements for Omni Core would be almost identical.
Being built on top of Bitcoin core, Omni Core inherits all the rpc capabilities of Bitcoin core and adds a few additional rpc calls of its own to allow interacting with the Omni Protocol. Please see the Omni Core integration guide here for the technical details needed to incorporate the client into your platform: https://github.com/OmniLayer/omnicore/wiki/Platform-Integration-of-Omni-Core
Remember Tether USD₮ is Omni Protocol Asset Property ID 31, you will need this for the integration.
For our Ethereum blockchain based token we use standard ERC20 tokens.
Our USD₮ contract address is https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7
Our EUR₮ contract address is https://etherscan.io/token/0xabdf147870235fcfc34153828c769a70b3fae01f
The integration path is the same as any ERC20 compatible token.
For all integrations it is recommend that the Tether Tokens be treated as transport tokens for their Fiat counterparts.
i.e
If your platform already supports USD/EUR currency pairs we would request that the Tether tokens be exchanged 1:1 with their Fiat counterparts automatically against a users balance during Deposits and Withdrawals.
If you do not currently have a Fiat market then listing markets against USD₮ / EUR₮ is acceptable.
The aim is to try and avoid the confusion of users having to understand a USD/USD₮ or EUR/EUR₮ market
If you have any questions let us know and we can assist you with the integration.
```
## 调查问卷
```
Tether Integrators Questionnaire (* Required)
1.Email address *
2.What Platform/Exchange/Company do you represent *
3.What is your company website? *
4.What is your role/position in the company *
5.Are you planning to integrate / provide support for our Omni Based token, Ethereum ERC20 token, or both.
*
- Will will support only Tether on Omni
- Will will support only Tether on Ethereum
- Will will support Tether on Both protocols
6.If you only plan to support only one of the protocols (Omni or Ethereum), can you please provide more information about why you have made that choice or what is preventing you from supporting both?
7.For Tether on Omni, Are you currently or do you plan to integrate Tether with the Omni Core client according to the guide posted here: https://github.com/OmniLayer/omnicore/wiki/Platform-Integration-of-Omni-Core *
- Yes
- No
- We are not integrating Tether on Omni
8. Please provide a contact email to be used for any updates/notifications regarding Tether Integrations or its related software *
9.In the event Tether Tokens are accidentally sent to an unsupported destination on your platform, please provide the contact email for the person/group in charge of assisting with any recovery *
10.If there is any additional information you wish to provide or need clarify/expand a previous response you may do so here.
```
## Omnilayer官网
https://www.omnilayer.org/
## Omni core集成指引
https://github.com/OmniLayer/omnicore/wiki/Platform-Integration-of-Omni-Core
## config wiki
https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/configuration.md
## config注意事项
```
While most normal bitcoin core config options can be utilized there are a few critical pieces integrators will need to enable, including txindex and server options.
```
## usdt omni property creation page
https://omniexplorer.info/tx/5ed3694e8a4fa8d3ec5c75eb6789492c69e65511522b220e94ab51da2b6dd53f
## omni property list
test https://omniexplorer.info/properties/test
production https://omniexplorer.info/properties/production
## check the local node sync status
current block: "blocks": 1439803
```
usdt@iZj6c48apyeg9dvouqz3uxZ:~/bin$ omnicore-cli getinfo
{
"version": 130200,
"protocolversion": 70015,
"walletversion": 130000,
"balance": 0.12196269,
"blocks": 1439803,
"timeoffset": 0,
"connections": 8,
"proxy": "",
"difficulty": 11380991.74561113,
"testnet": true,
"keypoololdest": 1539922499,
"keypoolsize": 100,
"paytxfee": 0.00000000,
"relayfee": 0.00001000,
"errors": "Warning: unknown new rules activated (versionbit 28)"
}
```
## get test testOmni
1. Create new addresss via receive tab or with getnewaddress
1. Get Bitcoin from a faucet and send them to the address from the first step
1. Send Bitcoin via coin control in the GUI or sendtoaddress from the address generated in step one to moneyqMan7uh8FqdCA2BV5yZ8qVrc9ikLP
1. Then wait for confirmation and see that the address from the first step received TestOmni, either via the GUI or with the omni_getbalance RPC.
## check testOmni balance
转0.02 btc到moneyqMan7uh8FqdCA2BV5yZ8qVrc9ikLP,1个确认后得到2个omnitest
https://live.blockcypher.com/btc-testnet/tx/d503bda0b4ad6cd03a0a34ae32f5a110d6e1022cd954c61d2325fdfd126d2b9c/
```
usdt@iZj6c48apyeg9dvouqz3uxZ:~/bin$ omnicore-cli omni_getbalance "mx7r52d2oaNTeiMDr2zrcw2VGm1BQurC9K" 2
{
"balance": "2.00000000",
"reserved": "0.00000000",
"frozen": "0.00000000"
}
```
## omni api
https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md
```
== Blockchain ==
clearmempool
getbestblockhash
getblock "hash" ( verbose )
getblockchaininfo
getblockcount
getblockhash index
getblockheader "hash" ( verbose )
getchaintips
getdifficulty
getmempoolancestors txid (verbose)
getmempooldescendants txid (verbose)
getmempoolentry txid
getmempoolinfo
getrawmempool ( verbose )
gettxout "txid" n ( includemempool )
gettxoutproof ["txid",...] ( blockhash )
gettxoutsetinfo
verifychain ( checklevel numblocks )
verifytxoutproof "proof"
== Control ==
getinfo
help ( "command" )
stop
== Generating ==
generate numblocks ( maxtries )
generatetoaddress numblocks address (maxtries)
== Mining ==
getblocktemplate ( TemplateRequest )
getmininginfo
getnetworkhashps ( blocks height )
prioritisetransaction <txid> <priority delta> <fee delta>
submitblock "hexdata" ( "jsonparametersobject" )
== Network ==
addnode "node" "add|remove|onetry"
clearbanned
disconnectnode "node"
getaddednodeinfo dummy ( "node" )
getconnectioncount
getnettotals
getnetworkinfo
getpeerinfo
listbanned
ping
setban "ip(/netmask)" "add|remove" (bantime) (absolute)
== Omni layer (configuration) ==
omni_setautocommit flag
== Omni layer (data retrieval) ==
omni_getactivations
omni_getactivecrowdsales
omni_getactivedexsells ( address )
omni_getallbalancesforaddress "address"
omni_getallbalancesforid propertyid
omni_getbalance "address" propertyid
omni_getbalanceshash propertyid
omni_getcrowdsale propertyid ( verbose )
omni_getcurrentconsensushash
omni_getfeecache ( propertyid )
omni_getfeedistribution distributionid
omni_getfeedistributions propertyid
omni_getfeeshare ( address ecosystem )
omni_getfeetrigger ( propertyid )
omni_getgrants propertyid
omni_getinfo
omni_getmetadexhash propertyId
omni_getorderbook propertyid ( propertyid )
omni_getpayload "txid"
omni_getproperty propertyid
omni_getseedblocks startblock endblock
omni_getsto "txid" "recipientfilter"
omni_gettrade "txid"
omni_gettradehistoryforaddress "address" ( count propertyid )
omni_gettradehistoryforpair propertyid propertyid ( count )
omni_gettransaction "txid"
omni_getwalletaddressbalances ( includewatchonly )
omni_getwalletbalances ( includewatchonly )
omni_listblocktransactions index
omni_listpendingtransactions ( "address" )
omni_listproperties
omni_listtransactions ( "address" count skip startblock endblock )
== Omni layer (payload creation) ==
omni_createpayload_cancelalltrades ecosystem
omni_createpayload_canceltradesbypair propertyidforsale propertiddesired
omni_createpayload_canceltradesbyprice propertyidforsale "amountforsale" propertiddesired "amountdesired"
omni_createpayload_changeissuer propertyid
omni_createpayload_closecrowdsale propertyid
omni_createpayload_dexaccept propertyid "amount"
omni_createpayload_dexsell propertyidforsale "amountforsale" "amountdesired" paymentwindow minacceptfee action
omni_createpayload_disablefreezing propertyid
omni_createpayload_enablefreezing propertyid
omni_createpayload_freeze "toaddress" propertyid amount
omni_createpayload_grant propertyid "amount" ( "memo" )
omni_createpayload_issuancecrowdsale ecosystem type previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline earlybonus issuerpercentage
omni_createpayload_issuancefixed ecosystem type previousid "category" "subcategory" "name" "url" "data" "amount"
omni_createpayload_issuancemanaged ecosystem type previousid "category" "subcategory" "name" "url" "data"
omni_createpayload_revoke propertyid "amount" ( "memo" )
omni_createpayload_sendall ecosystem
omni_createpayload_simplesend propertyid "amount"
omni_createpayload_sto propertyid "amount" ( distributionproperty )
omni_createpayload_trade propertyidforsale "amountforsale" propertiddesired "amountdesired"
omni_createpayload_unfreeze "toaddress" propertyid amount
== Omni layer (raw transactions) ==
omni_createrawtx_change "rawtx" "prevtxs" "destination" fee ( position )
omni_createrawtx_input "rawtx" "txid" n
omni_createrawtx_multisig "rawtx" "payload" "seed" "redeemkey"
omni_createrawtx_opreturn "rawtx" "payload"
omni_createrawtx_reference "rawtx" "destination" ( amount )
omni_decodetransaction "rawtx" ( "prevtxs" height )
== Omni layer (transaction creation) ==
omni_funded_send "fromaddress" "toaddress" propertyid "amount" "feeaddress"
omni_funded_sendall "fromaddress" "toaddress" ecosystem "feeaddress"
omni_send "fromaddress" "toaddress" propertyid "amount" ( "redeemaddress" "referenceamount" )
omni_sendall "fromaddress" "toaddress" ecosystem ( "redeemaddress" "referenceamount" )
omni_sendcancelalltrades "fromaddress" ecosystem
omni_sendcanceltradesbypair "fromaddress" propertyidforsale propertiddesired
omni_sendcanceltradesbyprice "fromaddress" propertyidforsale "amountforsale" propertiddesired "amountdesired"
omni_sendchangeissuer "fromaddress" "toaddress" propertyid
omni_sendclosecrowdsale "fromaddress" propertyid
omni_senddexaccept "fromaddress" "toaddress" propertyid "amount" ( override )
omni_senddexsell "fromaddress" propertyidforsale "amountforsale" "amountdesired" paymentwindow minacceptfee action
omni_senddisablefreezing "fromaddress" propertyid
omni_sendenablefreezing "fromaddress" propertyid
omni_sendfreeze "fromaddress" "toaddress" propertyid amount
omni_sendgrant "fromaddress" "toaddress" propertyid "amount" ( "memo" )
omni_sendissuancecrowdsale "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline ( earlybonus issuerpercentage )
omni_sendissuancefixed "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data" "amount"
omni_sendissuancemanaged "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data"
omni_sendrawtx "fromaddress" "rawtransaction" ( "referenceaddress" "redeemaddress" "referenceamount" )
omni_sendrevoke "fromaddress" propertyid "amount" ( "memo" )
omni_sendsto "fromaddress" propertyid "amount" ( "redeemaddress" distributionproperty )
omni_sendtrade "fromaddress" propertyidforsale "amountforsale" propertiddesired "amountdesired"
omni_sendunfreeze "fromaddress" "toaddress" propertyid amount
== Rawtransactions ==
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime )
decoderawtransaction "hexstring"
decodescript "hex"
fundrawtransaction "hexstring" ( options )
getrawtransaction "txid" ( verbose )
sendrawtransaction "hexstring" ( allowhighfees )
signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )
== Util ==
createmultisig nrequired ["key",...]
estimatefee nblocks
estimatepriority nblocks
estimatesmartfee nblocks
estimatesmartpriority nblocks
signmessagewithprivkey "privkey" "message"
validateaddress "bitcoinaddress"
verifymessage "bitcoinaddress" "signature" "message"
== Wallet ==
abandontransaction "txid"
addmultisigaddress nrequired ["key",...] ( "account" )
addwitnessaddress "address"
backupwallet "destination"
dumpprivkey "bitcoinaddress"
dumpwallet "filename"
encryptwallet "passphrase"
getaccount "bitcoinaddress"
getaccountaddress "account"
getaddressesbyaccount "account"
getbalance ( "account" minconf includeWatchonly )
getnewaddress ( "account" )
getrawchangeaddress
getreceivedbyaccount "account" ( minconf )
getreceivedbyaddress "bitcoinaddress" ( minconf )
gettransaction "txid" ( includeWatchonly )
getunconfirmedbalance
getwalletinfo
importaddress "address" ( "label" rescan p2sh )
importprivkey "bitcoinprivkey" ( "label" rescan )
importprunedfunds
importpubkey "pubkey" ( "label" rescan )
importwallet "filename"
keypoolrefill ( newsize )
listaccounts ( minconf includeWatchonly)
listaddressgroupings
listlockunspent
listreceivedbyaccount ( minconf includeempty includeWatchonly)
listreceivedbyaddress ( minconf includeempty includeWatchonly)
listsinceblock ( "blockhash" target-confirmations includeWatchonly)
listtransactions ( "account" count from includeWatchonly)
listunspent ( minconf maxconf ["address",...] )
lockunspent unlock ([{"txid":"txid","vout":n},...])
move "fromaccount" "toaccount" amount ( minconf "comment" )
removeprunedfunds "txid"
sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf "comment" "comment-to" )
sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] )
sendtoaddress "bitcoinaddress" amount ( "comment" "comment-to" subtractfeefromamount )
setaccount "bitcoinaddress" "account"
settxfee amount
signmessage "bitcoinaddress" "message"
```
## Why do I need bitcoin to create Omni transactions?
Omni transactions are regular Bitcoin transactions, which embed data in one way or another. Like any other Bitcoin transaction, Omni transactions also need to pay fees to the miners. Furthermore, some Omni transactions have a very small output to "tag" the recipient of a transaction, which also needs to be accounted for.
The actual cost is based on the transaction fee and the minimum relay transaction fee settings, which can be configured with the `txconfirmtarget` or `paytxfee` and `minrelaytxfee` options.
## lower the tx fee
https://www.reddit.com/r/Bitcoin/comments/45zy8n/high_suggested_fees_in_bitcoin_core_increase/
## omni wallet
https://www.omniwallet.org/
## omni wallet github
https://github.com/OmniLayer/omniwallet
## listunspend
```
usdt@iZj6c48apyeg9dvouqz3uxZ:~$ omnicore-cli listunspent 0 9999999
[
{
"txid": "d503bda0b4ad6cd03a0a34ae32f5a110d6e1022cd954c61d2325fdfd126d2b9c",
"vout": 0,
"address": "mhPo6yfETX9SxzQ1HtC7aRrpE3HhNcMA98",
"scriptPubKey": "76a9141495aae7c076772932b80b8359cddd22a7c5453f88ac",
"amount": 0.12196269,
"confirmations": 150,
"spendable": true,
"solvable": true
},
{
"txid": "aeac1b69426bc3f6e3ca0be8bec369ffae6308f9e3e56184dae8b8cc868937c3",
"vout": 1,
"address": "n1RfuCXBdVniV2afuUM67Frz5NuvWEmqxR",
"account": "",
"scriptPubKey": "76a914da62c034eb7ca90dc7a8a5bbcf710e296947fecc88ac",
"amount": 0.20043000,
"confirmations": 18,
"spendable": true,
"solvable": true
},
{
"txid": "6d8207a697e5aaf9f579358483625cc0f88690904620b8e5fe112178273ed1c8",
"vout": 0,
"address": "n1RfuCXBdVniV2afuUM67Frz5NuvWEmqxR",
"account": "",
"scriptPubKey": "76a914da62c034eb7ca90dc7a8a5bbcf710e296947fecc88ac",
"amount": 0.13428332,
"confirmations": 18,
"spendable": true,
"solvable": true
}
]
```
## omni_listtransactions
List wallet transactions, optionally filtered by an address and block boundaries.
**Arguments:**
| Name | Type | Presence | Description |
|---------------------|---------|----------|----------------------------------------------------------------------------------------------|
| `txid` | string | optional | address filter (default: `"*"`) |
| `count` | number | optional | show at most n transactions (default: `10`) |
| `skip` | number | optional | skip the first n transactions (default: `0`) |
| `startblock` | number | optional | first block to begin the search (default: `0`) |
| `endblock` | number | optional | last block to include in the search (default: `999999999`) |
**Result:**
```
[ // (array of JSON objects)
{
"txid" : "hash", // (string) the hex-encoded hash of the transaction
"sendingaddress" : "address", // (string) the Bitcoin address of the sender
"referenceaddress" : "address", // (string) a Bitcoin address used as reference (if any)
"ismine" : true|false, // (boolean) whether the transaction involves an address in the wallet
"confirmations" : nnnnnnnnnn, // (number) the number of transaction confirmations
"fee" : "n.nnnnnnnn", // (string) the transaction fee in bitcoins
"blocktime" : nnnnnnnnnn, // (number) the timestamp of the block that contains the transaction
"valid" : true|false, // (boolean) whether the transaction is valid
"positioninblock" : n, // (number) the position (index) of the transaction within the block
"version" : n, // (number) the transaction version
"type_int" : n, // (number) the transaction type as number
"type" : "type", // (string) the transaction type as string
[...] // (mixed) other transaction type specific properties
},
...
]
```
## issue omni token
https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendissuancefixed
https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendissuancecrowdsale
## troubleshoot
### omni_send & omni_funded_send


```
usdt@iZj6c48apyeg9dvouqz3uxZ:~/bin$ omnicore-cli omni_send "mx7r52d2oaNTeiMDr2zrcw2VGm1BQurC9K" "n4YZv8eV8VTXW2ae2uZhnb64KdK3jS4GCx" 2 0.2
error code: -206
error message:
Error with selected inputs for the send transaction
```
## other command
omnicore-cli -conf=/root/.usdt/usdt_testnet.con omni_send "mi7mv1QX2AAnQus4xHAjxPPtMKMLfSziR9" "mjLE2qm5w5GmGffUTvjgKzg49ZUPrMfeh2" 1 0.5
###### tags: `区块链` `USDT`