Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any sample USDT send example for testnet ? #204

Open
kunalransing opened this issue Jan 6, 2022 · 0 comments
Open

Any sample USDT send example for testnet ? #204

kunalransing opened this issue Jan 6, 2022 · 0 comments

Comments

@kunalransing
Copy link

kunalransing commented Jan 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant