Building Bancor Simulations in Python — A Step by Step Explainer

Learn the fundamentals of Bancor protocol simulations

Mike Casale
CodeX
Published in
16 min readSep 2, 2022

--

Ai generated image created by author, inspired by artwork of Beau Stanton

Table of Contents

Introduction

\Image edited by author from source: https://github.com/bancorprotocol/research

At the most general level, a simulation is the imitation of a real-world process or system over time via use of a model; whereby the model represents the key characteristics or behaviors of the selected system or process, and the simulation represents the evolution of the model over time.

A simulator then, in this context, is a software that creates a virtual model —applications of which are common across industries, including in optimization tasks, safety engineering, testing, training and education, video game development, the scientific study of natural systems, and of course, in economics and decentralized finance (DeFi) where they are used to study complex human systems. While there are other types of simulations, throughout this blog we will focus only on the Monte Carlo Method of simulation— and it is suggested that interested readers review supplementary materials on the subject in order to gain a better understanding of the implementation.

Image from source: https://cs.wmich.edu/alfuqaha/Spring10/cs6910/lectures/Chapter1.pdf — shows a tree diagram of simulation model types.

At the application level, the simulation we describe herein uses an open-source python simulation software developed by Bancor Research. We take as our simulation subject a real-world Bancor DAO governance proposal. Our core focus, however, is less concerned with the specifics of this particular proposal than it is with providing a roadmap for how the simulator can be extended to include new functionality, based on any assumptions…

--

--