OmniLayer / OmniJ

OmniLayer for Java, JVM, and Android
Apache License 2.0
133 stars 89 forks source link

Any sample USDT send example for testnet ? #204

Open kunalransing opened 2 years ago

kunalransing commented 2 years ago

Hi, I'm new to omni USDT. I didn't find any sample for sending omni usdt. I used bitcoinj 0.15 send with output as below

        NetworkParameters parameters = to.getParameters();
    Transaction tran = new Transaction(parameters);
        SendRequest req = SendRequest.forTx(tran);
        //req.aesKey = kit.wallet().getKeyCrypter().deriveKey(walletKey);
        req.feePerKb = Coin.valueOf(5000);

        //This is the limited minimum transfer amount of bitcoin, so many usdt transfers will receive a btc of 0.00000546
        tran.addOutput(Coin.valueOf(546L), Address.fromString(params, adddress));

        //Build the output script of usdt. Note that the amount here is multiplied by 8 times 10
        String usdtHex = "6a146f6d6e69" + String.format("%016x", 31) + String.format("%016x", usdtAmount.longValue());  //omni protocol is 31
        tran.addOutput(Coin.valueOf(0L), new Script(Utils.HEX.decode(usdtHex)));

Then used bitcoinj to send tx.

Wallet.SendResult result = kit.wallet().sendCoins(req);

Actually I don't understand how Omni layer validates if the sender has usdt balance or not ? I want test omni USDT on testnet but don't see any testnet explorer. @msgilligan Please help