From f80aae42fb8eb5525727150a5fab2409b3a817ca Mon Sep 17 00:00:00 2001 From: dual-token-model Date: Thu, 12 Mar 2020 03:46:31 +0000 Subject: [PATCH] 0.0.4 --- README.md | 22 +++- dual-token-model.ipynb | 222 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 222 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 52af4e0..90da1d9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ # Dual Token Model -See the [ARTICLE](dual-token-model.ipynb) \ No newline at end of file +Dual token model is discussed in this article as an improvement of the token model for [neo](https://neo.org/) and [ontology](https://ont.io/) to solve the current dillemma of GAS (or ONG). + +Actually it is discussing gerneral dual token problems and it could be a reference for all dual token model blockchains not only for [neo](https://neo.org/) and [ontology](https://ont.io/). + +# How to Read + +## Jupyter + +You need to install [jupyter](https://jupyter.org/), clone or download the code, and then open `dual-token-model.ipynb` in jupyter. + +*Nothing is lost if you open the article in jupyter.* + +## Github Preview + +Follow the [LINK](dual-token-model.ipynb). + +*Figures are lost if you open the article in github preview.* + +## Github Release + +Follow the [LINK](https://github.com/vang1ong7ang/DualTokenModel/releases). diff --git a/dual-token-model.ipynb b/dual-token-model.ipynb index 53ab5ff..ce85817 100644 --- a/dual-token-model.ipynb +++ b/dual-token-model.ipynb @@ -53,7 +53,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "*In this article, it is focused on the token model instead of incentive model. So the detail of reward redistribution is ommited. For more detail about incentive model, see another article of mine (TODO: add link here)*" + "*In this article, it is focused on the token model instead of incentive model. So the detail of reward redistribution is ommited. For more detail about incentive model, see another article of mine (TODO: add link here).*" ] }, { @@ -67,7 +67,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "TODO" + "TODO: Difference between GP and NEO holder, Only GP get GAS" ] }, { @@ -105,6 +105,13 @@ "## Redistribution of Inflation GAS" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The reward weight rate $r$ is defined in the following expression and it is used in the redistribution of inflation of GAS to evaluate how much weight per NEO the specific governance participant has. The specific governance participant owns $g$ GAS and $n$ NEO. Then an $\\arctan$ function is attached to the proportion of GAS and NEO held by the participant and the proportion will be converged between $0$ and $\\frac{\\pi}{2}$. At last, the additional reward weight rate $S$ and the minimal reward weight rate $T$ is attached in a linear scale to adjust the basic reward rate and addtional reward rate." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -114,15 +121,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The following figure shows the relation between reward weight rate $r$ and proportion of GAS and NEO $\\frac{g}{n}$. Obviously the reward rate grows when the proportion of GAS and NEO grows. The growth rate of reward weight rate $r$ decreases when proportion of GAS and NEO $\\frac{g}{n}$ increases." + ] + }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 54, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f7aba10796fe41899ba48ffbe671f4c5", + "model_id": "fb37ecf099b841b8831c2481b6aae651", "version_major": 2, "version_minor": 0 }, @@ -148,19 +162,28 @@ "def draw(S, T):\n", " x = numpy.arange(0,100,0.001)\n", " y = S * numpy.arctan(x) + T\n", + " matplotlib.pyplot.xlabel('g/n')\n", + " matplotlib.pyplot.ylabel('r')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "It would be more clear if logarithmic scale is used to plot the relation between reward weight rate $r$ and proportion of GAS and NEO $\\frac{g}{n}$ in the follwing figure. It is pretty hard to increase reward weight rate $r$ a bit if proportion of GAS and NEO $\\frac{g}{n}$ is enough large." + ] + }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 55, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "08e09413e5184be2a381690f39c97358", + "model_id": "079b0c602862425f96ec577516e9dc94", "version_major": 2, "version_minor": 0 }, @@ -186,10 +209,19 @@ "def draw(S, T):\n", " x = numpy.arange(-8,8,0.001)\n", " y = S * numpy.arctan(10**x) + T\n", + " matplotlib.pyplot.xlabel('log(g/n)')\n", + " matplotlib.pyplot.ylabel('r')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The reward weight $w$ is defined as the production of the number of NEO $n$ held by the participant and its reward weight rate $r$." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -199,15 +231,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The following 3D figure shows the relation of the number of NEO $n$ and the number of GAS $g$ held by the participant and its reward weight rate $r$." + ] + }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 56, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5ff95d975a85433c83b1ee5480bf4539", + "model_id": "07e7997944124aeb9f948eaaab14eab0", "version_major": 2, "version_minor": 0 }, @@ -224,7 +263,7 @@ "import matplotlib\n", "import ipywidgets\n", "\n", - "%matplotlib notebook\n", + "%matplotlib inline\n", "\n", "S = ipywidgets.widgets.FloatSlider(min=0, max=4/numpy.pi, step=2/numpy.pi/10, value=2/numpy.pi)\n", "T = ipywidgets.widgets.FloatSlider(min=0, max=2, step=0.1, value=1)\n", @@ -239,6 +278,13 @@ " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As a result, the reward $e$ in GAS can be counted as the following expression where $I$ is the amount of inflation GAS, $V$ is all the governance participants and $w_i$ is the reward weight of governance participant $i$." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -259,7 +305,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "TODO" + "TODO: SPEND ARCTAN" ] }, { @@ -318,6 +364,13 @@ "Alice is a retial investor and she has totally some money for investment. She likes [neo](https://neo.org/) blockchain and she want to spend all her money to buy the native tokens on [neo](https://neo.org/) blockchain, a.k.a NEO and GAS. How many NEO coins should she buy and how many GAS coins should she buy? Which strategy should she use?" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By assuming Alice has $A$ dollars and $N$ is the price of NEO in dollar and $G$ is the price of GAS in dollar, the following expression is statemented because Alice spend all her money to buy NEO and GAS." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -327,6 +380,13 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Transform it into another form. The relation between $g$ and $n$ is shown:" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -336,15 +396,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "It is obvious that such relation is linear." + ] + }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 57, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0680f2e557704b77b26b67d91a8123a0", + "model_id": "db152a28ff1e4801abad902d324e25f3", "version_major": 2, "version_minor": 0 }, @@ -374,10 +441,19 @@ "def draw(S, T, A, G, N):\n", " x = numpy.arange(0.001,A/N,0.001)\n", " y = (A - x * N) / G\n", + " matplotlib.pyplot.xlabel('n')\n", + " matplotlib.pyplot.ylabel('g')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Then the relation between reward weight rate $r$ and number of NEO $n$ held by Alice can be calculated." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -387,15 +463,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The more NEO Alice buys, the less GAS Alice buys, then, the less reward weight rate $r$." + ] + }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 58, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "67ecab8c9f5644f2a75bd167d845df09", + "model_id": "d0216c6d66ad491785e0c46ef3d5949a", "version_major": 2, "version_minor": 0 }, @@ -425,10 +508,19 @@ "def draw(S, T, A, G, N):\n", " x = numpy.arange(0.001,A/N,0.001)\n", " y = S * numpy.arctan((A - x * N) / (x * G)) + T\n", + " matplotlib.pyplot.xlabel('n')\n", + " matplotlib.pyplot.ylabel('r')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The reward weight $w$ can be evaluated by multiplying the number of NEO $n$ held by Alice." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -438,15 +530,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The following figure shows the relation between reward weight $w$ and number of NEO $n$ bought by Alice. At first, reward weight $w$ grows when $n$ grows but later reward weight $w$ goes down." + ] + }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 59, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c1073dde4d8d4fad94b6f5fa2cb92fce", + "model_id": "e755ba6c6d9e42a0b8be292c01197574", "version_major": 2, "version_minor": 0 }, @@ -476,10 +575,19 @@ "def draw(S, T, A, G, N):\n", " x = numpy.arange(0.001,A/N,0.001)\n", " y = x * S * numpy.arctan((A - x * N) / (x * G)) + x * T\n", + " matplotlib.pyplot.xlabel('n')\n", + " matplotlib.pyplot.ylabel('w')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By assuming the total supply of NEO is $U$, the rate of $NEO$ which participated in blockchain governance is $R$ and the average reward weight per NEO is $W$, we have $\\sum_{i \\in V}{w_i} = U R W$. Then the relation between reward $e$ in GAS and reward weight $w$ can be evaluated as the following expression:" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -489,15 +597,22 @@ "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The relation between reward $e$ in GAS and amount of NEO $n$ bought by Alice can be shown in the following figure:" + ] + }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 60, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b42924c38a274c31bff2cdd1434fdd20", + "model_id": "229e67b0f350421089a01ed19e59940b", "version_major": 2, "version_minor": 0 }, @@ -533,28 +648,44 @@ " x = numpy.arange(0.001,A/N,0.001)\n", " y = x * S * numpy.arctan((A - x * N) / (x * G)) + x * T\n", " y = y * I / U / R / W\n", + " matplotlib.pyplot.xlabel('n')\n", + " matplotlib.pyplot.ylabel('e')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Then the rate of profit $p$ in dollar can be couted:" + ] + }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", - "r = \\frac{e G}{A}\n", + "p = \\frac{e G}{A}\n", "$$" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And the relation between rate of profit $p$ and amount of NEO $n$ bought by Alice can be drawn:" + ] + }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 61, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e5dae49d5dee418391102c83a4baa470", + "model_id": "9de4d6b503cf41d190dbfb720b0476eb", "version_major": 2, "version_minor": 0 }, @@ -591,10 +722,19 @@ " y = x * S * numpy.arctan((A - x * N) / (x * G)) + x * T\n", " y = y * I / U / R / W\n", " y = y * G / A\n", + " matplotlib.pyplot.xlabel('n')\n", + " matplotlib.pyplot.ylabel('p')\n", " matplotlib.pyplot.plot(x, y)\n", " matplotlib.pyplot.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As a result, the best strategy for Alice is to buy $n$ NEO to reach the highest rate of profit $p$." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -608,6 +748,46 @@ "source": [ "With the proposed solution in this article, the advantages of dual token economic model can be really activated. We hope the designers of blockchains can be inspired from this article and make their blockchain more sustainable." ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# The Appendix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Notation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "- $A$: the total money in dollar owned by the specific participant of neo governance\n", + "- $e$: reward in GAS\n", + "- $G$: price of GAS in dollar\n", + "- $g$: amount of GAS held by the specific participant of neo governance\n", + "- $I$: amount of inflation GAS\n", + "- $N$: price of NEO in dollar\n", + "- $n$: amount of NEO held by the specific participant of neo governance\n", + "- $p$: rate of profit in dollar\n", + "- $r$: reward weight rate\n", + "- $S$: additional reward weight rate\n", + "- $T$: minimal reward weight rate\n", + "- $V$: the set of all governance participant\n", + "- $w$: reward weight" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "@vang1ong7ang" + ] } ], "metadata": {