Contrary to the lessons of popular academia the barter system is largely a myth. In fact the modern economy as we have come to know it results from the system of debt. Trade was as a local practice of communities. Each community comprised of friends and family.
Every member of the community was expected to give to their neighbor when asked. And when the occasion arouse your neighbor was expected to reciprocate. This practice of giving to others can over whelm and strain resources. So in order to maintain balanced trade, and resource allocation an elaborate system of record keeping was created to track the indebtedness of others.