Who was the first economist to write about central banking? I am interested in the origin of a central banking theory. I've heard that Karl Marx was the first author who wrote about central banking system. Was he really the first one? Or was there any other author who had written about this topic before Karl Marx?

By central banking I mean system where all currency in some country is provided by one institution. This institution has a legal monopoly and no other institution can create its own currency. Every subject in the country can use only the currency created by the central bank.
Commercial banks have existed long before any institution akin to a modern central bank was established (the first &quot;central bank&quot; seems to have been the Bank of Sweden, created in 1668, albeit this was a for-profit, private institution). Because of the important role of banking in financing trade, wars, and the recurrence of crises, inflation, and convertibility problems, many politicians, economists, and other individuals wrote about issues related to money theory and banking. For instance, two prominent books about monetary theory are John Law (main book in 1705) and Fernando Galiani (main book in 1751). Later on, both Adam Smith and David Hume wrote about banking. According to this source Adam Smith argued that:

the banking system is guided by the invisible hand just like any other branch of  industry.  Smith  argued  that  the  profit  motive  would  ensure  that  the  supply  of  money is self-regulating even after the development of privately issued banknotes, and that  a  significant  savings  in  social  capital  results  from  using  paper  instead  of  precious  metals   as   circulating   currency.   In   this   way   Smith   attempted   to   show   that   free   competition   in   the   business   of   issuing   currency   directs   self-interested   market   participants to unintentionally promote the social interest.

In sharp contrast, David Hume opposed for-profit, fractional reserve banking. According to this article:

Hume claims the following about the kind of bank he prefers: ‘‘No bank could be more advantageous, than such a one as locked up all the money it received, and never augmented the circulating  coin,  as  is  usual,  by  returning  part  of  its  treasure  into  commerce’’  ([1752]  1985, pp. 284–5). Hume recognizes that a bank that does not lend cannot stay in business by itself: ‘‘It would have no profit from its dealing’’ ([1752] 1985, p. 285). Therefore, rather than allowing the bank  to  earn  a  profit  by  lending  out  money  or  by  charging  fees,  Hume  suggests  a  purely
subsidized public bank, where ‘‘the state bore the charges of salaries of the directors and tellers of this bank’’ ([1752] 1985, p. 285)

A bit later, amid the Bullionist controversy (regarding whether paper money should be convertible to gold or not), a myriad of writings appeared (see link). For example, in 1801, Walter Boyd wrote a letter to the primer minister William Pitt advocating for full convertibility, in order to avoid high inflation associated with private banks incentive to expand paper money under limited convertibility.
A notorious economist at that time was Henry Thornton, who wrote in 1802 the book &quot;An Enquiry into the Nature and Effects of the Paper Credit of Great Britain&quot;, partly in response to Boyd's views. Apparently, some (?) consider Thornton as the founder of central banking.
Later on, Ricardo also wrote about central banking. In particular, he argued in favour of central bank independence (yet, remaining a for-profit institution). This is a quote from 1824 (emphasis mine):

It is said that Government could not be safely entrusted with the power of issuing paper money; that it would most certainly abuse it ... There would, I confess, be great danger of this if Government – that is to say, the Ministers – were themselves to be entrusted with the power of issuing paper the hands of Commissioners, not removable from their official situation but by a vote of one or both Houses of Parliament. I propose also to prevent all intercourse between these Commissioners and Ministers, by forbidding any species of money transactions between them.
The Commissioners should never, on any pretense, lend money to Government, nor in the slightest degree be under its control or influence ... If Government wanted money, it should be obliged to raise it in the legitimate way; by taxing the people; by the issue and sale of exchequer bills; by funded loans; or by borrowing from any of the numerous banks which might exist in the country; but in no case should it be allowed to borrow from those who have the power of creating money.

(The quote is from here, but it belongs to Ricardo's 1824 pamphlet &quot;Plan for the Establishment of a National Bank&quot;, which can also be found as an appendix on this book)
Meanwhile, others consider the &quot;founding father&quot; of central banking to be Walter Bagehot, a &quot;famous&quot; editor of The Economist (you might have noticed that there is still a column under his name) that in 1873 published the book &quot;Lombard Street: A Description of the Money Market&quot;, where he advocated for the role of the Bank of England (still a private, for-profit institution) as a lender of last resort in the case of a financial crisis. Despite of this, he also advocated for a free banking sector. A quote (from here):

I shall have failed in my purpose if I have not proved that the system of entrusting all our reserve to a single board, like that of the Bank directors, is very anomalous; that it is very dangerous; that its bad consequences, though much felt, have not been fully seen; that they have been obscured by traditional arguments and hidden in the dust of ancient controversies.
But it will be said — What would be better? What other system could there be? We are so accustomed to a system of banking, dependent for its cardinal function on a single bank, that we can hardly conceive of any other. But the natural system — that which would have sprung up if Government had let banking alone — is that of many banks of equal or not altogether unequal size. In all other trades competition brings the traders to a rough approximate equality. In cotton spinning, no single firm far and permanently outstrips the others. There is no tendency to a monarchy in the cotton world; nor, where banking has been left free, is there any tendency to a monarchy in banking either.

For further references, check the book &quot;Monetary Theory and Policy from Hume and Smith to Wicksell: Money, Credit, and the Economy&quot;.