<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with Blockchain sorted by active.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2295861" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2575404" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2293868" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2574000" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2671593" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2603571" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2541870" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2351041" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2509971" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2443748" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2034411" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2475857" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2448827" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2313561" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1732698" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2452216" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2446648" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2398248" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2313877" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2317861" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2295861">
    <title>Cryptocurrencies: correlations, clustering and data analysis</title>
    <link>https://community.wolfram.com/groups/-/m/t/2295861</link>
    <description>*MODERATOR NOTE: Also see [blockchain integration][1] in the Wolfram Language, a part of [Wolfram Blockchain Labs][2].*&#xD;
&#xD;
  [1]: https://reference.wolfram.com/language/guide/Blockchain.html&#xD;
  [2]: https://www.wolframblockchainlabs.com&#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][4]&#xD;
&#xD;
&#xD;
&#xD;
  [DONT DELETE: Original Notebook]: https://www.wolframcloud.com/obj/ed6de398-4875-4040-b3cd-d36d285d9c59&#xD;
&#xD;
&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sdfq34fdasdfas34.jpeg&amp;amp;userId=20103&#xD;
  [4]: https://www.wolframcloud.com/obj/409f97e4-1aff-4160-9131-b7cc38d76ebf</description>
    <dc:creator>Anton Antonov</dc:creator>
    <dc:date>2021-06-22T17:48:33Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2575404">
    <title>[WSS22] Implementation of Interactive Zero Knowledge proofs paclet​</title>
    <link>https://community.wolfram.com/groups/-/m/t/2575404</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=heroImage.png&amp;amp;userId=2575178&#xD;
  [2]: https://www.wolframcloud.com/obj/0b78227f-10c0-4ceb-80af-85e106e898ae</description>
    <dc:creator>Armando Benjamín Cruz Hinojosa</dc:creator>
    <dc:date>2022-07-19T22:05:10Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2293868">
    <title>Cryptocurrencies: data acquisition with visualization</title>
    <link>https://community.wolfram.com/groups/-/m/t/2293868</link>
    <description>*MODERATOR NOTE: Also see [blockchain integration][1] in the Wolfram Language, a part of [Wolfram Blockchain Labs][2].*&#xD;
&#xD;
  [1]: https://reference.wolfram.com/language/guide/Blockchain.html&#xD;
  [2]: https://www.wolframblockchainlabs.com&#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][12]&#xD;
&#xD;
&#xD;
&#xD;
  [Original Notebook]: https://www.wolframcloud.com/obj/8a2ce9a8-eb16-4ec8-8ff7-ff3fd1d60516&#xD;
&#xD;
&#xD;
&#xD;
  [12]: https://www.wolframcloud.com/obj/018a6ebf-c7c2-4912-99fe-dd797dec2030</description>
    <dc:creator>Anton Antonov</dc:creator>
    <dc:date>2021-06-19T15:59:01Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2574000">
    <title>[WSS22] Proof of useful ruliad work</title>
    <link>https://community.wolfram.com/groups/-/m/t/2574000</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
Aknowledgements&#xD;
&#xD;
James Boyd, and Christopher Wolfram&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=cuckooSuccess03.jpg&amp;amp;userId=1964551&#xD;
  [2]: https://www.wolframcloud.com/obj/45c55de6-8a7b-4fd1-8932-2960de11795d</description>
    <dc:creator>Arturo Silva</dc:creator>
    <dc:date>2022-07-19T15:42:54Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2671593">
    <title>[WSG32] Daily Study Group: Blockchain: Exploring Blockchain Functionality</title>
    <link>https://community.wolfram.com/groups/-/m/t/2671593</link>
    <description>Hi Everyone! Our second Wolfram U daily study group on Blockchain Functionality begins on **November 14 - 18, 2022**.&#xD;
&#xD;
&amp;gt; [**REGISTER HERE**][1]&#xD;
&#xD;
Join myself [@Steph Macurdy][at0] and [@Leanne Ussher][at1] for an exploration into the world of blockchain ideas and ecosystems.&#xD;
&#xD;
Over the five days, we will recap some of the fundamentals from the first study group, dive into blockchain Governance, explore the Oracle Problem, discuss Mutual Credit Currencies, and round out the week with relevant news topics. For this fifth day, please bring a topic you found interesting so we can discuss!&#xD;
&#xD;
We encourage curiosity, exploration and a willingness to collaborate as we all learn about this new and innovative space together. Again, this is a basic introduction to blockchain, so no Wolfram Language knowledge is necessary as a prerequisite.&#xD;
&#xD;
If you&amp;#039;d like to get started learning Wolfram Language, try our Elementary Introduction [here][2]!&#xD;
&#xD;
Feel free to use this post as a way to collaborate and share ideas, materials and links to other information you find useful. I hope you&amp;#039;ll join us!&#xD;
&#xD;
![enter image description here][115]&#xD;
&#xD;
  [115]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUbanner.jpg&amp;amp;userId=20103&#xD;
&#xD;
&#xD;
  [1]: https://www.bigmarker.com/series/daily-study-group-exploring-blockchain-functionality/series_details?utm_bmcr_source=community&#xD;
  [2]: https://www.wolfram.com/language/elementary-introduction/2nd-ed/&#xD;
&#xD;
 [at0]: https://community.wolfram.com/web/stephen5&#xD;
&#xD;
 [at1]: https://community.wolfram.com/web/leanneu</description>
    <dc:creator>Steph Macurdy</dc:creator>
    <dc:date>2022-10-25T16:07:28Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2603571">
    <title>Bitcoin price prediction assuming oscillatory growth and lengthening cycles</title>
    <link>https://community.wolfram.com/groups/-/m/t/2603571</link>
    <description>*WOLFRAM MATERIALS for the ARTICLE:*&#xD;
&amp;gt; Wang, Guizhou and Hausken, Kjell (2022).&#xD;
&#xD;
&amp;gt; *A Bitcoin Price Prediction Model Assuming Oscillatory Growth and Lengthening Cycles*.&#xD;
&#xD;
&amp;gt; Cogent Economics and Finance 10(1), 2087287.&#xD;
&#xD;
&amp;gt; https://doi.org/10.1080/23322039.2022.2087287&#xD;
&#xD;
&amp;gt; [Full article in PDF][1]&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][3]&#xD;
&#xD;
&#xD;
  [1]: https://www.tandfonline.com/doi/pdf/10.1080/23322039.2022.2087287?needAccess=true&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Lead_Bitcoin_model.png&amp;amp;userId=20103&#xD;
  [3]: https://www.wolframcloud.com/obj/0037b2bf-e856-4593-aba0-d1bfa9f20da6</description>
    <dc:creator>Kjell Hausken</dc:creator>
    <dc:date>2022-08-23T14:53:20Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2541870">
    <title>[WSG26] Daily Study Group: Blockchain: A New Computing Paradigm</title>
    <link>https://community.wolfram.com/groups/-/m/t/2541870</link>
    <description>Hi Everyone! &#xD;
