Leanpub has a number of writing modes. If you are writing in plain text, in Markua, then you can we have dedicated support for doing endnotes.
(Please note this does not apply to our Google Docs writing mode; in that writing mode, you are not writing in plain text in Markua.)
Currently they only go at the end of each chapter, not at the end of the book.
Here's how they work: https://leanpub.com/markua/read#leanpub-auto-endnotes
This has an endnote[^^thenote].
[^^thenote]: This is the endnote content.
To put your book in Markua mode, go to https://leanpub.com/markuainbrowserdebugging/edit_manuscript_format
To learn what doesn't work yet in Markua, go to: https://leanpub.com/markua/read#leanpub-auto-todo-in-leanpub