The origin of money is due to the limited ability of humans to search for and produce their own needs so that they need from the work and property owned by others so that a pattern of life emerges that needs each other. Consequently there is an economic pattern that needs each other from the assets owned. It is this age that gives rise to a life of mutual exchange, including ownership of public property in order to fulfill their needs. This is what marks the transaction by means of barter, namely the creation of a legitimate exchange tool of a metal type.
Money is anything that is widely recognized as a medium of exchange, store of value and a measure of value.
Commodity money was the first type of money in existence. Gold and silver are universally recognized examples of commodity money.
Fiat money is money by decree. Anything can be fiat money like numbers of a computer, for example. Fiat money is created by a ruler making it legal tender, that is, demanding that taxes and fines be paid in it and making everyone who has an accounting obligation use it. For example, if I were tyrant, I could demand that bebbles having a very specific range of properties be brought to me on pain of death. It would take exactly as long as it took for the word to spread for the pebbles to become fiat money. Fiat money is ultimately backed by threats to commit acts of violence.