Barter Machine: An Autonomous, Distributed Barter Exchange on the Ethereum Blockchain




Barter, Token, Smart Contract, Ethereum, Autonomous


Direct bartering allows for the trading of assets with or without the use of money. In this paper, we introduce a smart contract written in the Solidity language for the Ethereum blockchain that implements a distributed and autonomous direct barter exchange operated by crowds. Since ERC20 smart contract tokens are widely used for initial coin offerings (ICOs), our implementation provides autonomous bartering services for ERC20 tokens. The non-fungible ERC721 token, as well as Ethereum Name Service (ENS) name bartering, are also supported. Because finding a feasible bartering solution for bids involving multiple tokens is NP-hard in general, our exchange only provides escrow and swapping services. It assumes feasible solutions are submitted by bartering problem solvers from the crowd who run a solver locally on their machines. Bartering problem solvers are incentivized to submit solutions to the autonomous exchange by awarding them with excess tokens that are left over after granting the bidders the tokens they requested in their bids. Our system, called BarterMachine, can perhaps be used to facilitate a global barter economy. The BarterMachine prototype is available for testing on the Ethereum Ropsten network at

Author Biography

Can Ozturan, Dept. of Computer Engineering Bogazici University Istanbul, Turkey

Can Ozturan is a faculty member at Bogazici University, Computer Engineering Department.


Abraham, D. J., Blum, A., Sandholm, T. “Clearing Algorithms for Barter Exchange Markets: Enabling Nationwide Kidney Exchanges.” In Proceedings of the 8th ACM Conference on Electronic Commerce ACM 295–304 (2007).

Bang-Jensen, J., Gutin, G. Digraphs: Theory, Algorithms and Applications, Second Edition. Springer 683-684 (2009).

Concourse Open Community. “Recommended Gas Prices in Gwei.” ETH Gas Station (accessed 21 May 2020)

Dezső, B., Jüttner, A., Kovács, P. “LEMON–An Open Source C++ Graph Template Library.” Electronic Notes in Theoretical Computer Science 264.5 23–45 (2011).

Dijkstra, E. W. “The Mathematics Behind the Banker’s Algorithm.” In Selected Writings on Computing: A Personal Perspective Springer 308–312 (1982).

Glorie, K. M., van de Klundert, J. J., Wagelmans, A. P. “Kidney Exchange with Long Chains: An Efficient Pricing Algorithm for Clearing Barter Exchanges with Branch-and-Price.” Manufacturing & Service Operations Management 16.4 498–512 (2014).

Goldberg, A. V. “An Efficient Implementation of a Scaling Minimum-Cost Flow Algorithm.” Journal of Algorithms 22.1 1–29 (1997).

Jevons, W. S. Money and the Mechanism of Exchange. New York: D. Appleton and Co. (1876).

No Author. “Gurobi Optimization.” Gurobi (accessed 21 May 2020)

No Author. “MetaMask.” MetaMask (accessed 21 May 2020)

No Author. “Solidity Documentation.” Solidity (accessed 21 May 2020)

No Author. “vis.js.” vis.js (accessed 21 May 2020)

Özer, A. H., Özturan, C. “A Direct Barter Model for Course Add/Drop Process.” Discrete Applied Mathematics 159.8 812–825 (2011).

Özturan, C. “On Finding Hypercycles in Chemical Reaction Networks.” Applied Mathematics Letters 21.9 881–884 (2008).

Özturan, C. “Resource Bartering in Data Grids.” Scientific Programming 12.3 155–168 (2004).

Özturan, C. “Used Car Salesman Problem: A Differential Auction–Barter Market.” Annals of Mathematics and Artificial Intelligence 44.3 255–267 (2005).

Szudzik, M. “An Elegant Pairing Function.” In NKS2006 Conference (2006)

Vogelsteller, F., Buterin, V. “ERC-20 Token Standard.” Github (accessed 21 May 2020)




How to Cite

Ozturan, C. (2020). Barter Machine: An Autonomous, Distributed Barter Exchange on the Ethereum Blockchain. Ledger, 5.



Research Articles