<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                Omni Core是Bitcoin Core的一個分支,其Omni協議功能支持作為頂層的新功能層添加。因此,與API的交互以與Bitcoin Core相同的方式(JSON-RPC)完成,只需使用額外的RPC即可使用Omni協議功能。 ## 第三方接口 ``` curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Content-Type: application/x-www-form-urlencoded" -d "signedTransaction=0200000001f1923b0bafbf68a6ecdbfe65f7d8e0ca86c23280cb96eeaeecfa7aea038950ae000000006a47304402203cbdbd15368856db08adffb22110cadb9b343af5b3c610b9af63bd8fd792c11202203a5b1916d4cd638619a4d3614a22b1cf339d88201a934f2ed1610ac9d36714b2012103fe44259b70361912a21eb12e300df2bb9b7933381ed338989b28c6a01c8d2431ffffffff0322020000000000001976a9142047c920791ae2b8e764ff51a684134dccb67f6e88ac0000000000000000166a146f6d6e69000000000000001f0000000005f5e1001e811900000000001976a91494687e55ebc2d011f5bf7825adaaa15e8a7c383288ac00000000" "https://api.omniexplorer.info/v1/transaction/pushtx/" ``` ## 交易 最近幾天在對接USDT錢包,遇到一個問題就是根本沒辦法通過omni 錢包提供的API來實現錢包歸集,因為API提供的接口都需要發送USDT的地址有一定的BTC數量才可以發送交易,所以沒辦只能找其他方案替代,請教了其他人后才知道只能通過創建BTC的原生交易才能達到這個效果,折騰了好幾天,終于把這個流程給整理通順了,估計還有很多人會遇到這個問題,所以記錄下來為后面的人節省一些時間。 ### 1、準備兩個地址 首先兩個地址, 發送USDT(地址里面要有USDT,這里通常可能是交易所用戶的USDT錢包地址)地址和付手續費的地址(地址里面要有足夠的BTC,這里通常可能是熱錢包地址) 本次案例中 發送USDT地址為: mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4 付手續費地址為: muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe 接收USDT地址為:muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe ### 2、分別找到發送地址 和熱錢包地址的一筆UXTO 作為發送USDT交易的載體 指令:listunspent 0 999999 '["mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4"]' ```json { "txid": "7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e", "vout": 0, "address": "mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4", "scriptPubKey": "76a914486e3cf761cc47642135140da02669c04dd2451088ac", "amount": 0.00081189, "confirmations": 31103, "spendable": true, "solvable": true } ``` 指令:listunspent 0 999999 '["muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe"]' 得到UXTO: ```json { "txid": "0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d", "vout": 1, "address": "muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe", "account": "sys", "scriptPubKey": "76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac", "amount": 0.00992750, "confirmations": 4137, "spendable": true, "solvable": true } ``` ### 3、創建負載 > 指令: ```js createrawtransaction '[{"txid":"7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e","vout":0},{"txid":"0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d","vout":1,"scriptPubKey":"76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac","value": 0.00992750}]' '{}' > 得到: 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff0000000000 ### 4、創建USDT交易 指令(代幣ID,發送代幣數量):omni_createpayload_simplesend 31 2.0 得到:000000000000000100000000001e8480 ### 5、在交易上綁定代幣數據 > 指令: omni_createrawtx_opreturn 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff0000000000 000000000000000100000000001e8480 > 得到(事務hash): 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff010000000000000000166a146f6d6e69000000000000000100000000001e848000000000 ### 6、在交易上添加接收地址 > 指令: omni_createrawtx_reference 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff010000000000000000166a146f6d6e69000000000000000100000000001e848000000000 muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe > 得到(事務hash): 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ### 7、在交易上指定礦工費用 > 指令:(事務HASH,交易信息,找零地址,手續費) omni_createrawtx_change 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 '[{"txid":"7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e","vout":1,"scriptPubKey":"76a914486e3cf761cc47642135140da02669c04dd2451088ac","value": 0.0002},{"txid":"0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d","vout":1,"scriptPubKey":"76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac","value": 0.0002}]' muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe 0.0002 > 得到(事務hash): ``` ``` 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` ### 8、對交易簽名 > 指令: ``` signrawtransaction 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` > 得到(區塊信息): ``` { "hex": "01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e000000006b483045022100d790995554bbda790f44db19a6e59e84ab5c2ab27577be1c406f09e76d6e7fe402204db6ef71c96a22fd91e230787a521c47e3acc0a9b66dae2b08151ef74c1a0e5e012103ad3414464aec8d4f0cdc3fd2540a255c0bc8f20d157f6aa39ce67564e92d3077ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b010000006a473044022073d01e964d0a94540adc5d9db778d2b768043ba071cf5f49af2c2b07a99f6db702202e9870ac127e0ba06226c69242016255e9230816d6eab96ca89ad968111a49a7012103e6f952da72a83b16443d70dbb2e30473b25d6c71a6fdc01fbfbf0638805b4218ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000", "complete": true } ``` ### 9、廣播交易 > 指令: ``` Sendrawtransaction 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e000000006b483045022100d790995554bbda790f44db19a6e59e84ab5c2ab27577be1c406f09e76d6e7fe402204db6ef71c96a22fd91e230787a521c47e3acc0a9b66dae2b08151ef74c1a0e5e012103ad3414464aec8d4f0cdc3fd2540a255c0bc8f20d157f6aa39ce67564e92d3077ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b010000006a473044022073d01e964d0a94540adc5d9db778d2b768043ba071cf5f49af2c2b07a99f6db702202e9870ac127e0ba06226c69242016255e9230816d6eab96ca89ad968111a49a7012103e6f952da72a83b16443d70dbb2e30473b25d6c71a6fdc01fbfbf0638805b4218ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` > 得到(交易ID): ab28fcd449d1f8e57ead070d798d80fe8f962168341b383adf5bf07fe80e652d 注意:每次操作后可用指令: decoderawtransaction 事務ID 和 omni_decodetransaction 事務ID來查看當前構建的交易信息情況。 > **參考地址** https://www.zhihu.com/people/duan-pan-ykjym/activities <!--more--> - [使用原始事務API創建簡單發送事務](https://github.com/OmniLayer/omnicore/wiki/Use-the-raw-transaction-API-to-create-a-Simple-Send-transaction) ## 命令 常用基礎命令 ```sh omnicore-cli listaccounts "coinrise" omnicore-cli getaddressesbyaccount "" omnicore-cli getaddressesbyaccount "coinrise" omnicore-cli omni_getbalance "1EXiBj8pkxmsPb6dNAMLFcZYTRSNsUUesS" 31 omnicore-cli omni_getbalance "129sqfPm5uKYH3a1W4n5y1PbSkta8MthcH" 1 omnicore-cli listunspent 0 999999 "[\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]" omnicore-cli listunspent 0 999999 "[\"1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc\",\"13GJVDVyXNPA24vnGPkeZccboRsdpscWkX\"]" omnicore-cli omni_send "1EXiBj8pkxmsPb6dNAMLFcZYTRSNsUUesS" "1JzMWUKnHgMaXXEqiau1ktAFr2hevLsZPw" 1 "0.1" ``` ### omnicore-cli getinfo ```json { "version": 130200, "protocolversion": 70015, "walletversion": 130000, "balance": 0.00000000, "blocks": 584885, "timeoffset": -1, "connections": 110, "proxy": "", "difficulty": 9064159826491.41, "testnet": false, "keypoololdest": 1558404031, "keypoolsize": 100, "paytxfee": 0.00000000, "relayfee": 0.00001000, "errors": "Warning: Unknown block versions being mined! It's possible unknown rules are in effect" } ``` ### importaddress `omnicore-cli importaddress "1EXiBj8pkxmsPb6dNAMLFcZYTRSNsUUesS"` 由于所有現有的比特幣核心功能都是Omni Core固有的,因此默認情況下RPC端口保持8332與每個比特幣核心一樣。如果您希望與比特幣核心一起運行Omni Core(例如,通過單獨的數據中心),則可以使用該-rpcport<port>選項提名替代端口號。 ### omni_send 創建并廣播一個簡單的發送事務。 參數: | 名稱 | 類型 | 存在 | 描述 | | --------------- | ------ | ------ | ------------------------------------------ | | fromaddress | string | 需要 | 要發送的地址 | | toaddress | string | 需要 | 接收者的地址 | | propertyid | int | 需要 | 要發送的令牌的標識符 | | amount | string | 需要 | 要發送的金額 | | redeemaddress | string | 可選的 | 一個可以花費交易粉塵的地址(默認發件人) | | referenceamount | string | 可選的 | 發送給接收方的比特幣金額(默認情況下最小) | 例如: ```$ omnicore-cli “ omni_send ” “ 3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY ” “ 37FaKponF7zqoMLUjEiko25pDiuVH5YLEa ” 1 “ 100.0 ”``` 結果: hash //(字符串)十六進制編碼的事務散列 ### omni_sendall Transfers all available tokens in the given ecosystem to the recipient. Arguments: Name Type Presence Description fromaddress string required the address to send from toaddress string required the address of the receiver ecosystem number required the ecosystem of the tokens to send (1 for main ecosystem, 2 for test ecosystem) redeemaddress string optional an address that can spend the transaction dust (sender by default) referenceamount string optional a bitcoin amount that is sent to the receiver (minimal by default) Result: ``` "hash" // (string) the hex-encoded transaction hash ``` Example: $ omnicore-cli "omni_sendall" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 2 ### omni_sendrawtx 廣播原始的Omni Layer交易。 參數: 名稱 類型 存在 描述 fromaddress 串 需要 要發送的地址 rawtransaction 串 需要 十六進制編碼的原始事務 referenceaddress 串 可選的 一個參考地址(默認沒有) redeemaddress 串 可選的 一個可以花費交易粉塵的地址(默認發件人) referenceamount 串 可選的 發送給接收方的比特幣金額(默認情況下最小) 結果: “ hash ” //(字符串)十六進制編碼的事務散列 例: $ omnicore-cli “ omni_sendrawtx ” \ “ 1MCHESTptvd2LnNp7wmr2sGTpRomteAkq8 ” “ 000000000000000100000000017d7840 ” \ “ 1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV ” 數據檢索 用于數據檢索的RPC可用于獲取有關Omni生態系統狀態的信息。 ### omni_getinfo Returns various state information of the client and protocol. Arguments: None Result: Result: ``` { "omnicoreversion_int" : xxxxxxx, // (number) client version as integer "omnicoreversion" : "x.x.x.x-xxx", // (string) client version "mastercoreversion" : "x.x.x.x-xxx", // (string) client version (DEPRECIATED) "bitcoincoreversion" : "x.x.x", // (string) Bitcoin Core version "commitinfo" : "xxxxxxx", // (string) build commit identifier "block" : nnnnnn, // (number) index of the last processed block "blocktime" : nnnnnnnnnn, // (number) timestamp of the last processed block "blocktransactions" : nnnn, // (number) Omni transactions found in the last processed block "totaltransactions" : nnnnnnnn, // (number) Omni transactions processed in total "alerts" : [ // (array of JSON objects) active protocol alert (if any) { "alerttype" : n // (number) alert type as integer "alerttype" : "xxx" // (string) alert type (can be "alertexpiringbyblock", "alertexpiringbyblocktime", "alertexpiringbyclientversion" or "error") "alertexpiry" : "nnnnnnnnnn" // (string) expiration criteria (can refer to block height, timestamp or client verion) "alertmessage" : "xxx" // (string) information about the alert }, ... ] } ``` Example: Example: $ omnicore-cli "omni_getinfo" ### omni_getbalance Returns the token balance for a given address and property. Arguments: Name Type Presence Description address string required the address propertyid number required the property identifier Result: ``` { "balance" : "n.nnnnnnnn", // (string) the available balance of the address "reserved" : "n.nnnnnnnn", // (string) the amount reserved by sell offers and accepts "frozen" : "n.nnnnnnnn" // (string) the amount frozen by the issuer (applies to managed properties only) } ``` Example: $ omnicore-cli "omni_getbalance", "1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P" 1 omni_getallbalancesforid Returns a list of token balances for a given currency or property identifier. Arguments: Name Type Presence Description propertyid number required the property identifier Result: ``` [ // (array of JSON objects) { "address" : "address", // (string) the address "balance" : "n.nnnnnnnn", // (string) the available balance of the address "reserved" : "n.nnnnnnnn" // (string) the amount reserved by sell offers and accepts }, ... ] ``` Example: $ omnicore-cli "omni_getallbalancesforid" 1 ### omni_getallbalancesforaddress Returns a list of all token balances for a given address. Arguments: Name Type Presence Description address string required the address Result: ``` [ // (array of JSON objects) { "propertyid" : n, // (number) the property identifier "balance" : "n.nnnnnnnn", // (string) the available balance of the address "reserved" : "n.nnnnnnnn" // (string) the amount reserved by sell offers and accepts }, ... ] ``` Example: $ omnicore-cli "omni_getallbalancesforaddress" "1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P" ### omni_gettransaction Get detailed information about an Omni transaction. Arguments: Name Type Presence Description txid string required the hash of the transaction to lookup Result: ``` { "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 involes 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 } ``` Example: $ omnicore-cli "omni_gettransaction" "1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d" ### 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: 999999) 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 }, ... ] ``` Example: $ omnicore-cli "omni_listtransactions" omni_listblocktransactions Lists all Omni transactions in a block. Arguments: Name Type Presence Description index number required the block height or block index ``` Result: [ // (array of string) "hash", // (string) the hash of the transaction ... ] ``` Example: Example: $ omnicore-cli "omni_listblocktransactions" 279007 ### omni_listpendingtransactions Returns a list of unconfirmed Omni transactions, pending in the memory pool. Note: the validity of pending transactions is uncertain, and the state of the memory pool may change at any moment. It is recommended to check transactions after confirmation, and pending transactions should be considered as invalid. Arguments: Name Type Presence Description address string optional filter results by address (default: "" for no filter) 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 involes an address in the wallet "fee" : "n.nnnnnnnn", // (string) the transaction fee in bitcoins "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 }, ... ] ``` Example: $ omnicore-cli "omni_listpendingtransactions" ## 變更歷史 以下調用在Omni Core 0.0.10中被替換,并且使用舊命令的查詢被轉發。 ``` send_MP 通過 omni_send sendtoowners_MP 通過 omni_sendsto sendrawtx_MP 通過 omni_sendrawtx getinfo_MP 通過 omni_getinfo getbalance_MP 通過 omni_getbalance getallbalancesforid_MP 通過 omni_getallbalancesforid getallbalancesforaddress_MP 通過 omni_getallbalancesforaddress gettransaction_MP 通過 omni_gettransaction listtransactions_MP 通過 omni_listtransactions listblocktransactions_MP 通過 omni_listblocktransactions getactivedexsells_MP 通過 omni_getactivedexsells listproperties_MP 通過 omni_listproperties getproperty_MP 通過 omni_getproperty getactivecrowdsales_MP 通過 omni_getactivecrowdsales getcrowdsale_MP 通過 omni_getcrowdsale getgrants_MP 通過 omni_getgrants getsto_MP通過omni_getsto或omni_gettransaction ``` ## 歸集(通過節點) https://www.jianshu.com/p/9a72954d24ea ## 附錄 官方網站: https://www.omnilayer.org/ 瀏覽器: https://omniexplorer.info/ Omni WIKI: https://github.com/OmniLayer/omnicore/wiki JSON-RPC API: https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md https://api.omniexplorer.info/ # 錢包歸集 最近幾天在對接USDT錢包,遇到一個問題就是根本沒辦法通過omni 錢包提供的API來實現錢包歸集,因為API提供的接口都需要發送USDT的地址有一定的BTC數量才可以發送交易,所以沒辦只能找其他方案替代,請教了其他人后才知道只能通過創建BTC的原生交易才能達到這個效果,折騰了好幾天,終于把這個流程給整理通順了,估計還有很多人會遇到這個問題,所以記錄下來為后面的人節省一些時間。 ### 1、準備兩個地址 首先兩個地址, 發送USDT(地址里面要有USDT,這里通常可能是交易所用戶的USDT錢包地址)地址和付手續費的地址(地址里面要有足夠的BTC,這里通常可能是熱錢包地址) 本次案例中 發送USDT地址為: mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4 付手續費地址為: muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe 接收USDT地址為:muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe ### 2、分別找到發送地址 和熱錢包地址的一筆UXTO 作為發送USDT交易的載體 指令:listunspent 0 999999 '["mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4"]' ``` { "txid": "7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e", "vout": 0, "address": "mn7w1M4fwJzRr4zYy5dMSSfBg1ZC9e4xH4", "scriptPubKey": "76a914486e3cf761cc47642135140da02669c04dd2451088ac", "amount": 0.00081189, "confirmations": 31103, "spendable": true, "solvable": true } ``` 指令:listunspent 0 999999 '["muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe"]' 得到UXTO: ``` { "txid": "0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d", "vout": 1, "address": "muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe", "account": "sys", "scriptPubKey": "76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac", "amount": 0.00992750, "confirmations": 4137, "spendable": true, "solvable": true } ``` ### 3、創建負載 > 指令: ``` createrawtransaction '[{"txid":"7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e","vout":0},{"txid":"0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d","vout":1,"scriptPubKey":"76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac","value": 0.00992750}]' '{}' ``` > 得到: ``` 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff0000000000 ``` ### 4、創建USDT交易 指令(代幣ID,發送代幣數量):omni_createpayload_simplesend 31 2.0 得到:000000000000000100000000001e8480 ### 5、在交易上綁定代幣數據 > 指令: ``` omni_createrawtx_opreturn 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff0000000000 000000000000000100000000001e8480 ``` > 得到(事務hash): ``` 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff010000000000000000166a146f6d6e69000000000000000100000000001e848000000000 ``` ### 6、在交易上添加接收地址 > 指令: ``` omni_createrawtx_reference 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff010000000000000000166a146f6d6e69000000000000000100000000001e848000000000 muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe ``` > 得到(事務hash): ``` 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` ### 7、在交易上指定礦工費用 > 指令:(事務HASH,交易信息,找零地址,手續費) ``` omni_createrawtx_change 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 '[{"txid":"7ef4ca48422fbd055eb7375145cb59bdadaba13caf29b4279c506a7ba846a33e","vout":1,"scriptPubKey":"76a914486e3cf761cc47642135140da02669c04dd2451088ac","value": 0.0002},{"txid":"0b381b15082156911ca8db2761910fe9545356778d70dd09be30fc0bece9ed9d","vout":1,"scriptPubKey":"76a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac","value": 0.0002}]' muPuXyRqLBRf8Xyj28d2As8ya4iaw8XWGe 0.0002 ``` > 得到(事務hash): ``` 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` ### 8、對交易簽名 > 指令: ``` signrawtransaction 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e0000000000ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b0100000000ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` > 得到(區塊信息): ``` { "hex": "01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e000000006b483045022100d790995554bbda790f44db19a6e59e84ab5c2ab27577be1c406f09e76d6e7fe402204db6ef71c96a22fd91e230787a521c47e3acc0a9b66dae2b08151ef74c1a0e5e012103ad3414464aec8d4f0cdc3fd2540a255c0bc8f20d157f6aa39ce67564e92d3077ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b010000006a473044022073d01e964d0a94540adc5d9db778d2b768043ba071cf5f49af2c2b07a99f6db702202e9870ac127e0ba06226c69242016255e9230816d6eab96ca89ad968111a49a7012103e6f952da72a83b16443d70dbb2e30473b25d6c71a6fdc01fbfbf0638805b4218ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000", "complete": true } ``` ### 9、廣播交易 > 指令: ``` Sendrawtransaction 01000000023ea346a87b6a509c27b429af3ca1abadbd59cb455137b75e05bd2f4248caf47e000000006b483045022100d790995554bbda790f44db19a6e59e84ab5c2ab27577be1c406f09e76d6e7fe402204db6ef71c96a22fd91e230787a521c47e3acc0a9b66dae2b08151ef74c1a0e5e012103ad3414464aec8d4f0cdc3fd2540a255c0bc8f20d157f6aa39ce67564e92d3077ffffffff9dede9ec0bfc30be09dd708d77565354e90f916127dba81c91562108151b380b010000006a473044022073d01e964d0a94540adc5d9db778d2b768043ba071cf5f49af2c2b07a99f6db702202e9870ac127e0ba06226c69242016255e9230816d6eab96ca89ad968111a49a7012103e6f952da72a83b16443d70dbb2e30473b25d6c71a6fdc01fbfbf0638805b4218ffffffff020000000000000000166a146f6d6e69000000000000000100000000001e848022020000000000001976a914983c8b990aef5747bdef1f2bf3a49d29b19ae15788ac00000000 ``` > 得到(交易ID): ab28fcd449d1f8e57ead070d798d80fe8f962168341b383adf5bf07fe80e652d 注意:每次操作后可用指令: decoderawtransaction 事務ID 和 omni_decodetransaction 事務ID來查看當前構建的交易信息情況。 > **參考地址** https://www.zhihu.com/people/duan-pan-ykjym/activities # 參考地址
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看