I sent some ERC20 token to an ethereum address in my trezor and I can successfully see it using MEW. I wish to use this as an air-gapped wallet but with frequent use (i.e, not cold wallet).

Suppose I create a raw transaction, how do I call trezorconnect to sign it?

[Edit: The method might be to call signtx in trezor and have crypto elements v,r,s returned and then somehow convert to format ready for broadcast. If correct, code please?]

  • If you have the v, r, s values and the unsigned transaction (in raw hex, RLP encoded), you need to insert those values into the RLP structure and this will give you the signed transaction. I was unable to find code that performs this operation though. If you have time, you might be able to write that function yourself. Commented Apr 28, 2018 at 1:15

1 Answer 1


Provided you have the R,S,V, using the ethereumjs-tx library:

let signedTransaction = _.clone(unsignedTransaction)

signedTransaction.r = Buffer.from(rsv.r, 'hex')
signedTransaction.s = Buffer.from(rsv.s, 'hex')
signedTransaction.v = Buffer.from(rsv.v, 'hex')

let tx = new ethTx(signedTransaction);
const serializedTx = tx.serialize();
const rawTx = '0x' + serializedTx.toString('hex');

Then you send the rawTx with:


Note that when you're signing transactions with ledger (probably also with trezor), you have to put the chain id inside the "v" before signing ,like this:

transactionCopy.v= "0x0" + chainId.toString(16)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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