&#xD;
A Wolfram U daily study group on Blockchain Design begins on June 20 - July 1, 2022.&#xD;
&#xD;
[**REGISTER HERE**][1]&#xD;
&#xD;
Join myself [@Steph Macurdy][at0] and [@Leanne Ussher][at2] for an exploration into the world of blockchains. &#xD;
&#xD;
The first week is a conceptual introduction to blockchains and it will serve as a high level overview of the key areas to understand. The second week will serve as a general reframing of what blockchain technology can be and how to think about it from the perspective of different economic frameworks.&#xD;
&#xD;
We encourage curiosity, exploration and a willingness to collaborate as we all learn about this new and innovative space together. This is a basic introduction to blockchain, so no Wolfram Language knowledge is necessary as a prerequisite. &#xD;
&#xD;
If you&amp;#039;d like to get started learning Wolfram Language, try our Elementary Introduction [here][2]!&#xD;
&#xD;
Feel free to use this post as a way to collaborate and share ideas, materials and links to other information you find useful. I hope you&amp;#039;ll join us! &#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
&#xD;
 [at0]: https://community.wolfram.com/web/stephen5&#xD;
 [at2]: https://community.wolfram.com/web/leanneu&#xD;
&#xD;
&#xD;
  [1]: https://wolfr.am/BlockchainSG&#xD;
  [2]: https://www.wolfram.com/language/elementary-introduction/2nd-ed/&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUbanner.jpg&amp;amp;userId=20103</description>
    <dc:creator>Steph Macurdy</dc:creator>
    <dc:date>2022-06-02T00:18:54Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2351041">
    <title>Multiple errors while using MintNFT[ ]?</title>
    <link>https://community.wolfram.com/groups/-/m/t/2351041</link>
    <description>Has anyone been able to get the MintNFT function to work? I&amp;#039;m pretty much using exactly the code from &#xD;
