I'm not using omnicore by RPC calls, I dont want to put a server up and make those RPC calls, I want to make a simple transaction on the TetherUS(USDT) network, this is my code:

const getUnsignedTransaction = async (data) => {
  let { pubKey, fromAddr, toAddr, amount, fee, testnet } = data;
  let params = new URLSearchParams;
  return await Axios.post('/v1/transaction/getunsigned/0', params);

When I call this function above

  let a = await getUnsignedTransaction({
    amount:    '0.00001',
    fee:       '0.00005',
    testnet:   false,
    toAddr:    '1KH34S5mAmgAzu3mJAqrS3wjP15qYKZQXx',
    fromAddr:  '17UrxYAAF5WkjtFKeuZ2S7ojDWoJY2LunF',
  }).then(e => e.data);

I got this response:

{ sourceScript:
   'OP_DUP OP_HASH160 4715b028de4327f5f87915d89d1d074db3f03992 OP_EQUALVERIFY OP_CHECKSIG',
  status: 200,
   '0100000001131184d4a10bbf1acef3cb137d37ecc8f36cb3da208c9ebe86fb988821d532b40100000000ffffffff034d160000000000001976a9144715b028de4327f5f87915d89d1d074db3f0399288ac22020000000000001976a914c87aa36f1402052ef87ea433c2fa252ae9a9794988ac0000000000000000166a146f6d6e69000000000000001f00000000000003e800000000' }

Now here is the question: How can I make this unsigned raw transaction an valid transaction to the Tether network and so, broadcast this signed raw transaction

This is the blockexplorer I'm using: https://api.omniexplorer.info/#request-v1-transaction-pushtx

Code solution

As the @Raghav_Sood chosen answer, I had to use bitconjs-lib to wrap this transaction and to sign it.

For those who wanna see in the future how I made the transaction, was kinda this:

let tx  = bitcoinjs.Transaction.fromHex(raw);
let txb = bitcoinjs.TransactionBuilder.fromTransaction(tx);
txb.sign(0, keyPair)
let raw = txb.build().toHex();

let d = await pushtx(raw).then(e => e.data);

function pushtx

async function pushtx(raw) {
  let params = new URLSearchParams;
  return await Axios.post('/v1/transaction/pushtx/',params);

The only omni-specific thing in Omni/Tether txs is the OP RETURN, and a small dust output to the address you are sending the funds to. Both of these seem to check out in your tx (I'm assuming you're sending to 1KH34S5mAmgAzu3mJAqrS3wjP15qYKZQXx).

You should be able to just use the regular Bitcoind signing functionality (or whatever library you are using's wrapper of it). They don't require any special signatures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.