0

I'm trying to run the program trezorctl to sign a Qtum transaction built in Java alongside a Trezor device, by creating a process through ProcessBuilder that runs the command trezorctl sign-tx <name_of_file>.json. After running it, you will often need to input your PIN before confirming the transaction.

I am inputting the PIN to the process using a BufferedWriter(OutputStreamWriter(proc.getOutputStream())) by calling write(pin), then newLine(), then flush(). This works on Linux and on Mac when running the program through Intellij, but when I build the jar file and run that, it doesn't. trezorctl doesn't receive the input and my program hangs at the next stdInput.next(). On Windows this behaviour also occurs on Intellij.

Why would it work in one case and not the other, even within the same OS? When I run the command line application manually on Windows, it works on cmd, but not on Git bash, exhibiting similar behaviour. I don't know if this matters, but trezorctl masks the input so you can't see the PIN, would that affect this? I've also tried running my program with sudo, so I don't think it's a permission issue.

  • *I don't know if this matters, but trezorctl masks the input so you can't see the PIN, would that affect this?* Might do. btw, I don't know if I missed it, but I didn't see what the problem actually IS. Is there an option to enter the PIN as an argument? Yes, I know that would be a security risk but in you case it might be useful – g00se Jul 27 '21 at 16:58
  • You can't enter it as an argument, because every time it asks for it, a new PIN layout appears on your Trezor's screen and you have to input the numbers that would correspond to it on a standard PIN keyboard. i.e. if it shows 9 5 4 3 6 7 1 8 2 and if your PIN is 1234, you have to input 1349. For reference, the standard PIN keyboard would be 7 8 9 4 5 6 1 2 3 – vietnamese_chowder Jul 27 '21 at 17:00
  • I think you misunderstand: if you can enter it as an argument, then it wouldn't need to ask for it. What i mean is akin to entering a password (as in MySql) with `-pSomePassword` – g00se Jul 27 '21 at 17:06
  • it's not possible to enter it as an argument, because the generated keypad layout is different each time, so you type a different "pin" each time. Here is an image of what it looks like on the command line https://imgur.com/a/oG4GUnx – vietnamese_chowder Jul 27 '21 at 17:10
  • And then on the Trezor device screen it shows the unique keypad layout – vietnamese_chowder Jul 27 '21 at 17:11
  • Ah I see. I think you're going to have to look at the source to bypass that – g00se Jul 27 '21 at 17:12

0 Answers0