As society grew and became more complex, this arrangement was impractical. One of the innovations was the merchant who opened a general store. He stocked all the things the town might need. The farmers, traders, and homemakers went there to buy and trade items as required – cinnamon, sugar, boots, bread, coats, and canes. Still, they could carry out a barter of goods, but they had more options regarding the things they could buy.

From this, the merchant would find there was a specific commodity that had general acceptance in the community. Tobacco was money in Virginia during colonial times. In other places, you might see corn used as money. It all evolved from social norms. People found a particular item that served best for their community. Throughout history, gold and silver have fit nicely as a medium of exchange. Gold and silver are useful as money, and there are calls to have money that is backed by gold or silver.
We could certainly have electricity and energy backed money if people agreed to it. New types of money can come because of innovation. Airline miles are an example of this. Some tech-savvy teens and young adults use new forms of virtual money. Facebook was built on top of the virtual money system and is monetizing into traditional money later. In any case, society accepts using money as the medium of exchange.