&#xD;
https://resources.wolframcloud.com/FunctionRepository/resources/MintNFT&#xD;
&#xD;
but I get this when I call the actual minting function: &#xD;
&#xD;
&amp;gt;    Select::normal: Nonatomic expression expected at position 1 in &#xD;
&#xD;
    Select[ServiceConnections`Private`$authenticatedservices,ServiceConnections`Private`serviceName[#1]===IPFS&amp;amp;].&#xD;
&#xD;
and also &#xD;
&#xD;
&amp;gt;    ExternalStorageUpload::multser: One service was chosen from multiple name services.&#xD;
&#xD;
Any advice?</description>
    <dc:creator>William Doyle</dc:creator>
    <dc:date>2021-08-25T01:56:03Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2509971">
    <title>Using Mathematica to generalize Alpha Finance formula for fair LP pricing</title>
    <link>https://community.wolfram.com/groups/-/m/t/2509971</link>
    <description>This post will illustrate how to use computer algebra systems (in particular, Mathematica) for solving a security problem in DeFi, that is, the &amp;#034;safe&amp;#034; computation of prices of LP tokens.  &#xD;
&#xD;
This post may interest the following audience:&#xD;
&#xD;
1. Developers interested in creating new lending protocols that accept LP tokens (that are more complex than Uniswap) as collateral;&#xD;
2. Mathematica-users (or other CAS-users) that are curious about applications of these tools to DeFi.&#xD;
&#xD;
## Introduction&#xD;
&#xD;
Automated market makers (AMMs) are smart contracts that helps users to swap between assets without using the traditional approach of order books. First popularized by Uniswap, AMMs are a fundamental piece of decentralized finance (DeFi), and many types of AMMs exist today.&#xD;
&#xD;
In the literature, AMMs is also known as constant function market makers (CFMMs).  The reason for this name comes from their use of an invariant **trading function**:&#xD;
&#xD;
&amp;gt; &amp;#034;CFMMs use a single rule that determines whether or not a proposed trade is accepted.&#xD;
The rule is based on evaluating a *trading function*, which depends on the proposed trade and&#xD;
the current reserves of the CFMM. A proposed trade is accepted if the value of the trading&#xD;
function at the post-trade reserves (with a small correction for the trading fee) equals the&#xD;
value at the current reserves, i.e., the function is held constant.&amp;#034; - From Angeris, Guillermo, et al. &amp;#034;*[Constant function market makers: Multi-asset trades via convex optimization](https://arxiv.org/abs/2107.12484)*.&amp;#034; arXiv preprint [2107.12484](https://arxiv.org/abs/2107.12484) (2021).&#xD;
&amp;gt; &#xD;
&#xD;
For example, Uniswap uses the trading function &#xD;
&#xD;
$ \varphi(r_1,r_2)=r_1r_2 $&#xD;
&#xD;
while Balancer uses the trading function&#xD;
&#xD;
$ \varphi(r_1,r_2,\ldots,r_n)=r_1^{w_1} r_2^{w_2}\cdots r_n^{w_n} $&#xD;
&#xD;
where $r_i$ is the amount of reserves of the *i*-th token. &#xD;
&#xD;
(Other examples and more details can be seen in the excellent article from Angeris et. al.)&#xD;
&#xD;
## Pricing of LP tokens&#xD;
&#xD;
The reserves of CFMMs are created by users interested in gaining a fraction of the trading fee, and in some cases, some bonus assets. In particular, every time liquidity is added to a CFMM, most implementations give the user a *liquidity provider* (LP) token representing the user&amp;#039;s share of the pool. &#xD;
&#xD;
In the spirit of DeFi composability, lending protocols such as Warp Finance accepts these LP tokens as collateral for borrowing other assets. Thus, it is essential to have a method to price LP tokens in order to know if the collateral should be liquidated or not.&#xD;
&#xD;
Let *LPP* denotes the price of the LP token. A naive method for pricing the LP token is given by &#xD;
&#xD;
$ LPP = \frac{TVL}{TS} =\frac{\sum_{i=1}^{n} r_i p_i}{TS} $&#xD;
&#xD;
where:&#xD;
&#xD;
- TVL is the total value locked;&#xD;
- TS is the total supply of the token;&#xD;
- $r_i$ is the amount of reserves of the *i*-th token;&#xD;
- $p_i$ is the basis price (e.g. in USD) of the *i*-th token and&#xD;
- $n$ is the total number of different assets in the pool.&#xD;
&#xD;
While simple, this pricing method is vulnerable to manipulations: an attacker could use a flash loan to swap a gigantic quantity of tokens and, consequently, manipulate *LPP* by changing the reserve $r_i$  of one of the assets. For more details you can see the through explanation on [Christoph Michel&amp;#039;s blog](https://cmichel.io/pricing-lp-tokens/).&#xD;
&#xD;
To mitigate this attack vector, Alpha Finance introduced the notion of [fair Uniswap LP pricing](https://blog.alphafinance.io/fair-lp-token-pricing/). Briefly, the idea is to use Uniswap invariant *K* and the prices (which is assumed to come from a secure oracle - an assumption that we can&amp;#039;t always assume to be true) to estimate the price of LP token instead of the reserves. Since *K* isn&amp;#039;t changed when the token is swapped and the price comes from an oracle (supposedly secure), it mitigates attacks caused by swapping tokens.&#xD;
&#xD;
Could this &amp;#034;fairness&amp;#034; be generalized to more complex CFMMs, such as Balancer pools for multiple tokens? Yes, and moreover: if the trading function (or a power of it) is polynomial, formulas can be obtained automatically using computational algebra systems, and in particular, using Groebner basis.&#xD;
&#xD;
## Groebner basis and LP fair price&#xD;
&#xD;
If you studied linear algebra, you may recall that one way to solve a system of linear equations is to transform the system into a matrix and use the Gaussian elimination algorithm to put the system in a triangular form. One of the advantages of this method is that even if the solution of the system is not unique, this algorithm yields expressions that is *simple to isolate one variable in function of others*.&#xD;
&#xD;
A similar algorithm exists for systems of polynomial equations: introduced in 1965 by Bruno Buchberger in his Ph.D. thesis, [Buchberger&amp;#039;s algorithm](https://en.wikipedia.org/wiki/Buchberger%27s_algorithm) generalizes Gaussian elimination and computes a system of equations that is equivalent to the system of the original equations. The system obtained from Buchberger&amp;#039;s algorithm, however, is much simpler, and it is the analogue of the triangular form resulting from Gaussian elimination.&#xD;
&#xD;
&#xD;
----------&#xD;
**Remark**&#xD;
&#xD;
Formally, the system obtained by Buchberger&amp;#039;s algorithm is made by **Groebner basis** for (*the ideal generated by the polynomials from*) the original system. Other algorithms for computation of these basis exist, such as [Faugere&amp;#039;s F4 and F5 algorithm](https://en.wikipedia.org/wiki/Faug%C3%A8re%27s_F4_and_F5_algorithms).&#xD;
&#xD;
An excellent, self-contained book about this topic is &amp;#034;*Ideals, varieties and algorithms*&amp;#034; from David Cox, Donal O&amp;#039;Shea and John Little.&#xD;
&#xD;
----------&#xD;
&#xD;
![Buchberger&amp;#039;s algorithm][1]&#xD;
&#xD;
How can this algorithm be applied to get fair LP pricing formulas? We will illustrate using Mathematica and a weighted Balancer pool of 3 tokens as an example. For simplifying, we will admit that the fee of pool is 0. &#xD;
&#xD;
Consider a pool whose trading function (in other words, its invariant) is given by:&#xD;
&#xD;
$ \varphi(r_1,r_2,r_3)=r_1^{1/3} r_2^{1/3}r_3^{1/3} $&#xD;
&#xD;
The **spot price** (or **mid-price**) $s_{ij}$ is the price at which you could *theoretically* trade an infinitesimal amount of token *i* for token *j*. For example, suppose that $\Delta r_1$ amounts of token 1 is sent to the pool in order to receive $\Delta r_3$ amounts of token 3. In order to satisfy the invariant function, we will have that &#xD;
&#xD;
$ (r_1+\Delta r_1)^{1/3}r_2^{1/3}r_3^{1/3}=r_1^{1/3}r_2^{1/3}(r_3-\Delta r_3)^{1/3} $&#xD;
&#xD;
This equation can be rewritten as&#xD;
&#xD;
$ \begin{equation}&#xD;
\frac{\Delta r_3}{\Delta r_1} = \frac{r_3}{r_1 + \Delta r_1}&#xD;
\end{equation} $&#xD;
&#xD;
As $\Delta r_1$ approximates 0, we have that the spot price $s_{13}$ is given by &#xD;
&#xD;
$ s_{13} = \frac{\Delta r_3}{\Delta r_1} = \frac{r_3}{r_1} $&#xD;
&#xD;
&#xD;
----------&#xD;
**Remark**&#xD;
&#xD;
It is possible to calculate $s_{ij}$ systematically with computer algebra systems such as Mathematica. In Angeris, Guillermo et. al. is possible to find how to derive the following formula:&#xD;
&#xD;
$ s_{ij} = \frac{[\nabla\varphi]_i}{[\nabla\varphi]_j} $&#xD;
&#xD;
In our particular example,&#xD;
&#xD;
$ \nabla\varphi(r_1,r_2,r_3)= \left(\frac{r_{2}^{1/3}r_{3}^{1/3}}{3r_{1}^{2/3}},\frac{r_{1}^{1/3}r_{3}^{1/3}}{3r_{2}^{2/3}},\frac{r_{1}^{1/3}r_{2}^{1/3}}{3r_{3}^{2/3}}\right)&#xD;
$&#xD;
&#xD;
----------&#xD;
&#xD;
Supposing a no-arbitrage situation, the basis prices $p_{i}$ in USD and the spot price **approximately** satisfy $p_i = s_{ij} p_j$. In summary, we have the following system of polynomial equations for our example:&#xD;
&#xD;
$ \begin{align}&#xD;
p_{1} - s_{13}p_{3} &amp;amp;= 0 \\&#xD;
p_{2} - s_{23}p_{3} &amp;amp;= 0  \\&#xD;
\varphi - K &amp;amp;= 0&#xD;
\end{align} $&#xD;
&#xD;
where *K* is the current invariant on the pool (which, usually, can be retrieved by communicating with its contract). We will use Mathematica, a [Computer Algebra System](https://en.wikipedia.org/wiki/Computer_algebra_system) (CAS), to describe these system of equations and Groebner basis to solve them:&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
The outputs of this command are Groebner basis: an expression that when it is equal to 0 is equivalent to our polynomial equations above, but easier to solve. Indeed, solving for each $r_i$ we obtain:&#xD;
&#xD;
$ r_1 = K \frac{p_2^{1/3}p_3^{1/3}}{p_1^{2/3}}, \, &#xD;
r_2 = K \frac{p_1^{1/3}p_3^{1/3}}{p_2^{2/3}}, \, &#xD;
r_3 = K \frac{p_1^{1/3}p_2^{1/3}}{p_3^{2/3}} $&#xD;
&#xD;
&#xD;
----------&#xD;
**Remark**&#xD;
&#xD;
Note that Mathematica outputs two Groebner basis for each command: in our case both are equivalent since it is assumed that $r_i &amp;gt; 0$. &#xD;
&#xD;
----------&#xD;
&#xD;
Finally, replacing the values of the LP price formula give us the fair price of the LP token:&#xD;
&#xD;
$ LPP &#xD;
=\frac{\sum_{i=1}^{n} r_i p_i}{TS}&#xD;
=\frac{3Kp_1^{1/3}p_2^{1/3}p_3^{1/3}}{TS}&#xD;
$&#xD;
&#xD;
To illustrate how this formula protects against flash loans (or whale movements) consider the weighted pool 33% DPI/33% WBTC/33% WETH, which the current state during the writing was approximately:&#xD;
![Example of Balancer pool][3]&#xD;
&#xD;
![Table of prices][4]&#xD;
&#xD;
The [LP token](https://etherscan.io/address/0x61d5dc44849c9c87b0856a2a311536205c96c7fd#code) price can be estimated as:&#xD;
&#xD;
$ \begin{align*}&#xD;
LPP &#xD;
&amp;amp; =\frac{\sum_{i=1}^{n} r_i p_i}{TS} \\&#xD;
&amp;amp; =\frac{2997.07\times5.9755\times10^{18}       +44036.31\times0.4021\times10^{8}      +168.98\times103.0985\times10^{18}}{&#xD;
18.409563611131742132\times10^{18}&#xD;
} \\&#xD;
&amp;amp;\approx 1920.06 \text{ USD}&#xD;
\end{align*} $&#xD;
&#xD;
If a whale (or an user using a flash-loan) swaps almost all WETH from the pool by DPI, say $\Delta r_{3} = 0.9r_{3} = 5.37\text{ WETH}$, then equation (1) implies that $\Delta r_1=9r_1=927.81\text{ DPI}$. Immediately after the swap, the new LP token price ($LPP_+$) will be:&#xD;
&#xD;
- under the vulnerable formula&#xD;
&#xD;
$ \begin{align*}&#xD;
LPP_+ &#xD;
&amp;amp;=\frac{10r_1p_1+r_2p_2+0.1r_3p_3}{TS} \\&#xD;
&amp;amp;=\frac{10\times2997.07\times5.9755\times10^{18}       +44036.31\times0.4021\times10^{8}      +0.1\times168.98\times103.0985\times10^{18}}{&#xD;
18.409563611131742132\times10^{18}&#xD;
} \\&#xD;
&amp;amp;\approx 9560.79\text{ USD},&#xD;
\end{align*} $&#xD;
&#xD;
almost 5x the original price.&#xD;
&#xD;
- under the fair-price formula, however,&#xD;
&#xD;
$ \begin{align*}&#xD;
LPP_+ &#xD;
&amp;amp;=&#xD;
\frac{3[(10r_1)^{1/3} r_2^{1/3}(0.1r_3)^{1/3}]p_1^{1/3}p_2^{1/3}p_3^{1/3}}{TS} \\&#xD;
&amp;amp;=\frac{3[r_1^{1/3} r_2^{1/3}r_3^{1/3}]p_1^{1/3}p_2^{1/3}p_3^{1/3}}{TS}  \\&#xD;
&amp;amp;=\frac{3Kp_1^{1/3}p_2^{1/3}p_3^{1/3}}{TS} = LPP&#xD;
\end{align*} $&#xD;
&#xD;
stays the same, as $K$ and the prices (immediately after) is unchanged by the swap.&#xD;
&#xD;
&#xD;
----------&#xD;
**Warning** &#xD;
The text presented here does not prove that the fair pricing formula assures protection against hacks that could be caused by adding/removing a great quantity of liquidity in the pool - this will be further analyzed in another time and in another article.&#xD;
&#xD;
----------&#xD;
&#xD;
## Conclusion&#xD;
&#xD;
In this article we saw how to use a Computer Algebra System (CAS) to automatically generate fair pricing formulas for protocols that needs to price a collateral asset. Further research could be done to automatically generate Solidity code based on the trading function of the pools. Indeed, as more complex DeFi protocols are launched, tools such as Groebner basis computation with CAS could turn out to be a useful tool for automating integrations, and consequently, easing interoperability between protocols.&#xD;
&#xD;
## References&#xD;
&#xD;
1. Alpha Finance&amp;#039;s blog: [Fair Uniswap&amp;#039;s LP Token Pricing](https://blog.alphafinance.io/fair-lp-token-pricing/)&#xD;
&#xD;
2. Christoph Michel&amp;#039;s blog: [Pricing LP tokens | Warp Finance hack](https://cmichel.io/pricing-lp-tokens/)&#xD;
&#xD;
3. Angeris, Guillermo, et al. &amp;#034;*[Constant function market makers: Multi-asset trades via convex optimization](https://arxiv.org/abs/2107.12484)*.&amp;#034; arXiv preprint [2107.12484](https://arxiv.org/abs/2107.12484) (2021).&#xD;
&#xD;
4. Cox, David, John Little, and Donal O&amp;#039;Shea. *Ideals, varieties, and algorithms: an introduction to computational algebraic geometry and commutative algebra*. Springer Science &amp;amp; Business Media, 2013.&#xD;
&#xD;
## Acknowledgements&#xD;
&#xD;
I would like to give a special thanks to [Mikko Ohtama][5] and [André Pereira][6] for kindly reviewing this post and for their helpful suggestions.&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=buchberger_algorithm.png&amp;amp;userId=1347162&#xD;
  [2]: https://www.wolframcloud.com/obj/a973dbaf-77d8-4349-bf75-f931b35149b5&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=balancer_pool.png&amp;amp;userId=1347162&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=token_table.png&amp;amp;userId=1347162&#xD;
  [5]: https://github.com/miohtama&#xD;
  [6]: https://github.com/aphenriques</description>
    <dc:creator>Hugo Kussaba</dc:creator>
    <dc:date>2022-04-13T22:59:07Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2443748">
    <title>[WIS22] Cryptocurrency price prediction with recurrent neural networks</title>
    <link>https://community.wolfram.com/groups/-/m/t/2443748</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/5982ed6e-59ad-4725-a71c-40f530d93288</description>
    <dc:creator>Shivay Nagpal</dc:creator>
    <dc:date>2022-01-12T23:06:18Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2034411">
    <title>[WSC20] Creating graphs of Bitcoin transactions</title>
    <link>https://community.wolfram.com/groups/-/m/t/2034411</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/4badf553-32a5-4035-82c8-fcfc5449c929</description>
    <dc:creator>Egor Bugaev</dc:creator>
    <dc:date>2020-07-15T20:08:18Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2475857">
    <title>Weather, BTC price and crypto farm earnings</title>
    <link>https://community.wolfram.com/groups/-/m/t/2475857</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/e679c7c5-f99d-4825-b350-f5296506223b</description>
    <dc:creator>Maksim Bober</dc:creator>
    <dc:date>2022-02-20T02:25:08Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2448827">
    <title>Electrum Anatomy &amp;#x2014; a glowing metallic NFT</title>
    <link>https://community.wolfram.com/groups/-/m/t/2448827</link>
    <description>[![enter image description here][1]][2]&#xD;
&#xD;
I recently joined in the fun of making an NFT and created the art set &amp;#039;Electrum Anatomy&amp;#039;. It can be found on OpenSea here: https://opensea.io/collection/electrum-anatomy.&#xD;
&#xD;
This collection contains images of various anatomical systems of human, horse, and dog -- all obtained through [AnatomyData](https://reference.wolfram.com/language/ref/AnatomyData.html). The aesthetic is low-polygon, metallic, glowing, and a touch of a vaporwave color scheme. For each species, the collection contains separate images of bones, channels, muscles, and organs.&#xD;
&#xD;
In this post I&amp;#039;d like to walk you through how these images were created, but first here&amp;#039;s a few select images from the collection (click for higher resolution):&#xD;
&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=electrum_human_bones.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;720&amp;#034;&amp;gt;&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=electrum_human_organs.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;720&amp;#034;&amp;gt;&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=electrum_horse_bones.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;720&amp;#034;&amp;gt;&#xD;
&#xD;
------------&#xD;
&#xD;
I&amp;#039;ll walk through a simple example of rendering a gold skull with glowing eyes. The images listed on OpenSea have a few extra details and nuances that I&amp;#039;ll gloss over in this post.&#xD;
&#xD;
## Obtaining anatomical data&#xD;
&#xD;
Obtaining the 3D anatomical data was quite easy. A simple property lookup:&#xD;
&#xD;
    skull = Entity[&amp;#034;AnatomicalStructure&amp;#034;, &amp;#034;Skull&amp;#034;][&amp;#034;MeshRegion&amp;#034;]&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at7.33.51PM.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;360&amp;#034;&amp;gt;&#xD;
&#xD;
## Downsampling a mesh&#xD;
&#xD;
The aesthetic I was after called for low-polygon meshes, so the next task was to simplify the meshes from AnatomyData. For this I implemented a bare-bones (pun intended) version of the algorithm presented in [Surface Simplification Using Quadric Error Metrics, Garland et.al.](http://www.cs.cmu.edu/~garland/Papers/quadrics.pdf) The function, `decimateMesh`, takes in a mesh and the number of vertices to contract from the mesh. I plan to submit this to WFR once I flush out more details like handling boundaries differently, always preserving topology, and an optional bias to simplify planar regions less. I&amp;#039;ve attached the code for `decimateMesh` below.&#xD;
&#xD;
Here&amp;#039;s a simple example. Let&amp;#039;s contract 2650 vertices from a triceratops model:&#xD;
&#xD;
    mr = ExampleData[{&amp;#034;Geometry3D&amp;#034;, &amp;#034;Triceratops&amp;#034;}, &amp;#034;MeshRegion&amp;#034;];&#xD;
    mr2 = decimateMesh[mr, 2650];&#xD;
&#xD;
We went from 5660 triangles to only 360:&#xD;
&#xD;
    MeshCellCount /@ {mr, mr2}&#xD;
    (* {{2832, 8490, 5660}, {182, 540, 360}} *)&#xD;
&#xD;
And a visual comparison:&#xD;
![enter image description here][3]&#xD;
&#xD;
Let&amp;#039;s contract 96% of the skull&amp;#039;s vertices to give it that low-poly feel:&#xD;
&#xD;
    dskull = decimateMesh[skull, Scaled[0.96]]&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at7.36.07PM.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;360&amp;#034;&amp;gt;&#xD;
&#xD;
## Glowing eyes&#xD;
&#xD;
To make glowing eyes, I first took a `RadialGradientImage`, then clipped, rescaled, and blurred it. Finally I colored it cyan, all while preserving an appropriate alpha channel:&#xD;
&#xD;
    clip = 0.9;&#xD;
    grad = RadialGradientImage[{White, GrayLevel[0.8], Gray, Black, Black, Black}];&#xD;
    grad2 = Blur[ImageAdjust[(Clip[grad, {0, clip}, {0, clip + .05}]/clip)^1.5]];&#xD;
&#xD;
    geye = SetAlphaChannel[ImageMultiply[grad2, Cyan], grad]&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at7.55.16PM.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;240&amp;#034;&amp;gt;&#xD;
&#xD;
## Rendering&#xD;
&#xD;
[MaterialShading](https://reference.wolfram.com/language/ref/MaterialShading.html) was used to render each 3D object over a black background. For the muscle and organ images, each object was randomly shaded with one of &#xD;
&#xD;
    {&amp;#034;Aluminum&amp;#034;, &amp;#034;Brass&amp;#034;, &amp;#034;Bronze&amp;#034;, &amp;#034;Copper&amp;#034;, &amp;#034;Electrum&amp;#034;, &amp;#034;Gold&amp;#034;, &amp;#034;Iron&amp;#034;, &amp;#034;Pewter&amp;#034;, &amp;#034;Silver&amp;#034;}&#xD;
&#xD;
Once rasterized, [ImageCompose](https://reference.wolfram.com/language/ref/ImageCompose.html) was used to overlay the glowing eyes.&#xD;
&#xD;
    gskull = Graphics3D[&#xD;
      GraphicsComplex[&#xD;
        MeshCoordinates[dskull],&#xD;
        {MaterialShading[&amp;#034;Gold&amp;#034;], MeshCells[dskull, 2, &amp;#034;Multicells&amp;#034; -&amp;gt; True]}&#xD;
      ],&#xD;
      Background -&amp;gt; Black,&#xD;
      Boxed -&amp;gt; False,&#xD;
      ImageSize -&amp;gt; 700,&#xD;
      Lighting -&amp;gt; &amp;#034;ThreePoint&amp;#034;,&#xD;
      ViewPoint -&amp;gt; {0, -100, 0},&#xD;
      ViewVertical -&amp;gt; {0, 0, 1}&#xD;
    ];&#xD;
&#xD;
    imskull = Rasterize[gskull, Background -&amp;gt; None];&#xD;
&#xD;
    imskulleyes = ImageCompose[&#xD;
      ImageCompose[&#xD;
        imskull, &#xD;
        ImageResize[geye, Scaled[5]], &#xD;
        Scaled[{.3, .44}]&#xD;
      ], &#xD;
      ImageResize[geye, Scaled[5]], &#xD;
      Scaled[{.7, .44}]&#xD;
    ];&#xD;
&#xD;
    RemoveAlphaChannel[imskulleyes]&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at8.09.48PM.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;360&amp;#034;&amp;gt;&#xD;
&#xD;
## Glowing background&#xD;
&#xD;
The glowing background was obtained by simply blurring the alpha mask and coloring it gold.&#xD;
&#xD;
    mask = FillingTransform[AlphaChannel[imskulleyes2]];&#xD;
    blur = Blur[mask, 1000];&#xD;
    bg = ImageMultiply[ImageAdjust[blur, {0, 0, 0.75}], ColorData[&amp;#034;HTML&amp;#034;][&amp;#034;Gold&amp;#034;]];&#xD;
    bg = ImageMultiply[bg, ColorNegate[mask]];&#xD;
&#xD;
    skullfinal = ImagePad[ImageCompose[bg, imskulleyes2], {{-200, -200}, {-600, -600}}]&#xD;
&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at8.20.39PM.png&amp;amp;userId=46025&amp;#034; width=&amp;#034;720&amp;#034;&amp;gt;&#xD;
&#xD;
------------&#xD;
&#xD;
## Happy NFTing!&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][4]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=electrum_anatomy_banner.jpg&amp;amp;userId=11733&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=electrum_anatomy_banner.png&amp;amp;userId=46025&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-17at7.48.18PM.png&amp;amp;userId=46025&#xD;
  [4]: https://www.wolframcloud.com/obj/ecb9473c-25eb-4c6f-b95c-78cdd759cf8e</description>
    <dc:creator>Greg Hurst</dc:creator>
    <dc:date>2022-01-18T01:53:41Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2313561">
    <title>[WSS21] NFT professional credentials</title>
    <link>https://community.wolfram.com/groups/-/m/t/2313561</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Certificateofachievement.jpg&amp;amp;userId=2313541&#xD;
  [2]: https://www.wolframcloud.com/obj/d2971848-7006-4297-996e-e456f6fbc09a</description>
    <dc:creator>Joan Soler-Vidal</dc:creator>
    <dc:date>2021-07-14T01:13:28Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1732698">
    <title>[WSC19] Machine Learning Optimal Cryptocurrency Portfolio from Blockchain</title>
    <link>https://community.wolfram.com/groups/-/m/t/1732698</link>
    <description>Abstract&#xD;
--------&#xD;
&#xD;
Cryptocurrency values are notoriously unpredictable with traditional financial approaches, which is why they are known as volatile. However, just like any other stock, cryptocurrency values are driven by supply and demand. One of the best ways to look at a cryptocurrencys supply and demand is by examining the cryptocurrencys blockchain data. The goal of this project was to utilize historical blockchain activity to construct a machine learning algorithm that would be able to optimize intraday cryptocurrency portfolio allocations. &#xD;
&#xD;
Structure&#xD;
---------&#xD;
&#xD;
The first part of the project was to create a program that would find the optimized portfolio of just Ethereum and Bitcoin for the current date that the code was executed. The optimization would be done so that the user would be investing with the maximum expected return with a minimal risk, which would be computed with the Sharpe Ratio. &#xD;
&#xD;
The second part was to create a manipulate of the optimized portfolio to show to a user that the optimized portfolio&amp;#039;s weights for the cryptocurrencies could not be beat. The manipulate was then opened up so that the user could change the circumstances of the program and the optimized portfolio would show the optimum weights of the cryptocurrencies. &#xD;
&#xD;
Following that, historical blockchain data would be collected for optimized portfolios to be inputted into a neural network to attempt to predict future bitcoin return rates, which would then be used to compute an optimal portfolio. However, we will see later why this approach failed and why another approach was more successful.&#xD;
&#xD;
Computing Optimized Portfolio:&#xD;
------------------------------&#xD;
&#xD;
To collect Bitcoin and Ethereums historical values, the FinancialData and TimeSeriesResample functions were used to collect the data and remove data from dates that were not common amongst both cryptocurrencies.&#xD;
&#xD;
    portfolio = {&amp;#034;BTC&amp;#034;, &amp;#034;ETH&amp;#034;};&#xD;
    data = FinancialData[#, {{2010}, {2020}}] &amp;amp; /@ portfolio;&#xD;
    data = TimeSeriesResample[{data[[1]], data[[2]]}, &amp;#034;Intersection&amp;#034;];&#xD;
&#xD;
The optimization function will require the historical return rates of both Bitcoin and Ethereum, the Standard Deviation of both Bitcoin and Ethereum, and the correlation between the 2 cryptocurrencies. These can all be calculated using functions in the Wolfram Language.&#xD;
&#xD;
    returns = Differences@*Log /@ data[[All, All, 2]];&#xD;
    btcSD = StandardDeviation[returns[[1]]] ;&#xD;
    ethSD = StandardDeviation[returns[[2]]];&#xD;
    correlated = Correlation[returns[[1]], returns[[2]]];&#xD;
&#xD;
Detour: What is correlation? Why is it important?&#xD;
-------------------------------------------------&#xD;
![Correlation between Ethereum and Bitcoin][1]&#xD;
&#xD;
In the above graph, we can clearly see that Ethereum and Bitcoin values fluctuate in similar patterns, which is what correlation refers to. Optimization requires taking into account correlation to better determine how risky it is to invest.&#xD;
&#xD;
Continuing on!&#xD;
--------------&#xD;
&#xD;
The next step is to create a function called optimize that takes the parameters: Bitcoin return rate, Ethereum return rate, Bitcoin Standard Deviation, Ethereum Standard Deviation, and Correlation between the 2 cryptocurrencies. The function optimize will use NMaximize, which is a Wolfram function, to calculate a weight for Bitcoin that will maximize the Sharpe Ratio, which refers to safe an investment is estimated to be. The allocation of funds to Bitcoin is represented by the variable weight, and the allocation of funds for Ethereum is represented by (1 - weight).&#xD;
&#xD;
    optimize[btcreturn_, ethreturn_, btcsd_, ethsd_, correlation_] :=&#xD;
     NMaximize[{Sqrt[252] (weight*btcreturn + (1 - weight)*ethreturn)/&#xD;
         Sqrt[btcsd^2*weight^2 +&#xD;
           ethsd^2*(1 - weight)^2 + (2*correlation*btcsd*ethsd)*&#xD;
            weight*(1 - weight)], 1 &amp;gt;= weight &amp;gt;= 0}, weight]&#xD;
&#xD;
Now we can calculate the optimized portfolio for today.&#xD;
&#xD;
    optimize[Mean[returns[[1]]],&#xD;
     Mean[returns[[2]]], btcSD, ethSD, correlated]&#xD;
&#xD;
Now, everything can be easily wrapped up into a manipulate that allows a user to change the circumstances of the optimization function, all while showing the optimized portfolio live. &#xD;
&#xD;
    Manipulate[&#xD;
     Sqrt[252.] (weight*btcreturn + (1 - weight)*ethreturn)/&#xD;
        Sqrt[btcsd^2*weight^2 +&#xD;
          ethsd^2*(1 - weight)^2 + (2*correlation*btcsd*ethsd)*&#xD;
           weight*(1 - weight)] -&amp;gt; (optimize[btcreturn, ethreturn, btcsd,&#xD;
        ethsd, correlation]), {weight, 0,&#xD;
      1}, {{btcreturn, Mean[returns[[1]]]}, 0,&#xD;
      1}, {{ethreturn, Mean[returns[[2]]]}, 0, 1}, {{btcsd, btcSD}, 0,&#xD;
      1}, {{ethsd, ethSD}, 0, 1}, {{correlation, correlated}, 0, 1}]&#xD;
&#xD;
Collect Data for Machine Learning&#xD;
---------------------------------&#xD;
&#xD;
To collect data for machine learning, we must import Bitcoins transaction history and format it to work correctly as a TimeSeries. The variable BTCtransData below contains the formatted data. The data that is used is originally from Bitcoinity, but is being imported from my GitHub for this project.&#xD;
&#xD;
    BTCtransData =&#xD;
      TimeSeries[{Take[First[#], 3], #2} &amp;amp; @@@&#xD;
        Rest[Flatten[&#xD;
          Transpose[&#xD;
           Import[&amp;#034;https://github.com/ShivainVij/Cryptocurrency_Machine_\&#xD;
    Learning_Portfolio/raw/master/Dataset/BitcoinTransactionHistory.xlsx&amp;#034;,\&#xD;
     &amp;#034;Data&amp;#034;]], 1]]];&#xD;
&#xD;
Now that we have the Bitcoin transaction history, we can collect the Bitcoin historical values with FinancialData just like we did at the beginning of the project, and then we can filter it to remove uncommon dates, and finally find all the Bitcoin historical returns.&#xD;
&#xD;
    BTCValuedata = FinancialData[&amp;#034;BTC&amp;#034;, {{2014, 7, 17}, CurrentDate[]}];&#xD;
    BTCallData =&#xD;
      TimeSeriesResample[{BTCValuedata, BTCtransData, &amp;#034;Intersection&amp;#034;}];&#xD;
    BTCreturns =  Differences@*Log@BTCallData[[1, All, 2]];&#xD;
&#xD;
Now that all the data has been collected, we can input everything into a Predict Neural Network so that the Neural Network would take Bitcoin blockchain historical transaction data and predict the Bitcoin return rates.&#xD;
&#xD;
    BTCml = Predict[&#xD;
       Flatten[Rest[BTCallData[[2, All, 2] ]]] -&amp;gt;  BTCreturns,&#xD;
       PerformanceGoal -&amp;gt; &amp;#034;Quality&amp;#034;, Method -&amp;gt; &amp;#034;NeuralNetwork&amp;#034;];&#xD;
    BTCvar = Rest[BTCallData[[2, All, 2]] ] -&amp;gt; BTCreturns;&#xD;
    BTCpml = PredictorMeasurements[BTCml, BTCvar];&#xD;
    BTCpml[&amp;#034;Report&amp;#034;]&#xD;
&#xD;
The results were fairly disappointing. &#xD;
![Bitcoin Machine Learning Daily Results][2]&#xD;
&#xD;
The graph above shows how the Neural Network performed, and it shows that it was mostly guessing the returns as 0, which was consistently incorrect. If the Neural Network was accurate, all the blue points would have been along the dotted line. Even after removing the first 2 years of data, since at that time Bitcoin was not really recognized as a currency and it&amp;#039;s data from that time could have influenced the success of the Neural Network since it would have been irrelevant data in relativity to today&amp;#039;s recognition of Bitcoin, the Neural Network remained inaccurate. The same results are produced even with Ethereum. &#xD;
&#xD;
![Ethereum Machine Learning Daily Results][3]&#xD;
&#xD;
While this does make it appear that there is no correlation between blockchain transactions and value, I decided to further investigate by focusing on monthly values instead of daily values.&#xD;
&#xD;
Monthly Bitcoin Machine Learning&#xD;
--------------------------------&#xD;
&#xD;
Just like in the daily method, the first step is to collect data, but this time it would be monthly. &#xD;
&#xD;
    BTCmonthlyTransData = TimeSeries[Rest[Import[&amp;#034;https://github.com/ShivainVij/Cryptocurrency_Machine_Learning_Portfolio/raw/master/Dataset/BitcoinMonthlyTransactionData.csv&amp;#034;, &amp;#034;Data&amp;#034;]]];&#xD;
    BTCmonthlydata = FinancialData[&amp;#034;BTC&amp;#034;, {{2016, 7, 1}, CurrentDate[]}];&#xD;
    BTCmonthlyallData =&#xD;
    TimeSeriesResample[{BTCmonthlydata, BTCmonthlyTransData}, &amp;#034;Intersection&amp;#034;];&#xD;
    BTCmonthlyreturns = Differences@*Log@BTCmonthlyallData[[1, All, 2]];&#xD;
&#xD;
Now we can train another Neural Network and put everything into a graph that we can look at.&#xD;
&#xD;
    BTCmonthlyml = Predict[&#xD;
       Rest[Flatten[BTCmonthlyallData[[2, All, 2] ]]] -&amp;gt;  BTCmonthlyreturns,&#xD;
       PerformanceGoal -&amp;gt; &amp;#034;Quality&amp;#034;, Method -&amp;gt; &amp;#034;NeuralNetwork&amp;#034;];&#xD;
    BTCmonthlyvar = Rest[BTCmonthlyallData[[2, All, 2]] ] -&amp;gt; BTCmonthlyreturns;&#xD;
    &#xD;
    BTCfulllm = LinearModelFit[&#xD;
      Transpose[{BTCmonthlyml[Rest[ BTCmonthlyallData[[2, All, 2]]], &amp;#034;Decision&amp;#034;],&#xD;
        BTCmonthlyreturns}], x, x]&#xD;
    &#xD;
    BTCmonthlyml[Reports]&#xD;
&#xD;
![Monthly Bitcoin Machine Learning][4]&#xD;
&#xD;
The above shows the results of only looking at monthly data, which is much more accurate than daily. However, monthly data is not very practical. Even so, it does produce quite a promising graph:&#xD;
&#xD;
![Bitcoin Monthly Machine Learning][5]&#xD;
&#xD;
We can see at the top that the Neural Network was able to identify a 46.75% correlation between monthly Bitcoin transaction history and Bitcoin values. This graph shows that the monthly results are significantly better than they were for all of the daily data. We can also find how much the of the variance in return rates that the Neural Network can explain.predicts.&#xD;
&#xD;
    fulllm[&amp;#034;RSquared&amp;#034;]&#xD;
&#xD;
This returns about 20%, which is quite low. Since this does not perform very well, we can continue our exploration. What if we were to only input Bitcoin and Ethereum blockchain transaction data and output the optimized values without finding the returns at all?&#xD;
&#xD;
Predicting Optimized Values&#xD;
---------------------------&#xD;
&#xD;
Firstly, we have to collect all the data for the Bitcoin transaction history, Ethereum transaction history, and Historical optimized values, and then filter out data from uncommon dates. Since we already have the Bitcoin transaction history from our daily Neural Network, we only need to find the Ethereum transaction history and Historical optimized values.&#xD;
&#xD;
    ethData = TimeSeries[Rest[Import[&amp;#034;https://raw.githubusercontent.com/ShivainVij/Cryptocurrency_Machine_Learning_Portfolio/master/Dataset/ETHTransactionHistory.csv&amp;#034;, &amp;#034;Data&amp;#034;]]]&#xD;
    &#xD;
    historicalOptimized = Table[&#xD;
       date = DatePlus[Today, {EndDate, &amp;#034;Days&amp;#034;}];&#xD;
       data =&#xD;
        FinancialData[#, {date - Quantity[21, &amp;#034;Days&amp;#034;],&#xD;
            date}] &amp;amp; /@ {&amp;#034;BTC&amp;#034;, &amp;#034;ETH&amp;#034;};&#xD;
       dataSelected =&#xD;
        TimeSeriesResample[{data[[1]], data[[2]]}, &amp;#034;Intersection&amp;#034;];&#xD;
       returns = Differences@*Log /@ dataSelected[[All, All, 2]];&#xD;
       btcSD = StandardDeviation[returns[[1]]] ;&#xD;
       ethSD = StandardDeviation[returns[[2]]];&#xD;
       correlated = Correlation[returns[[1]], returns[[2]]];&#xD;
       optimize[Mean[returns[[1]]], Mean[returns[[2]]], btcSD, ethSD,&#xD;
        correlated]&#xD;
       , {EndDate, -600, 0, 1}] ~&#xD;
      Monitor~{date - Quantity[21, &amp;#034;Days&amp;#034;], date}&#xD;
    &#xD;
    transpose =&#xD;
     Take[Transpose[{Rest[ETHallData[[1, All, 2] ]],&#xD;
        Rest[BTCallData[[1, All, 2]] ]}], -Length[listedHistoricalOptimized]]&#xD;
&#xD;
Now that all the data has been collected, it can all be inputted into a Neural Network.&#xD;
&#xD;
    optalldata =&#xD;
      TimeSeriesResample[{ETHallData[[1]], BTCtransData[[1, All, 2]]}, &amp;#034;Intersection&amp;#034;];&#xD;
    optml = Predict[transpose -&amp;gt;  listedHistoricalOptimized,&#xD;
       PerformanceGoal -&amp;gt; &amp;#034;Quality&amp;#034;, Method -&amp;gt; Automatic];&#xD;
    poptml = PredictorMeasurements[optml,&#xD;
      transpose -&amp;gt; listedHistoricalOptimized]&#xD;
&#xD;
Now we can put all the data into an easy to read graph.&#xD;
&#xD;
    optmllm =&#xD;
     LinearModelFit[&#xD;
      Transpose[{optml[transpose],  listedHistoricalOptimized}], x, x]&#xD;
    &#xD;
    optallCorrelation =&#xD;
     Correlation[&#xD;
      Transpose[{optml[transpose],  listedHistoricalOptimized}]]&#xD;
    &#xD;
    ListPlot[Transpose[{optml[transpose],  listedHistoricalOptimized}],&#xD;
     Epilog -&amp;gt; Style[Line[{#, optmllm[#]} &amp;amp; /@ {0, 1}], Red],  &#xD;
     AspectRatio -&amp;gt; 1,&#xD;
     PlotLabel -&amp;gt;&#xD;
      Row[{&amp;#034;Correlation:&amp;#034;, Style[PercentForm[optallCorrelation], Red]},&#xD;
       Spacer[2]], AxesLabel -&amp;gt; {&amp;#034;Predicted&amp;#034;, &amp;#034;Actual&amp;#034;}, PlotRange -&amp;gt; All]&#xD;
&#xD;
![Ethereum + Bitcoin to produce Optimized portfolio][6]&#xD;
&#xD;
This graph shows over a 70% correlation between blockchain transaction data and the optimized portfolio, which is really strong. In addition, after running the code below, we see that the Neural Network can explain over 50% of the the variance in the optimized portfolio, which is quite successful for a volatile cryptocurrency such as Bitcoin.&#xD;
&#xD;
    optmllm[&amp;#034;RSquared&amp;#034;]&#xD;
&#xD;
Conclusion&#xD;
----------&#xD;
&#xD;
In conclusion, Neural Networks can be used to predict optimized portfolios in the future, however they would require much better data. For this, there are many different extensions for the project. One of the many extensions is to take into account new users and old users and trading history of users to identify possible enterprise level transactions, since the enterprises that perform these transactions may not be influenced by the same things that regular individual consumers are. Furthermore, the prices and how many people bought ASICS or any other mining related hardware can also be investigated, since the mining of Bitcoins can impact the blockchain&amp;#039;s number of Bitcoin transactions. Shifting our focus to the regular individual consumer, further research could include analyzing news articles consisting of majority of the key words bitcoin prices expected to rise says expert analyst&amp;#034; since phrases such as this can cause a consumer who would normally not be interested in cryptocurrencies to invest. Analyzing the volatility right before cryptocurrency price experiences dramatic change like the bitcoin spike and fork can also provide more insight into what influences consumer confidence in Bitcoin. Finally, adding more cryptocurrencies into the program would also provide more possibilities for the optimized portfolio, but right now, only bitcoin and Ethereum are supported by Wolfram. It is always possible to add more manually using data found online but that data would have to be formatted properly.&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=correlated.JPG&amp;amp;userId=1725177&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=btcML.JPG&amp;amp;userId=1725177&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ethML.JPG&amp;amp;userId=1725177&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=MONTHLY.JPG&amp;amp;userId=1725177&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=1.JPG&amp;amp;userId=1725177&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=2.JPG&amp;amp;userId=1725177</description>
    <dc:creator>Shivain Vij</dc:creator>
    <dc:date>2019-07-12T01:30:13Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2452216">
    <title>Labeling, scaling and computing a correlation between two datasets</title>
    <link>https://community.wolfram.com/groups/-/m/t/2452216</link>
    <description>I want to compare the Dow Jones Index to the price of the Ethereum cryptocurrency. Although I can get the data and plot them individually, I can&amp;#039;t get a sensible graph of the two sets of data. I would also like to plot a correlation coefficient between them. I&amp;#039;m not really fussed about the exact definition of correlation in this sense, so anything in Mathematica would do. &#xD;
&#xD;
I think the attached Notebook shows this better than I could easily explain here. &#xD;
&#xD;
&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/69411ee7-490f-4567-a8ab-5064ef7f0f44</description>
    <dc:creator>David Kirkby</dc:creator>
    <dc:date>2022-01-21T19:41:04Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2446648">
    <title>[WEBINAR] New in Wolfram Language 13: Blockchain, Cryptography and NFTs</title>
    <link>https://community.wolfram.com/groups/-/m/t/2446648</link>
    <description>Come join us at a **Webinar** on Thursday, January 20th at 12:30pm EST (5:30pm UTC) to see *what&amp;#039;s new with Blockchain, Cryptography and NFTs in the Wolfram Language*. We will have several presenters and Q&amp;amp;A with Wolfram experts. Please comment below if you have any questions!  &#xD;
&#xD;
&amp;gt; **REGISTER HERE:** &#xD;
&#xD;
&amp;gt; https://www.bigmarker.com/wolfram-u/new-in-13-cryptography-nfts-blockchains&#xD;
&amp;gt; &#xD;
&amp;gt; **About This Webinar:** Learn about the math behind cryptography and how&#xD;
&amp;gt; the Wolfram Language facilitates the development of hands-on&#xD;
&amp;gt; educational content, explore NFT technology and learn how to connect a&#xD;
&amp;gt; blockchain to the Wolfram Language.&#xD;
&#xD;
[![enter image description here][1]](https://www.bigmarker.com/wolfram-u/new-in-13-cryptography-nfts-blockchains)&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2022-01-14at1.20.53PM.jpg&amp;amp;userId=11733</description>
    <dc:creator>Steph Macurdy</dc:creator>
    <dc:date>2022-01-14T19:25:33Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2398248">
    <title>cryptoData: crypto currencies financial data package</title>
    <link>https://community.wolfram.com/groups/-/m/t/2398248</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/6582c4f4-c26b-49a8-9229-2e98a6455357&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
  [Original NB]: https://www.wolframcloud.com/obj/f936a4b7-149a-460f-ab53-f20843a7c78f</description>
    <dc:creator>Damian Calin</dc:creator>
    <dc:date>2021-11-01T23:31:33Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2313877">
    <title>[WSS21] A Wolfram framework for NFT analytics</title>
    <link>https://community.wolfram.com/groups/-/m/t/2313877</link>
    <description>[Hyperlink to project in Wolfram Cloud][2]&#xD;
&#xD;
![Cryptopunk Transaction Networks][1]&#xD;
&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][3]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=collage.png&amp;amp;userId=2313369&#xD;
  [2]: https://www.wolframcloud.com/obj/0.kai.rharris/Published/NFT_API.nb&#xD;
  [3]: https://www.wolframcloud.com/obj/190568d7-9577-4b38-83b7-3aeb7755201f</description>
    <dc:creator>Kai Harris</dc:creator>
    <dc:date>2021-07-14T02:30:00Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2317861">
    <title>[WSC21] Analyzing the sales of NFT&amp;#039;s and making a live dashboard</title>
    <link>https://community.wolfram.com/groups/-/m/t/2317861</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-07-15at15-46-35%28unnamed%29-WolframOne.png&amp;amp;userId=2238037&#xD;
  [2]: https://www.wolframcloud.com/obj/29ada9ce-53a5-4319-9596-eac397c29c41</description>
    <dc:creator>Hemanth Surya Ganesh Kapa</dc:creator>
    <dc:date>2021-07-15T20:49:47Z</dc:date>
  </item>
</rdf:RDF>

