Process for using AppKeys?

A couple of stupid questions. I’m a bit out of my depths. :slight_smile:

I recently bought a sensor (Laird RS191) and it has an app key taped to it that looks something like this:

0x8E,0x62,0x9C,0x1E,0x8E,0x62,0x9C,0x1E,0x8E,0x62,0x9C,0x1E,0x8E,0x62,0x9C,0x1E

It also has a QR code attached to it.

When I log into TTN to set up a device it populates an AppKey for me. I was playing with loraserver.io earlier and that does not populate an AppKey. Both would seem to prefer a hex code (and not what is pasted above). This has me wondering a few things.

Questions

Is there a usual process for using app keys? Is it best practice to use what comes with my node? Would it be better to provide what TTN provides me? Obviously I can overwrite either, is there a preferred method of going about this?

If I were to use the one with my node, what’s the best way to convert that string of stuff (what is that format called by the way) into hex?

What’s the best way to use the QR code? Any scanner I threw at it seemed a bit confused (but it did give me something to copy).

Thanks for any help you can offer! I need it. :slight_smile:

I don’t think so, as like you wrote TTN allows you to set your own. TTN also allows for adding multiple AppEUIs to a single application in TTN Console; see Registration of node with pre-configured LoRaWAN keys - #2 by arjanvanb.

That thing is already hex, as the prefix 0x indicates that what you see is a hexadecimal presentation of each byte. So, 0x8E, 0x62, 0x9C, 0x1E,... can probably be written as 0x8E629C1E... and entered in TTN Console without the 0x prefix. One caveat: when handling separate bytes, you need to know if it’s LSB-first or MSB-first, whereas 0x8E629C1E... is really just a human-readable number for which LSB and MSB do not really apply.

(When using myVariable[16] = {0x8E, 0x62, 0x9C, 0x1E,..., } in computer code, you force the computer to use that specific order; when using myVariable = 0x8E629C1E... you’re letting the compiler decide whether to use LSB or MSB when storing that human-readable value, if it provides a type that can handle such long values to start with.)

1 Like

Thanks @arjanvanb!

At first I didn’t even realize that the versions of the hex numbers were the same without th 0x. That makes a lot more sense. I spent some time looking up hexadecimal numbers, and binary this morning so the mentions of MSB and LSB are clicking for me a bit more this morning. Thank you for your help!