Feature Description
I would like to have a function in BitGoJS that helps me recover USDT that was sent to one of my wallet addresses.
Motivation
Often customers mistakenly send USDT to a bitcoin address, and there is currently not an easy way to recover these funds
Context
This script shows an implementation that constructs and signs this exact type of recovery with the User and Backup keys. You'll need to take the logic from that and fit it into BitGoJS
The new function should live in /modules/core/src/v2/coins/btc.ts and it should be something like this:
sendOmniToken(fromAddress: string, toAddress: string, tokenAmount: number, tokenId: number, fundingTxid?: string) : string
It should return a half-signed txhex, which the user can then submit to bitgo support to finalize the recovery
Feel free to ask questions. Some more info on Omni Layer transactions:
The Omni Layer is a layer on top of Bitcoin, which allows you to create tokens (sometimes called "colored coins"). The original USDT (aka "Tether") was built on Bitcoin's omni layer. To send an Omni token from Address A to Address B, you create a Bitcoin transaction that takes a Bitcoin unspent from Address A and spends a small amount of BTC to Address B. Additionally, you add another OP_RETURN output on the transaction that has some custom Omni Data in it that basically says "Send X amount of Y token".
So in this situation, a customer accidentally has sent some 100 USDT to their bitcoin Address A, and they want to recover it and send the Tether to Address B. Here's how it will work:
First we ask the customer to send a small amount of BTC to Address A, about 0.0005 BTC is enough. The txid of this transaction is the fundingTxid. Now the user should be able to call your function like this. (Note the "tokenId" for USDT is "31").
const halfSigned = bitgo.coin('btc').sendOmniToken( <Address A>, <Address B>, 100, 31, <fundingTxid> )
halfSigned should be a valid transaction signed by the customer's user key.
This transaction will look like this:
inputs:
(fundingTxid):(vout of funds sent to Address A)
outputs:
0.0000059 BTC to Address B
0.0003941 BTC to Address A (change)
OP_RETURN output with Tether data.
For the OP_RETURN output, see lines 59-64 of this file
Feature Description
I would like to have a function in BitGoJS that helps me recover USDT that was sent to one of my wallet addresses.
Motivation
Often customers mistakenly send USDT to a bitcoin address, and there is currently not an easy way to recover these funds
Context
This script shows an implementation that constructs and signs this exact type of recovery with the User and Backup keys. You'll need to take the logic from that and fit it into BitGoJS
The new function should live in
/modules/core/src/v2/coins/btc.tsand it should be something like this:It should return a half-signed txhex, which the user can then submit to bitgo support to finalize the recovery
Feel free to ask questions. Some more info on Omni Layer transactions:
The Omni Layer is a layer on top of Bitcoin, which allows you to create tokens (sometimes called "colored coins"). The original USDT (aka "Tether") was built on Bitcoin's omni layer. To send an Omni token from Address A to Address B, you create a Bitcoin transaction that takes a Bitcoin unspent from Address A and spends a small amount of BTC to Address B. Additionally, you add another OP_RETURN output on the transaction that has some custom Omni Data in it that basically says "Send X amount of Y token".
So in this situation, a customer accidentally has sent some 100 USDT to their bitcoin Address A, and they want to recover it and send the Tether to Address B. Here's how it will work:
First we ask the customer to send a small amount of BTC to Address A, about 0.0005 BTC is enough. The txid of this transaction is the
fundingTxid. Now the user should be able to call your function like this. (Note the "tokenId" for USDT is "31").halfSignedshould be a valid transaction signed by the customer's user key.This transaction will look like this:
inputs:
(fundingTxid):(vout of funds sent to Address A)
outputs:
0.0000059 BTC to Address B
0.0003941 BTC to Address A (change)
OP_RETURN output with Tether data.
For the OP_RETURN output, see lines 59-64 of this file