What's the main difference between Wortschatz and Lexikon?
You are of course not referring to Lexikon as in encyclopedia, but as in the English word lexicon that also exists in German.
Wortschatz and Lexikon seem to be identical in meaning in that respect. However, you can see from the comment to your question and from the other answer that in German (outside linguistic circles), Lexikon is mostly used as encyclopedia.
Wortschatz are all the words you know. Lexikon is a book that explains words, usually in the same language.
A Wörterbuch often offers a translation from Language 1 <> Language 2 but also same language Wörterbücher exist.
edit: As mentioned in other answers and comments (I myself was unaware of this), Lexikon may also be a synonym to Wortschatz, however, the average German will picture the Lexikon as the encyclopedia.
I’m not an expert in that field, but as a native speaker I would suggest the following. A lexicon (often similar to an encyclopedia) is a tangible asset. Usually a book that you can hold in your hand. You use it as a source of help if you want an explanation to a word. ‘Wortschatz’ is more an intangible asset. It refers to your or to someone else’s knowledge. You can train it by learning a language and memorizing more words. Similarly to computer science, programming or chat bots, they are only as intelligent as the (limited) ‘Wortschatz’ they’ve been trained with.
Hope this helps :)
English: encyclopedia, lexicon
A book or a website with descriptions of many terms. Each section starts with a headword that will be explained and after it comes the explanation of this term. If the Lexicon is printed (i.e. a book) then the sections are sorted alphabetically by the headwords.
This posting here is a sort of a Mini-Lexikon
Wikipedia is a Lexikon.
English: vocabulary, lexicon, word pool
A set of words that is known by a single person (Wortschatz einer Person; a person's vocabulary).
The set of all words that this person can understand (by reading and listening) is called "passiver Wortschatz" (passive vocabulary). The set of all words that this person really uses for writing and speaking is called "aktiver Wortschatz" (active vocabulary).
The set of all words that belong to a language (Wortschatz einer Sprache; a language's vocabulary.
The Wörterverzeichnis des Rats für deutsche Rechtschreibung is the aim to list the German Wortschatz. But a Wortschatz is just an unordered set.
engl: dictionary, lexicon, wordbook
A list of word-to-word translations from one language to another, sometimes also with short explanations, but much shorter than in a Lexikon (encyclopedia).
dict.leo.org is such a Wörterbuch
A list of all (or the most important) words of a language together with short explanation about the usage in the context of the language.
Wiktionary is such a Wörterbuch