AppEUI/JoinEUI and AppKey generation

Hi all,
I have some doubts on how I should generate the codes for my devices (AppEUI/JoinEUI and AppKey). Rigth now I am using heltec cubecell boards and I am generating the codes randomly (except from the second digit of the first byte as read in DevEUI for non-hardware assigned values but I haven’t understood).

I know it has already been asked, but I can’t fully understand a couple of things.

First, what does it mean to set the addresses of my devices as locally administrated (second digit of first byte set to 2, 6, A or E)? And what does it imply?

Secondly, rigth now I am setting both appKey and appEUI as fully random. Is that ok?

By proceding the way I do, is there a risk of collision?
Thanks and sorry if it has already been asked and answered.

If you don”t own your own ieee oui block you can use all zeros for the JoinEUI(formerly called AppEUI) and use the TTN console to generate a DevEUI for you. That way you are sure not to interfere with anyone else and you won”t infringe on the EUI space someone might have spend good money on.

Thanks a lot.
Do I risk to interfere with people even if I set the address as locally administrated as specified in the other thread?
And what are the advantages of buying an ieee block compared to make ttn generate the devEui?

Lastly, what does happen when multiple devices have the same EUI? Do they clash only if they are seen by the same gateway? (Asking to understand, not planning to use EUIs I shouldn’t, I wanna be a good neighbour :smiley: ).

Unless you are using the (allegedly awesome) RadioLib, most other stacks don’t cope well with the all zero JoinEUI - particularly not LMIC - and the Heltec stack is so old the other copy is in the Smithsonian.

If you want an official JoinEUI, create a device with all zeros on the JoinEUI, copy the DevEUI it creates for you and then promptly delete it that device so it doesn’t get in the way.

That then gives you a JoinEUI you can use for your devices and TTN will generate an official EUI for your device on creation (up to 50 per app). And it will generate your AppKey.

If you need to create local addresses, then this mildly awesome webpage does the job: Random EUI or Key generator

Thanks a lot!
I have still some questions:

  1. What does using local addresses imply? I mean what’s the difference between local and universal?
  2. Can’t I just generate my keys randomly and change only the first two bits of the first byte to make it local?
  3. Is there a problem if in the same application I have both devices with local and universal addresses?

Please take a look at the LoRaWAN architecture. Gateways are just dumb RF to IP forwarders. All processing is done in the network server. So duplicate EUIs will end up there and will also be registered there.

BTW, having multiple devices with the same JoinEUI is very common. Some vendors assign a JoinEUI to a certain device type.

The DevEUI should be unique for every device created, whether by you or someone else.

Your random value might collide with someone else’s. Slim chance given the available space but still possible.

If you buy it, you own it and you can assign values as you see fit, also a device can be traced to a manufacturer based on that value. When using TTN provided ones you are borrowing from someone else’s space. Fine for development, fine for really small non commercial deployments but for commercial use you should get your own range (in my opinion).

No problem at all. TTN does not differentiate between local/global addresses.

Thanks a lot for the detailed answer.
After this clarification I still have a big doubt. What is the locally administrated address useful for? When and why should I use it?

Not much, most people won’t know or care. But I’d not sell devices with a local address.

Two bits that are set, a few hundred dollars and an official entry in the IEEE database.

Yes, that’s what the link above does, as per the discussion it links to.

No, but why not just use the TTN ones.

This is excellent bikeshedding in the face of using the Heltech LoRaWAN stack - I’d worry about the code you are using rather than whether to use local vs issued EUIs.

The original proposal was created for use with IPv6 where local addresses are required in certain situations, for instance for serial IP links where no hardware EUI is available. If you want to know more you can use google to find the answers.

In the TTN LoRaWAN world it is useful if you do not want to spend money to get EUIs for your own (do not sell!) devices and you do not want to use the TTN supplied one.

Thanks again.
Last question, which is probably the dumbest.
If I undesrtood well by buying products like the heltec cubecell and using the DevEUI of the chip I am not infringing anyone space.
I don’t know why I didn’t do it before but I guess the best approach for me is to use the chip devEui and generating random AppKey while copying the JoinEui from devEui.
By doing so I should be good, right?

Sadly not - Heltec derive the EUI from the CubeCell ASR MCU id - I’ve not looked at the code in a few years but it’s not something to rely on. However the chances of a clash are minimal and the console will soon let you know if there is an issue.

Here’s some tough love:

Your very best approach would be to follow the advice given to you by the people you ask questions of rather than liquidising their answers when you aren’t sure what the resulting sludge will give you.

If you’re not sure of their background, click on their name and look at their stats. And be aware that we are all volunteers so have a finite attention span.

Here’s a free totally official JoinEUI 70B3D57ED0067C74 freshly generated from the TTN console that can never be used again, it’s all yours, the DevEUI you can generate via the TTN console when you create a device and it will create a random AppKey for you.

All the docs are linked on every page of the console, bottom right, Learn section linked top of every forum page.

You need to move past this admin issue, it’s a tiny tiny fraction of LW, there are no EUI police but there are radio airtime use police and a Fair Use Policy - those are things to pay attention to - all covered in the Learn section.


To make things worse for you, the CubeCell’s are “special” and won’t work with RadioLib due to timing issues. I can’t remember if you can use LMIC. To use Heltec’s prehistoric LW library you may still need to get an unlock key, if you are lucky your board id will be in the database so you will get the key straightaway, if not you’ll have to ask on the forum for a Heltec staff member to add your board id to the database. Note, this key is totally a Heltec thing and has nothing to do with LW beyond unlocking the libraries they provide. My two CubeCell boards are used as IoT Fluffy Dice hanging off the rear view mirror in the wife’s MX5.

I know all forum users are volunteers and I am really glad for the help. Furthermore, I read a lot on this forum and saw a lot of times both you and kersing, never had doubts about your background.

The reason why I asked about the cubecell ID was due to the fact that I am not using TTN network but I am using a private network deployed on Azure (I hope I have written it rigth, not my field at all) using GitHub - TheThingsNetwork/lorawan-stack: The Things Stack, an Open Source LoRaWAN Network Server.
I should have written it before, sorry for that.
Given this information, should I still use your solution? Like going on “normal ttn”, generating devEui, and then registering them into my applications?

Concerning the Fair Use Policy I spent a lot of time on that. The devices send few bytes (between 10 and 15) every hour with unconfirmed uplinks.

Again I am sorry for my lack of knowledge but I am having problems understanding what you mean. What are unlock keys? What do I need them for? When I register cubecell I can find the cubecell among the available boards and since now I never had problems… have I been just lucky?

I know and I am sorry, to my excuse I can say that I read multiple times but I really have troubles understanding all.

Yes, after all the mentions of TTN this is a material difference.

Nope, you’re not contributing to the network, the network shouldn’t supply you with free EUI’s.

Anyone setting up their own LNS should have the knowledge to organise their EUIs.

As there are so many other details missing it’s hard to know what you are doing with the CubeCell boards but like much of the rest of this, it’s all over the documentation. If it’s working for you, fine.