This has happened a few times before, and is usually a rather extreme measure used to promote the use of, and trust in, local currency, as opposed to transactions being conducted using a more stable foreign currency, most often USD.
In 2011, Indonesia banned foreign currencies being used in domestic cash transactions:
On 28 June 2011, the Indonesian president signed law Nr. 7/2011 on
currencies, requiring cash transactions within Indonesia to be
conducted only in the local currency (art. 21(1) of the law). The ban
shall not hold for the following exceptions listed in the law:
- a. certain transactions within the framework of the implementation of
budget revenues and expenditures;
- b. accepting or awarding grant
- c. international trade transactions;
- d. bank deposits in
foreign currencies; or
- e. international financing transactions."
The regulation came into force
on the day of its issuance but entities had one year to comply with
the new provisions.
Later, in 2015, the Bank of Indonesia pushed through a regulation which banned foreign currencies being used in all domestic transactions:
Trust in the rupiah has been fragile ever since the Asian financial
crisis in the late 1990s, when its value went into free fall and
Indonesia went under an International Monetary Fund rehabilitation
program. The rupiah has become one of Asia’s worst-performing
currencies this year, depreciating around 7% against the dollar.
Bank Indonesia says the prohibition against foreign currency in
domestic transactions is intended to reduce reliance on the dollar and
other foreign currencies and mitigate against capital outflows.
According to Bank Indonesia, transactions within the country in
currencies other than rupiah amount to $73 billion a year.
These laws are still in force.
In a similar vein, in 2015 the Bank of Nigeria banned commercial banks from accepting deposits of foreign currencies.
On 5 August 2015, the Central Bank of Nigeria (CBN) prohibited
commercial banks to accept deposits of foreign currency cash. The
policy was published in a circular by the CBN's Director of the Trade
and Exchange Department, Olakanmi I. Gbadamosi. Account holders which
made a foreign currency deposit prior to the announcement by the CBN,
are advised to withdraw their amount in the foreign currency or naira
The CBN stated that the measure is supposed to counter
illicit financial flows in the Nigerian banking system. The Nigerian
government is impeding access to USD since mid-2015. The goal of its
strict monitoring of cash flows is to avoid foreign currency reserves
to deplete as oil prices are falling. Crude oil exports represent
Nigeria's main source of US Dollars. The policy is also connected to
the government's national development plan which emphasizes import
substitution, i.e., the protection of local businesses from
This measure, however, seems to have been relaxed recently.
Section 107 of California's Corporation Code banned individuals or entities from "[issuing] or [putting] in circulation, as money, anything but the lawful money of the United States.", however this was repealed in 2014.
In addition, some governments have previously sought to ban alternative assets used in place of currency. You've mentioned the 1933 US ban on 'hoarding' gold. India, as well, has enacted several regulations on gold over the years, most prominently the (now repealed) Gold (Control) Act, 1968, which prohibited citizens from owning gold bars and coins.
Bitcoin and other cryptocurrencies seem like another obvious example, and although many countries have not yet adapted their laws to explicitly legalize or criminalize this type of asset, many have. There is a fairly comprehensive list here, which I won't reproduce in this answer, but regulations range from an outright ban (e.g. Algeria, Bolivia, Nepal), to a ban on use as a payment method (Vietnam, Indonesia), to a ban on banks facilitating Bitcoin transactions (e.g. Canada, Colombia, Jordan).