<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Emiel Sebastiaan on Medium]]></title>
        <description><![CDATA[Stories by Emiel Sebastiaan on Medium]]></description>
        <link>https://medium.com/@emielvanderhoek?source=rss-bf4dc3bf1050------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vTYInI8PwejSuMOPFypEhQ.jpeg</url>
            <title>Stories by Emiel Sebastiaan on Medium</title>
            <link>https://medium.com/@emielvanderhoek?source=rss-bf4dc3bf1050------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:40:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emielvanderhoek/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Polkascan Development Update #7]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-7-36b5f814dc8b?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/36b5f814dc8b</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[polkascan]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Tue, 01 Sep 2020 11:57:53 GMT</pubDate>
            <atom:updated>2020-09-01T11:57:53.505Z</atom:updated>
            <content:encoded><![CDATA[<h4>Polkascan Signer Capabilities</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tdrpt8SXT5dpXoLL" /></figure><p>Polkascan Foundation’s mission is to make multi-chain data accessible and understandable. With the Polkascan project we are working towards a multi-chain exploration and data analytic platform for the Polkadot-ecosystem.</p><p>This development update is part of our work that extends the Polkascan stack in general and extends Polkascan’s Python libraries in particular with key-generation, signing and signature verification capabilities. 1) Python Signer Libraries: for offline signing and offline signature verification and 2) Angular Parity Signer Components: for secure online signing.</p><p>Our organization is on an ongoing mission of building the Polkascan multi-chain explorer. Our fourth wave grant work left signing capabilities off-scope in our Python libraries. This project aims to provide full signing capabilities that can be used from within Python libraries and from user-facing Angular (web) applications.</p><p>The work covered in this development update contributes to the broader Polkadot &amp; Substrate ecosystems by providing Python-based signing and signature verification capabilities and an independent Angular-based visual signer interface to Parity Signer. Both sets of deliverables provide signing and signature verification mechanisms which are independent of the currently dominant Javascript/Typescript mechanisms. Having independent implementations is good for the ecosystem as a whole. Needless to say, maturing and making available Python-based and Angular-based core components benefit the ecosystems.</p><p>Our team has been active in the Polkadot-ecosystem from day one, we believe Substrate and the Polkadot will solve many industry-wide problems. Additionally we are highly invested in Python. This project aims to lower the friction of using Python with Substrate-based chains and the completion of the Python-libraries will benefit many teams in the ecosystem. On top of that, this grant work will allow on-boarding of Python developers to integrate with existing or new Python-applications or applications in any other language with existing and new Substrate chains.</p><h3>1. Getting started</h3><p>This development update will help you get started by running a release of the <em>Substrate Interface</em> yourself.</p><h4>1.1. Substrate Interface on Github</h4><p><strong><em>Repositories</em>: </strong>The source code that extends the Polkascan stack with signer capabilities can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of a number of distinct repositories which collectively form the <em>Substrate Interface</em>. We apply a number of conventions for branches and versioned releases across these repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mPHfQgTWv_VoQfq2" /><figcaption><em>Image 1a: Polkascan on Github:</em><a href="https://github.com/polkascan"><em> https://github.com/polkascan</em></a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent work in the <em>master</em>-branch.<br><strong><em>Releases</em>: </strong>This development update’s work is released and tagged as ‘v0.10.x’.</p><h4>1.2. What makes Substrate Interface?</h4><p><em>Substrate Interface </em>consists of a number of distinct software artifacts which collectively orchestrate the interface. The <a href="https://github.com/polkascan/substrate-interface-api"><em>Substrate Interface API</em></a><em> </em>provides JSON-RPC end-points that allow for enriched interaction with Substrate’s standard JSON-RPC interface with the help of <a href="https://github.com/polkascan/py-substrate-interface"><em>Python Substrate Interface Library</em></a>, the <a href="https://github.com/polkascan/py-scale-codec"><em>Python SCALE Codec Library</em></a> and various RUST-bindings for Python: the <a href="https://github.com/polkascan/py-bip39-bindings"><em>Python Bindings for Tiny-BIP39 RUST Crate</em></a>, the <a href="https://github.com/polkascan/py-ed25519-bindings"><em>Python Bindings for the ED25519-Dalek RUST Crate</em></a> and the <a href="https://github.com/polkascan/py-sr25519-bindings"><em>Python Bindings for the RUST Implementation of the SR25519 Cryptography Library</em></a>.</p><p><a href="https://github.com/polkascan/substrate-interface-gui"><em>Substrate Interface GUI</em></a> is a basic user interface that showcases how Substrate Interface could be applied in front-end Angular Typescript applications. Of particular interest are the Angular Parity Signer Components. These components cover full compatibility with Parity Signer, through: 1) <a href="https://github.com/polkascan/substrate-interface-gui/tree/master/src/app/components/polkascan-signer-address"><em>QR Address Creation</em></a>, 2) <a href="https://github.com/polkascan/substrate-interface-gui/tree/master/src/app/components/polkascan-signer-extrinsic-qr"><em>QR Signing Payload</em></a>, and 3) <a href="https://github.com/polkascan/substrate-interface-gui/tree/master/src/app/components/polkascan-signer-signature"><em>QR Signature</em></a>.</p><p>We have chosen to provide full Docker support for all our artifacts, hence all relevant repositories have Dockerfiles in their root. Although these distinct components of <em>Substrate Interface</em> could be applied independently (in other projects), we offer an additional piece of software, called: <a href="https://github.com/polkascan/substrate-interface"><em>Substrate Interface</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ol><li>Recommended hardware: Memory: &gt;2GB (more is better), Storage: &gt;5GB (SSD is better), Processor: more and faster cores is better (Intel i3).</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of the <em>Substrate Interface </em>has been tested on Mac, Linux and Windows.1. Getting started</li></ol><p>This development update will help you get started by running <em>Substrate Interface </em>yourself.</p><h4>1.4. Building and running Substrate Interface</h4><p>This paragraph provides a step-by-step guide on running our v0.10.* release of the Enriched Substrate Interface on your own machine. The instructions outlined in this paragraph can be found in our <a href="https://github.com/polkascan/substrate-interface">Github repository</a>.</p><ol><li>Clone the repository: <br>git clone https://github.com/polkascan/substrate-interface.git</li><li>Go to the new folder: <br>cd substrate-interface</li><li>Check available releases: <br>git tag</li><li>Checkout the latest release in the 0.10.x range (replace ‘x’ with highest number): <br>git checkout 0.10.x</li><li>Initialize and update submodules: <br>git submodule update --init --recursive</li><li>Build and run Docker Compose for one of the following five configurations</li></ol><pre>##(a)## Kusama Network using a publicly hosted node:<br>docker-compose -p substrate-interface -f docker-compose.kusama-public.yml up --build --remove-orphans</pre><pre>##(b)## Kusama Network using a local node that is part of the docker-compose configuration:<br>docker-compose -p substrate-interface -f docker-compose.kusama-local.yml up --build --remove-orphans</pre><pre>##(c)## Polkadot Network using a publicly hosted node:<br>docker-compose -p substrate-interface -f docker-compose.polkadot-public.yml up --build --remove-orphans</pre><pre>##(d)## Network using a local node that is part of the docker-compose configuration:<br>docker-compose -p substrate-interface -f docker-compose.polkadot-local.yml up --build --remove-orphans</pre><pre>##(e)## Substrate Node Template Development Network using a local node. This step assumes that a Substrate node is running on your local machine. The Docker-Compose configuration points to your localhost from within the configuration:<br>docker-compose -p substrate-interface -f docker-compose.kusama-public.yml up --build --remove-orphans</pre><h4>1.5. Start Substrate Interface</h4><p>The Substrate Interface GUI should now be available in a browser: <a href="http://127.0.0.1:8001/">http://127.0.0.1:8001</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cTgI0Su8ggtolO3I" /><figcaption><em>Image 1b: Substrate Interface GUI in a Browser: </em><a href="http://127.0.0.1:8001/"><em>http://127.0.0.1:8001</em></a></figcaption></figure><p>The Substrate Interface API should now be available for use in <a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH">Postman</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P1tbNb79uiux_4Rm" /><figcaption><em>Image 1c: Substrate Interface API </em><a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH"><em>Postman Documentation</em></a></figcaption></figure><p>The default JSON-RPC url: <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GaoVvkLQy76O9J6t" /><figcaption><em>Image 1d: Substrate Interface API in Postman: </em><a href="http://127.0.0.1:8000/"><em>http://127.0.0.1:8000</em></a></figcaption></figure><h4>1.6. Cleaning up</h4><p>The following [docker] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.<br>docker-compose -p substrate-interface -f docker-compose.yml down --remove-orphans</li><li>Remove all unused containers, volumes and images.<br>docker system prune<br>[confirm] Y</li><li>Remove all containers and images.<br>docker system prune -a<br>[confirm] Y</li><li>Remove all volumes.<br>docker volume prune<br>[confirm] Y</li></ul><h3>2. Substrate Interface GUI</h3><p>After following the <em>getting started</em> instructions, the Substrate Interface GUI should be available in a browser through the following URI:<a href="http://127.0.0.1:8001/"> http://127.0.0.1:8001</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dvEbfcwhP2uv9yHi" /><figcaption><em>Image 2a: Substrate Interface GUI in a Browser: </em><a href="http://127.0.0.1:8001/"><em>http://127.0.0.1:8001</em></a></figcaption></figure><p>Substrate Interface GUI provides four generic sections which are described in this chapter’s sections<em>. </em>These sections replicate the similar respective functions of<a href="https://polkadot.js.org/apps"> Polkadot JS Apps</a> without any need for the Typescript/Javascript libraries used by the latter, effectively making Substrate Interface a fully independent stack.</p><h4>2.1. Remote Procedure Calls</h4><p>The <em>method-</em>control lists all remote procedure call methods the Substrate Interface offers. This includes all native Substrate-client methods and thus provides full backwards compatibility with any regular Substrate-client. Additionally a large number of <em>new </em>methods are available related to this project’s grant work and previous grant work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v3hVyYFfCx7XWxsu" /><figcaption><em>Image 2.1a: Substrate Interface GUI Remote Procedure Calls</em></figcaption></figure><p>The following list highlights a number of new RPC-methods that have been developed during current grant work.</p><ol><li><strong>keypair_create</strong>: creates a new keypair</li><li><strong>keypair_inspect</strong>: provides details for a mnemonic phrase.</li><li><strong>keypair_sign</strong>: signs an arbitrary message with a mnemonic phrase.</li><li><strong>keypair_verify</strong>: verifies the signature of an arbitrary message.</li><li><strong>runtime_createSignaturePayload</strong>: creates a message payload for any runtime call, which can be signed by the keypair functions.</li><li><strong>runtime_createExternalSignerPayload</strong>: creates a message payload for any runtime call, which can be signed by an external signer (without any decoding context), such as Parity Signer.</li><li><strong>runtime_submitExtrinsic</strong>: submits a signed extrinsic to the blockchain. This method includes a valid signature for the payload as created by the internal Python signer or the external Parity Signer.</li></ol><p>We’d like to stress that using keypair-methods in a user-facing application is not recommended. The respective components in Substrate Interface GUI are mainly used to showcase the new capabilities.</p><h4>2.2. Chain State</h4><p>The <em>storage function</em> control lists all storage functions the runtime offers. No significant changes have been made to this section of Substrate Interface. We refer to our previous <a href="https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66">development update #5</a> for further details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4pSpGzlt4H--hwOl" /><figcaption><em>Image 2.2a: Substrate Interface GUI Chain State</em></figcaption></figure><h4>2.3. Extrinsics with Secure Signing</h4><p>A significant part of our recent grant work has resulted in full Parity Signer compatibility. Parity Signer functions as an external sandboxed signer interface that only requires verifiably secure visual communication through QR-codes. This required significant research and has resulted in an implementation of<a href="https://github.com/maciejhirsz/uos"> Universal Offline Signatures</a> through QR-codes in the Polkascan stack. The remainder of this section provides a step by step instruction:</p><p><strong>Step 1</strong>: Add account with Parity Signer<br>Use the ‘scan new address’-button to add the external account from the Parity Signer device. The example shows the composition of a system.remark extrinsic. This extrinsic will add an arbitrary text to the blockchain. Use the ‘sign extrinsic’-button to proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nkO-rZENgIFAv_rH" /><figcaption><em>Image 2.3a: Substrate Interface GUI Create Extrinsic step 1</em></figcaption></figure><p><strong>Step 2</strong>: A QR-code is displayed which can be signed with an external offline signer, such as Parity Signer. When the external signer has created the QR-code with the signature, click on the ‘scan signature QR’-button to proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-ZGn06O7vHmJaRqk" /><figcaption><em>Image 2.3b: Substrate Interface GUI Create Extrinsic step 2</em></figcaption></figure><p><strong>Step 3</strong>: If the signature is valid, the extrinsic will be submitted to the blockchain. Substrate Interface GUI will display a reference to the transaction hash that has been submitted. The transaction will become available on <a href="https://polkascan.io/kusama/transaction/0x6dcd4bce375bbab58a3ae4583a8cd4bb6a1752ed89b8466d549abfbd0169d32b">Polkascan</a> (or any other block explorer).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EouTo3QHvKKYjm_h" /><figcaption><em>Image 2.3c: Substrate Interface GUI Create Extrinsic step 3</em></figcaption></figure><h4>2.4. Secure Message Signing</h4><p>A significant part of our recent grant work has resulted in full Parity Signer compatibility. Parity Signer functions as an external sandboxed signer interface that only requires verifiably secure visual communication through QR-codes. This section covers external signing of an arbitrary message in a step by step instruction:</p><p><strong>Step 1</strong>: Add account with Parity Signer<br>Use the ‘scan new address’-button to add the external account from the Parity Signer device. The example shows how an arbitrary message can be signed with Parity Signer. Use the ‘sign message’-button to proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rO54g3kCGT79oKJ0" /><figcaption><em>Image 2.4a: Substrate Interface GUI Message Signing step 1</em></figcaption></figure><p><strong>Step 2</strong>: A QR-code is displayed which can be signed with an external offline signer, such as Parity Signer. When the external signer has created the QR-code with the signature, click on the ‘scan signature QR’-button to proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gGhbNh7asudJdf0S" /><figcaption><em>Image 2.4b: Substrate Interface GUI Message Signing step 2</em></figcaption></figure><p><strong>Step 3</strong>: Substrate Interface GUI will display the signature that has been created by the external signer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pl-8uGQRjnZKc-Eg" /><figcaption><em>Image 2.4c: Substrate Interface GUI Message Signing step 3</em></figcaption></figure><p><strong>Step 4</strong>: The signature can be verified with external applications such as Polkadot JS Apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SzJkpVhQQ5O65PrX" /><figcaption><em>Image 2.4d: Substrate Interface GUI Message Signing step 4</em></figcaption></figure><h3>3. Substrate Interface API</h3><h4>3.1. Full Substrate node compatibility</h4><p>Substrate Interface API provides a JSON-RPC interface to a Substrate-node and is fully compatible with JSON-RPC interface of a regular Substrate-node. E.g. the RPC-method `chain_getBlock` provides the details of a block at the current head of the chain. The RPC-method `rpc_methods` provides a discovery mechanism of the supported RPC-methods for all known groups, such as: `author`, `chain`, `state`, `system`, etc.</p><h4>3.2. Keypair RPC group</h4><p>Substrate Interface API extends the available RPC-methods with an entirely new group called: `keypair`, which exposes the JSON-RPC interfaces for keypair generation, keypair inspection, signing and signature verification capabilities. These capabilities were left off-scope in our previous grant work (as documented in <a href="https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66">development update #5</a>).</p><p>An overview of these four new keypair functions can be found in this paragraph.</p><p><strong>Keypair creation</strong>: <em>keypair_create</em> creates a new keypair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*2v-wjS1Qn1JQmqhIbRjW2A.png" /></figure><p><strong>Keypair inspection</strong>: <em>keypair_inspect</em> provides details for a mnemonic phrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*PluxrTkYBvBmsHEheG3d3A.png" /></figure><p><strong>Signing</strong>: <em>keypair_sign</em> signs an arbitrary message with a mnemonic phrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-zFfq4YpYQgp5Df84dr5Q.png" /></figure><p><strong>Verification</strong>: <em>keypair_verify</em> verifies the signature of an arbitrary message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQNDPj5T-RlHzPqVeYykkg.png" /></figure><p>The Substrate Interface API currently has no support for derivation path features. The current grant work however does support a Python based solution that offers derivation path features. Please refer to section 4.6 of this development update, which describes the (deprecated) Python Subkey Wrapper.</p><h4>3.3. Runtime RPC-group</h4><p>Substrate Interface API extends the available RPC-methods with a group called: `runtime`, which enriches the JSON-RPC interface with all data particular to the current and previous runtimes of the Substrate-node. Most of the capabilities in this group were developed during previous grant work as documented in <a href="https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66">development update #5</a>.</p><p>The current grant work offers a number of new RPC-methods related to signing transactions and arbitrary messages.</p><p><strong>Create a Signature Payload</strong>: <em>runtime_createSignaturePayload</em> creates a message payload for any runtime call, which can be signed by the keypair functions. The example shows a simple balance transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJymVFdE0Ja7_n2xqJosoA.png" /></figure><p><strong>Create an External Signer Payload</strong>: <em>runtime_createExternalSignerPayload</em> creates a message payload for any runtime call, which can be signed by an external signer (without any decoding context), such as Parity Signer. The example shows a simple balance transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5TPQ7yDl0gowfr1lzIlKxQ.png" /></figure><p><strong>Submit an extrinsic</strong>: <em>runtime_submitExtrinsic</em> submits a signed extrinsic to the blockchain. This method includes a valid signature for the payload as created by the internal Python signer or the external Parity Signer. The example shows a simple balance transfer. The example response provides an error message because the sending account has insufficient balance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVlh-ud9wNzTSjpaHvKKJA.png" /></figure><h4>3.4. Documentation and code snippets</h4><p>The current and extended RPC-methods have been fully documented through a Postman Collection and can be found <a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH?version=latest">here</a>. The documentation provides tested examples for all current and extended RPC-methods and can easily be imported into your own Postman application by clicking on the ‘Run in Postman’ button at the top of the screen in the documented Postman Collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*64mQdIGAyJLBhwr5" /><figcaption><em>Figure 3.4a: Documentation: </em><a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH?version=latest"><em>Postman collection</em></a></figcaption></figure><p>Substrate Interface API provides an enhanced JSON-RPC interface to a Substrate-node. The JSON-RPC standard is a general interface any developer can use regardless of their respective development environment. The documented Postman Collection provides code-snippets for up to 25 distinct development environments (<em>C#</em>, <em>cURL</em>, <em>Go</em>, <em>Java</em>, <em>Javascript</em>, <em>NodeJs</em>, <em>OCaml</em>, <em>PHP</em>, <em>Python</em>, <em>Ruby</em>) for all included RPC-methods. This should illustrate the broad applicability of our grant work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Md_GRvAKZzjuJ2aC" /><figcaption><em>Figure 3.4b: Documentation: Postman collection code-snippets for Go-Native.</em></figcaption></figure><p>The example in figure 3.4c illustrates the ease at which ‘Balances’ can be queried for a SS58-encoded account address through Postman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dNicpDGTm5k36k3C" /><figcaption><em>Figure 3.4c: Example using Substrate Interface API with Postman</em></figcaption></figure><h3>4. Python Libraries</h3><h4>4.1. Python Substrate Interface</h4><p>The Python Substrate Interface library specializes in interfacing with a Substrate node, providing additional convenience methods to deal with SCALE encoding/decoding (the default output and input format of the Substrate JSON-RPC), metadata parsing, type registry management and versioning of types. The Python Substrate Interface library is utilized by the Substrate Interface (and of course by our Polkascan-stack).</p><p>The grant work that has been completed with this development update has extended the Python Substrate Interface with key generation, signing and signature verification capabilities for general use and as an independent Python library.</p><p>Full Python library documentation has been made available through <a href="https://pdoc3.github.io/pdoc/">Pdoc</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SE0XCqbGMORhrFuw" /><figcaption><em>Figure 4.1a: Documentation: </em><a href="https://polkascan.github.io/py-substrate-interface/"><em>Python Substrate Interface</em></a></figcaption></figure><p>The documentation illustrates how to use all available methods. These methods should look familiar given the topic covered throughout this development update.</p><p>The grant work provides a full stack of artifacts to illustrate how this library could be applied. That said, this library could be applied independently in any Python-based application. The <a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md">readme</a> in the root of the repository provides details on how to get started with using the Python Substrate Interface library in your own Python project.</p><p><strong>Initialization: </strong>initialize interface and get head block hash of Kusama chain.</p><pre>substrate = SubstrateInterface(<br> url=”wss://kusama-rpc.polkadot.io/”,<br> address_type=2,<br> type_registry_preset=’kusama’<br>)<br>substrate.get_chain_head()</pre><p>The readme contains additional examples that illustrate how to use Python Substrate Interface:</p><ol><li><a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md#get-extrinsics-for-a-certain-block">Get extrinsics for a certain block</a></li><li><a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md#make-a-storage-call">Make a storage call</a></li><li><a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md#create-and-send-signed-extrinsics">Create and send signed extrinsics</a></li><li><a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md#keypair-creation-and-signing">Keypair creation and signing</a></li><li><a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md#metadata-and-type-versioning">Metadata and versioning</a></li></ol><h4>4.2. Python Bindings BIP39</h4><p>The Python Substrate Interface library (4.1) utilizes a number of external cryptography libraries. Creating native Python implementations of such libraries is well beyond the scope of our current project and efforts. Python Bindings BIP39 is an interface that exposes methods from a RUST crate and makes them accessible to the Python Interpreter using <a href="https://github.com/PyO3/pyo3">PyO3</a>.</p><p>On a high level Python Binding BIP39 allows Python applications to:</p><ol><li>Generate new mnemonic phrases</li><li>Create mini-secrets from mnemonic phrases</li><li>Create seeds from mnemonic phrases</li><li>Validate mnemonic phrases</li></ol><p>The RUST crate can be found on <a href="https://crates.io/crates/py-bip39-bindings">crates.io</a> and the full library documentation can be found on <a href="https://docs.rs/py-bip39-bindings/0.1.5/bip39/">docs.rs</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B6xzYAwNp_XyRVES" /><figcaption><em>Figure 4.2a: Documentation: </em><a href="https://docs.rs/py-bip39-bindings/0.1.5/bip39/"><em>Python Bindings for the tiny-bip39 crate</em></a></figcaption></figure><p>The <a href="https://github.com/polkascan/py-bip39-bindings">readme</a> contains detailed instructions on how to install and use these bindings from a Python application.</p><h4>4.3. Python Bindings ED25519</h4><p>The Python Substrate Interface library utilizes a number of external cryptography libraries. Creating native Python implementations of such libraries is well beyond the scope of our current project and efforts. Python Bindings ED25519 is an interface that exposes methods from a RUST crate and makes them accessible to the Python Interpreter using <a href="https://github.com/PyO3/pyo3">PyO3</a>.</p><p>On a high level Python Binding ED25519 allows Python applications to:</p><ol><li>Return public and private keypairs from a given 32-byte seed</li><li>Sign messages with the given keypair, returning the resulting signature</li><li>Verify that signatures on given messages were generated by private keys corresponding to the specified public keys</li></ol><p>The RUST crate can be found on <a href="https://crates.io/crates/py-ed25519-bindings">crates.io</a> and the full library documentation can be found on <a href="https://docs.rs/py-ed25519-bindings/0.1.1/ed25519/">docs.rs</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WwR-vew8PN-D0dNG" /><figcaption><em>Figure 4.3a: Documentation: </em><a href="https://docs.rs/py-ed25519-bindings/0.1.1/ed25519/"><em>Python Bindings for the ed25519-dalek RUST crate</em></a></figcaption></figure><p>The <a href="https://github.com/polkascan/py-ed25519-bindings">readme</a> contains detailed instructions on how to install and use these bindings from a Python application.</p><h4>4.4. Python Bindings SR25519</h4><p>The Python Substrate Interface library utilizes a number of external cryptography libraries. Creating native Python implementations of such libraries is well beyond the scope of our current project and efforts. Python Bindings SR25519 is an interface that exposes methods from a RUST crate and makes them accessible to the Python Interpreter using <a href="https://github.com/PyO3/pyo3">PyO3</a>.</p><p>On a high level Python Binding SR25519 allows Python applications to:</p><ol><li>Return public and private keypairs from a given 32-byte seed</li><li>Sign messages with the given keypair, returning the resulting signature</li><li>Verify that signatures on given messages were generated by private keys corresponding to the specified public keys</li><li>Various low level functions regarding hard and soft derivation paths</li></ol><p>The RUST crate can be found on <a href="https://crates.io/crates/py-sr25519-bindings">crates.io</a> and the full library documentation can be found on <a href="https://docs.rs/py-sr25519-bindings/0.1.2/sr25519/">docs.rs</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KNtNuuBgBENvrUFx" /><figcaption><em>Figure 4.4a: Documentation: </em><a href="https://docs.rs/py-sr25519-bindings/0.1.2/sr25519/"><em>Python Bindings for the schnorrkel RUST crate</em></a></figcaption></figure><p>The <a href="https://github.com/polkascan/py-sr25519-bindings">readme</a> contains detailed instructions on how to install and use these bindings from a Python application.</p><h4>4.5. Python SCALE Codec</h4><p>The Python SCALE Codec library is a lightweight, efficient, binary serialization and deserialization codec. The Python SCALE Codec is utilized by the Python Substrate Interface (and of course by our Polkascan-stack).</p><p>No significant changes have been made to this section of Substrate Interface. We refer to our previous <a href="https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66">development update #5</a> for further details.</p><p>Full Python library documentation has been made available through <a href="https://pdoc3.github.io/pdoc/">Pdoc</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ygiWGwgWoXtXJr7_" /><figcaption><em>Figure 4.5a: Documentation: </em><a href="https://polkascan.github.io/py-scale-codec/"><em>Python Scale Codec</em></a></figcaption></figure><h4>4.6. Python Subkey Wrapper</h4><p>The <a href="https://github.com/polkascan/py-subkey-wrapper">Python Subkey Wrapper</a> can be considered a fully functioning artifact. Our current grant work aims to develop feature compatibility of Parity Technologies’ <a href="https://www.substrate.io/kb/integrate/subkey">Subkey CLI</a> from within a Python library, in turn providing, keypair creation, signing and signature verification capabilities for native Python applications. Polkascan Foundation considers Python Subkey Wrapper deprecated code, because nearly all its features have been superseded by Python Bindings (section 4.2, 4.3 and 4.4 provides full details).</p><p>We have chosen to include this section of the development update. At time of writing using hard/soft derivation paths for keypair creation is not yet fully supported in Python Substrate Interface without using Python Subkey Wrapper.</p><p>The <a href="https://github.com/polkascan/py-subkey-wrapper/blob/master/README.md">readme</a> contains detailed instructions on how to install and use the wrapper from a Python application.</p><h3>About Polkascan Foundation</h3><p>Polkascan Foundation is a not-for-profit organization based in the Netherlands with a mission to make blockchain data accessible and understandable. Polkascan Foundation aims to achieve its mission through the following activities:</p><ol><li><strong>Neutral Analytics Platform</strong><br>Polkascan Foundation operates a neutral analytics platform: polkascan.io. This platform is and will remain free of commercial interests.</li><li><strong>Governance</strong><br>Polkascan Foundation actively participates in blockchain governance. Key focus of its efforts are to advocate novel methods to sustainably fund ecosystem infrastructure activities.</li><li><strong>Maintenance &amp; Community Support</strong><br>Polkascan Foundation maintains a wide variety of repositories, some of which have a broad range of applications and users. Polkascan Foundation aims to increase adoption of its infrastructure libraries and components by actively maintaining these repositories and by providing community support to its users.</li><li><strong>Research &amp; Development<br></strong><em>Technological innovations</em>: Polkascan Foundation maintains Python infrastructure libraries, such as: <em>Python Substrate Interface</em> and <em>Python Scale Codec</em>. These libraries can be considered key building blocks for the broader Python ecosystem for interaction with Substrate-based systems.<br><em>Organizational &amp; legal innovations</em>: Polkascan Foundation’s <a href="https://github.com/polkascan/social-contract/">Social Contract</a> is a novel off-chain coordination mechanism between a blockchain, its treasury and its community on one hand and external service providers, such as Polkascan Foundation on the other hand. The Social Contract serves as a proving ground for effective coordination, developing the relationship of a service provider with an entity that exists outside of contemporary legal systems.<br><em>UX, design and analysis innovations</em>: Polkascan Foundation continues its research activities to make multichain data accessible and understandable. One such innovations is Polkascan Foundation’s <a href="https://medium.com/polkadot-network/polkascan-economic-analysis-a5861abef63f">economic analysis</a> methods for multichain data. By applying financial accounting practices on blockchains, its multi-chain data is made accessible and understandable for a wide and potentially new audience, beyond the tech-savvy.</li></ol><p>The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36b5f814dc8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-7-36b5f814dc8b">Polkascan Development Update #7</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #6]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-6-4c3fe8e80629?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c3fe8e80629</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[multichain]]></category>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[polkascan]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Wed, 06 May 2020 16:23:41 GMT</pubDate>
            <atom:updated>2020-05-07T08:19:42.165Z</atom:updated>
            <content:encoded><![CDATA[<h4>Polkascan Account Module</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N5BuPiZARE5shFoe" /></figure><p>Our mission is to make multi-chain data accessible and understandable. With the Polkascan project we are working towards a multi-chain exploration and data analytic platform for the Polkadot-ecosystem. This development update is part of our work that extends Polkascan with a rich account-module. The new features offered by this grant work allow for data exploration and data discovery from the account’s perspective. This project was <a href="https://github.com/w3f/General-Grants-Program/blob/master/grants/speculative/polkascan_account_module.md">funded by Web3 Foundation</a>. Through Polkascan Foundation we offer a hosted version of our multi-chain explorer: <a href="https://polkascan.io/">polkascan.io</a>.</p><h3>1. Getting started</h3><p>This development update will help you get started by running the sixth milestone release of <em>Polkascan OS </em>yourself.</p><h4>1.1. Polkascan on Github</h4><p><strong><em>Repositories</em>: </strong>The source code of <em>Polkascan OS </em>can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of a number of distinct repositories which collectively form <em>Polkascan OS</em>. We apply a number of conventions for branches and versioned releases across these <em>Polkascan OS </em>repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k6l4qqBxMAHBbLBq" /><figcaption><em>Image 1.1a: Polkascan on Github: </em><a href="https://github.com/polkascan"><em>https://github.com/polkascan</em></a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent work in the <em>master</em>-branch.<br><strong><em>Releases</em>: </strong>This development update’s work is released and tagged as ‘v0.6.x’.</p><h4>1.2. What makes Polkascan?</h4><p><em>Polkascan </em>consists of a number of distinct software artifacts which collectively orchestrate <em>Polkascan</em>. The <a href="https://github.com/polkascan/polkascan-pre-harvester"><em>Harvester</em></a> transforms a Substrate node’s raw data into relational data, with the help of <a href="https://github.com/polkascan/py-substrate-interface"><em>Substrate Interface Library</em></a> and the <a href="https://github.com/polkascan/py-scale-codec"><em>SCALE Codec Library</em></a>. The produced relational data is disseminated by the <a href="https://github.com/polkascan/polkascan-pre-explorer-api"><em>Explorer API</em></a> and in turn made accessible to end users by the <a href="https://github.com/polkascan/polkascan-explorer-gui"><em>Explorer GUI</em></a>. We provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root.</p><p>Although these five distinct components of <em>Polkascan </em>could be applied independently (even in other projects), we offer a sixth piece of software, called <a href="https://github.com/polkascan/polkascan-os"><em>Polkascan OS</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ol><li>Recommended hardware: Memory: &gt;8GB (more is better), Storage: &gt;100GB (SSD is better), Processor: more and faster cores is better (Intel i7 quad core), Bandwidth: more and faster is better (&gt;20 Mbps). These requirements will go down as the project matures.</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of <em>Polkascan </em>has been tested on Mac, Linux and Windows.</li><li>The <em>Explorer GUI</em> has been tested on Safari, Firefox, Chrome, Edge and Brave.</li></ol><h4>1.4. Quick deployment of Polkascan</h4><p>This paragraph provides a step-by-step guide on running our milestone 6 release of <em>Polkascan OS </em>on your own machine. Please note that this section provides instructions for a quick deployment of <em>Polkascan OS</em>. This quick deployment instruction builds and runs <em>Polkascan Explorer GUI</em> and utilizes the API endpoints hosted by Polkascan Foundation. Instructions for a full deployment of <em>Polkascan OS</em> can be found in the next sections of this document.</p><ol><li>Clone the repository: <br>git clone https://github.com/polkascan/polkascan-os.git</li><li>Go to the new folder: <br>cd polkascan-os</li><li>Check available releases: <br>git tag</li><li>Checkout the latest release in the v0.6.x range (replace ‘x’ with highest number): <br>git checkout <a href="https://github.com/polkascan/substrate-interface.git">v0.6.x</a></li><li>Initialize and update submodules: <br>git submodule update --init --recursive</li><li>Build and initialize the other containers: <br>docker-compose -p kusama -f docker-compose.kusama-quick.yml up --build</li><li>The Explorer GUI should now be available in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Ha2sxXv9dawmjA26KP03w.png" /><figcaption>Image 1.4a: Polkascan OS in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></figcaption></figure><h4>1.5. Full deployment of Polkascan</h4><p>This paragraph provides a step-by-step guide on running our milestone 6 release of <em>Polkascan OS </em>on your own machine. This full deployment instruction builds and runs the full <em>Polkascan OS</em> stack. In addition to the <em>Polkascan Explorer GUI</em>, this instruction also runs a <em>Substrate-node</em>, a <em>MySQL DBMS</em>, the <em>Polkascan Harvester</em>, and the <em>Polkascan Explorer API</em>. Please note that fully syncing the Kusama network with a Substrate node and harvesting all required data into a relational database may take up to a full week of work on a heavy machine. Section 1.4 provides a convenience method to only run the user-interface and rely on the databases hosted by Polkascan Foundation.</p><ol><li>Clone the repository: <br>git clone https://github.com/polkascan/polkascan-os.git</li><li>Go to the new folder: <br>cd polkascan-os</li><li>Check available releases: <br>git tag</li><li>Checkout the latest release in the v0.6.x range (replace ‘x’ with highest number): <br>git checkout <a href="https://github.com/polkascan/substrate-interface.git">v0.6.x</a></li><li>Initialize and update submodules: <br>git submodule update --init --recursive</li><li>Build and initialize the MySQL container: <br>docker-compose -p kusama -f docker-compose.kusama-full.yml up -d mysql</li><li>Build and initialize the other containers: <br>docker-compose -p kusama -f docker-compose.kusama-full.yml up --build</li><li>The Explorer GUI should now be available in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></li><li>The Database should now be accessible via your favorite tool: docker-Host: 127.0.0.1<br>Port: 33061<br>Database: polkascan<br>Username: root<br>Password: root</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTyj1pAzkKSwDNu3p-Axsg.png" /><figcaption>Image 1.5a: Polkascan OS via a database explorer</figcaption></figure><h4>1.6. Cleaning up</h4><p>The following [docker] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.<br>docker-compose -p kusama -f docker-compose.kusama-quick.yml down<br>docker-compose -p kusama -f docker-compose.kusama-full.yml down</li><li>Remove all unused containers, volumes and images.<br>docker system prune<br>[confirm] Y</li><li>Remove all containers and images.<br>docker system prune -a<br>[confirm] Y</li><li>Remove all volumes.<br>docker volume prune<br>[confirm] Y</li></ul><h3>2. Accounts, identities &amp; roles</h3><p>This section dives into the enhancements we made to the Polkascan platform, related to accounts, their respective identities and their respective roles.</p><h4>2.1. Account details</h4><p>The account detail page lists a number of useful attributes, related to <em>balances</em>, <em>identities </em>and <em>roles</em>. Identities are attributes that are voluntarily set by accounts. In general these identities are useful for accounts that serve a public function, such as: validators, council members, technical committee members, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xFgRiUCSM-LOS5Hj" /><figcaption><em>Image 2.1a: Account detail — attributes</em></figcaption></figure><h4>2.2. Account transactions</h4><p>An account can submit many types of transactions to the chain. The transaction-tab on the account detail page lists all transactions that have been submitted by the respective account. The details button will navigate to the transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pnL_S7RJuFYDspj1" /><figcaption><em>Image 2.2a: Account detail — Transactions tab</em></figcaption></figure><h4>2.3. Account identities</h4><p>If an account has an on-chain identity set, the user-interface displays this identity everywhere. We have implemented the <a href="https://hackmd.io/-vcRp12EQcuyC9nvfs3GNA">Polkadot Human-Interface Guidelines</a> to the best of our ability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fQyMKzyNmbh4dLbb" /><figcaption><em>Image 2.3a: Account detail — Identities — Polkadot Human-Interface Guidelines</em></figcaption></figure><h4>2.4. Account roles</h4><p>Various special roles can be identified based on the account’s on-chain activity. The Polkascan platform classifies accounts as: <em>validator</em>, <em>nominator</em>, <em>council member</em>, <em>technical committee member</em>, <em>registrar</em>, <em>treasury </em>or <em>sudo</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WLd0OHeuXB3iSB8K" /><figcaption><em>Image 2.4a: Account detail — Roles tab</em></figcaption></figure><p>Various shortcuts have been added to the Accounts-menu to filter accounts based on their current role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ioqOh883LShHg2hm" /><figcaption><em>Image 2.4b: Account detail — Accounts menu shortcuts</em></figcaption></figure><h4>2.5. Account lifecycle</h4><p>An account has a lifecycle. In general an account exists in the state of the chain if it has a balance above the so-called existential deposit. The account-lifecycle tab shows the events when an account is first created and when an account is removed. The details button will navigate to the event detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TZ7p3wUN65Agu4WH" /><figcaption><em>Image 2.5a: Account detail — Account lifecycle tab</em></figcaption></figure><h4>2.6. Identity activity</h4><p>An account’s identity has a lifecycle. In general an identity is set, changed or removed and a Registrar can provide a judgement of the identity. The identity-activity tab shows the events when those identity-related activities occur. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PWWSyOqQFLlLKzh9" /><figcaption><em>Image 2.6a: Account detail — Identity activity tab</em></figcaption></figure><h3>3. Staking, validators and nominators</h3><p>This section dives into the enhancements we made to the Polkascan platform, related to accounts, specifically related to staking, validators and nominators.</p><h4>3.1. Staking activity</h4><p>An account’s staking activity is displayed on the staking activity tab. The tab shows various staking related events and extrinsics, such as: bonding activity, changing payout settings, and specifically for validators when validation activities commence. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gXY_Lbxgar4AQC-E" /><figcaption><em>Image 3.1a: Account detail — Staking activity tab</em></figcaption></figure><p>Additionally for nominators the staking activity tab displays when a nominator changes its nominees. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vg-e6v61URon7S10" /><figcaption><em>Image 3.1b: Account detail — Staking activity tab</em></figcaption></figure><h4>3.2. Staking sessions</h4><p>An account’s staking activity takes place in a session. The sessions in which staking activities have taken place are listed in descending order on the staking sessions tab. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HhSOA5RMyEL2E8Ic" /><figcaption><em>Image 3.2a: Account detail — Staking sessions tab</em></figcaption></figure><h4>3.3. Authored blocks</h4><p>A validator produces blocks. The authored blocks tab lists all blocks that have been produced by the respective account in descending order. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lzgzM0_jR0hwHqr5" /><figcaption><em>Image 3.3a: Account detail — Authored block tab</em></figcaption></figure><h4>3.4. Slash events</h4><p>A validator or nominator could get slashed. The slash events tab lists all slash events for the respective account in descending order. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZZhEQdPu39WWm88p" /><figcaption><em>Figure 3.4a: Account detail — Slash events tab</em></figcaption></figure><h4>3.5. ImOnline activity</h4><p>A validator is required to be online for block production. The imonline activity tab lists all events when a validator is reported as offline. This tab does not show any heartbeat events. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NfKcQNIrdsa76lhG" /><figcaption><em>Image 3.5a: Account detail — ImOnline tab</em></figcaption></figure><h3>4. Democracy, council &amp; technical committee</h3><p>This section dives into the enhancements we made to the Polkascan platform, related to accounts, specifically related to democracy, council and technical committee.</p><h4>4.1. Proposal activity</h4><p>Any account can make a democracy proposal. The proposal activity tab lists all occurrences when an account creates or seconds a proposal.The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kTFJB2bQ-vAUi-1m" /><figcaption><em>Image 4.1a: Account detail — Proposal activity tab</em></figcaption></figure><h4>4.2. Referendum activity</h4><p>Any account can cast a vote on a democracy referendum. The referendum activity tab lists all the account’s votes on referenda. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2p6wk4_yqAnUNELM" /><figcaption><em>Image 4.2a: Account detail — Referendum activity tab</em></figcaption></figure><h4>4.3. Election activity</h4><p>Council members are elected through an elections process. Any account can vote on candidate council members. The election activity tab lists all the account’s votes both from the active perspective as from the passive perspective. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*geY7N9K4yOVq4JaG" /><figcaption><em>Image 4.3a: Account detail — Election activity tab</em></figcaption></figure><h4>4.4. Council terms</h4><p>Elected council members serve a council term. The council terms tab lists all the council member’s council terms in descending order. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qar8dNdURIKuvhoe" /><figcaption><em>Image 4.4a: Account detail — Council terms tab</em></figcaption></figure><h4>4.5. Council activity</h4><p>Elected council members are authorized to propose and vote on council motions. The council activity tab lists all the council member’s council activity in descending order. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kFvmKgJt76bTEiAu" /><figcaption><em>Figure 4.5a: Account detail — Council activity tab</em></figcaption></figure><h4>4.6. Treasury activity</h4><p>Any account can make a treasury spending proposal. The treasury activity tab lists all the account’s proposals for treasury spendings. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*268K-kCutdv_gTaA" /><figcaption><em>Image 4.6a: Account detail — Treasury activity tab</em></figcaption></figure><h4>4.7. Technical committee activity</h4><p>Technical committee members have a limited number of special authorizations in on-chain governance. The techcomm activity tab lists all the technical committee member’s activity in descending order. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7raDR8kTYRYOvEVH" /><figcaption><em>Image 4.7a: Account detail — Transactions tab</em></figcaption></figure><h3>5. Balances</h3><p>This section dives into the enhancements we made to the Polkascan platform, related to account balances.</p><h4>5.1. Balance transfers</h4><p>The balance transfers tab lists a balance transfer activity. This includes regular account-to-account balance transfers but also block author deposits and claims. The details button will navigate to the event or transaction detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-gG0aUJd3TsawNwz" /><figcaption><em>Image 5.1a: Account detail - Balance transfers tab</em></figcaption></figure><h4>5.2. Balance history</h4><p>The balance history tab shows a graph that plots the balance history. This particular example shows the balance history for one of the exchanges that offers a KSM trading pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7Tv7__FowRPHuqUG" /><figcaption><em>Image 5.2a: Account detail — Balance history tab</em></figcaption></figure><h4>5.3. Balance ranking</h4><p>The accounts menu offers an overview page of accounts ranked on balance in descending order, effectively serving as a rich-list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OEM_70vlXirHQ-jW" /><figcaption><em>Figure 5.3a: Account detail — Balance rankings</em></figcaption></figure><h3>About Polkascan</h3><p>Polkascan contributes to the Polkadot ecosystem by providing block exploration and data analytic technologies. We will continue providing updates to our multi-chain explorer platform <a href="https://polkascan.io/">polkascan.io</a> through our not-for-profit organization Polkascan Foundation.</p><p>The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c3fe8e80629" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-6-4c3fe8e80629">Polkascan Development Update #6</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #5]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/58521f2c8d66</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[substrate]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Fri, 31 Jan 2020 16:55:13 GMT</pubDate>
            <atom:updated>2020-01-31T16:55:13.888Z</atom:updated>
            <content:encoded><![CDATA[<h4>Enriched Substrate Interface</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWzFSJsQ4in0utLkwXXWrg.png" /></figure><p>WEB3SCAN’s mission is to make multi-chain data accessible and understandable. With the Polkascan project we are working towards a multi-chain exploration and data analytic platform for the Polkadot-ecosystem.</p><p>This development update is part of our work that provides the Polkadot-ecosystem with an enriched Substrate Interface (API) for any Substrate-based blockchain with full decoding context of the chain’s respective runtime. This update covers the delivery of a general purpose enriched Substrate API and underlying Python libraries for general use.</p><p>Our organization is on an ongoing mission of building multi-chain exploration and data analytic technologies in general and building the Polkascan multi-chain explorer in particular. Our <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">first wave grant</a> resulted in two Python-libraries:</p><ol><li><a href="https://github.com/polkascan/py-scale-codec">Py-Scale-Codec<br></a>Substrate is agnostic with respect to the data in its runtime and its data is encoded by the <em>SCALE Codec</em>. Our <em>Python SCALE-Codec library </em>is a Python implementation of the lightweight, efficient, binary serialization and deserialization codec. The codec allows its users to work with meaningful data when interacting with JSON-RPC API.</li><li><a href="https://github.com/polkascan/py-substrate-interface">Py-Substrate-Interface<br></a>The <em>Python Substrate Interface library</em> provides a python based abstraction layer for repetitive tasks when querying Substrate-nodes for required data.</li></ol><p>Our previous work limited the scope of these libraries to match the requirements of our block explorer use-case. This project extends and feature-completes these two libraries for general use beyond the scope of our block explorer use-case. The project’s deliverables make multi-chain data accessible and understandable without the need for a rich database as in our block explorer use-case.</p><p>Our team has been active in the Polkadot-ecosystem from day one, we believe Substrate and the Polkadot Runtime Environment will solve many industry-wide problems. Additionally we are highly invested in Python. This project aims to lower the friction of using Python with Substrate-based chains and the completion of the Python-libraries will benefit many teams in the ecosystem. On top of that, this grant work will allow on-boarding of Python developers to integrate with existing or new Python-applications or applications in any other language with existing and new Substrate chains.</p><h3>1. Getting started</h3><p>This development update will help you get started by running a release of the enriched <em>Substrate Interface</em> yourself.</p><h4>1.1. Substrate Interface on Github</h4><p><strong><em>Repositories</em>: </strong>The source code of the enriched <em>Substrate Interface </em>can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of a number of distinct repositories which collectively form the enriched <em>Substrate Interface</em>. We apply a number of conventions for branches and versioned releases across these repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JioBCGFfW6d-dKYv" /><figcaption><em>Image 1a: Polkascan on Github:</em><a href="https://github.com/polkascan"><em> https://github.com/polkascan</em></a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent work in the <em>master</em>-branch.<br><strong><em>Releases</em>: </strong>This development update’s work is released and tagged as ‘v0.9.x’.</p><h4>1.2. What makes Substrate Interface?</h4><p><em>Substrate Interface </em>consists of a number of distinct software artifacts which collectively orchestrate the interface. The <a href="https://github.com/polkascan/substrate-interface-api"><em>Substrate Interface API</em></a><em> </em>provides JSON-RPC end-points that allow for enriched interaction with Substrate’s standard JSON-RPC interface with the help of <a href="https://github.com/polkascan/py-substrate-interface"><em>Python Substrate Interface Library</em></a> and the <a href="https://github.com/polkascan/py-scale-codec"><em>Python SCALE Codec Library</em></a>. We have included <a href="https://github.com/polkascan/substrate-interface-gui"><em>Substrate Interface GUI</em></a> as a basic user interface to showcase how the enriched interface could be applied in front-end Typescript application. We have chosen to provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root. Although these four distinct components of the enriched <em>Substrate Interface</em> could be applied independently (in other projects), we offer a fifth piece of software, called: <a href="https://github.com/polkascan/substrate-interface"><em>Substrate Interface</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ol><li>Recommended hardware: Memory: &gt;2GB (more is better), Storage: &gt;5GB (SSD is better), Processor: more and faster cores is better (Intel i3).</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of the enriched <em>Substrate Interface </em>has been tested on Mac, Linux and Windows.</li></ol><h4>1.4. Running Substrate Interface</h4><p>This paragraph provides a step-by-step guide on running our v0.9.* release of the enriched <em>Substrate Interface</em> on your own machine. The instructions outlined in this paragraph can be found in our <a href="https://github.com/polkascan/polkascan-pre/tree/milestone3">Github repository</a>.</p><ol><li>Clone the repository: <br>git clone https://github.com/polkascan/substrate-interface.git</li><li>Go to the new folder:<br>cd substrate-interface</li><li>Check available tagged releases: <br>git tag</li><li>Checkout latest release in the 0.9.x range (replace ‘x’ with highest number): <br>git checkout 0.9.x</li><li>Initialize and update submodules: <br>git submodule update --init --recursive</li><li>Build and initialize the other containers: <br># Default public Kusama CC3 node by Parity Technologies<br>docker-compose up --build<br># OR<br># Local Kusama CC3 archive node<br>docker-compose -f docker-compose.kusama-cc3-local.yml up --build</li><li>The <em>Substrate Interface API</em> should now be available for use in Postman: <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></li><li>The <em>Substrate Interface GUI</em> should now be available in a browser: <a href="http://127.0.0.1:8001/">http://127.0.0.1:8001</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gARAFwpwytGnzlpz" /><figcaption><em>Image 1b: Substrate Interface API in Postman: </em><a href="http://127.0.0.1:8000/"><em>http://127.0.0.1:8000</em></a></figcaption></figure><h4>1.5. Considerations</h4><p>Step 6 in section 1.4 builds and runs a Substrate Interface that uses a public Substrate-node for Kusama CC3 serviced by Parity Technologies (wss://kusama-rpc.polkadot.io/). An alternative is listed that runs a full local archive node for Kusama CC3. Running a local node may be useful when a higher performance (network i/o) is required or if you run into firewall issues when setting up a persistent WebSocket connection with the public node.</p><h4>1.6. Cleaning up</h4><p>The following [docker] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.<br>docker-compose down<br># OR<br>docker-compose -f docker-compose.kusama-cc3-local.yml down</li><li>Remove all unused containers, volumes and images.<br>docker system prune<br>[confirm] Y</li><li>Remove all containers and images.<br>docker system prune -a<br>[confirm] Y</li><li>Remove all volumes.<br>docker volume prune<br>[confirm] Y</li></ul><h3>2. Substrate Interface API</h3><p>Substrate Interface API provides a JSON-RPC interface to a Substrate-node and is fully compatible with JSON-RPC interface of a regular Substrate-node. E.g. the RPC-method <em>chain_getBlock</em> provides the details of a block at the current head of the chain. The RPC-method <em>rpc_methods</em> provides a discovery mechanism of the supported RPC-methods for all known groups, such as: <em>author</em>, <em>chain</em>, <em>state</em>, <em>system</em>, etc.</p><p>Substrate Interface API extends the available RPC-methods with an entirely new group called: <em>runtime</em>, which enriches the JSON-RPC interface with all data particular to the current and previous runtimes of the Substrate-node.</p><p>The extension allows for discovery-mechanisms of the runtimes’ <em>metadata</em> with various levels of granularity such as: <em>modules</em>, <em>call functions</em>, <em>storage functions</em>, <em>events</em>, <em>constants</em>, <em>errors</em> and <em>type-registry</em>. In turn these discovery-mechanisms enable querying the Substrate-node’s storage with the decoding-context of the runtimes’ metadata and allow for composing transactions with the encoding-context of the runtimes’ <em>metadata</em>. These composed transactions are in turn fully prepared for signing by an external wallet or signer such as <a href="https://www.parity.io/signer/">Parity Signer</a>.</p><p>The current and extended RPC-methods have been fully documented through a Postman Collection and can be found <a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH?version=latest">here</a>. The documentation provides tested examples for all current and extended RPC-methods and can easily be imported into your own Postman application by clicking on the ‘<em>Run in Postman</em>’ button at the top of the screen in the documented Postman Collection. After following the <em>getting started</em> instructions, the Substrate Interface API should be available for use in Postman through the following URI: <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a>. This URI should be pre-configured in the Postman Collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yKhaypqumRthILxv" /><figcaption><em>Image 2a: Documentation: </em><a href="https://documenter.getpostman.com/view/9969999/SWT5iLXH?version=latest"><em>Postman collection</em></a></figcaption></figure><p>Substrate Interface API provides an enriched JSON-RPC interface to a Substrate-node. The JSON-RPC standard is a general interface envelop that any developer can use regardless of their respective development environment. The documented Postman Collection provides code-snippets for up to 25 distinct development environments (<em>C#</em>, <em>cURL</em>, <em>Go</em>, <em>Java</em>, <em>Javascript</em>, <em>NodeJs</em>, <em>OCaml</em>, <em>PHP</em>, <em>Python</em>, <em>Ruby</em>) for all included RPC-methods. This should illustrate the broad applicability of our grant work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sm49ms2iULm-opzz" /><figcaption><em>Image 2b: Documentation: Postman collection code-snippets for Go-Native</em></figcaption></figure><p>The example (image 2c) illustrates these ease at which a <em>FreeBalance</em> can be queried for a <em>SS58-encoded account address</em> through Postman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DI5NFoX7J1dIVvG5" /><figcaption><em>Image 2c: Example using Substrate Interface API with Postman</em></figcaption></figure><h3>3. Substrate Interface GUI</h3><p>After following the <em>getting started</em> instructions, the Substrate Interface GUI should be available in a browser through the following URI: <a href="http://127.0.0.1:8001/">http://127.0.0.1:8001</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A3_VIjosKzls8CLRDHtrbg.png" /><figcaption><em>Image 3a: Substrate Interface GUI</em></figcaption></figure><p>Substrate Interface GUI provides three generic sections covering: <em>executing raw RPCs</em>, <em>querying chain state</em> and <em>composing transactions. </em>These sections replicate the similar respective functions of <a href="https://polkadot.js.org/apps">Polkadot JS Apps</a> without any need for the Typescipt/Javascript libraries used by the latter. The following table provides the hyperlinks to the Substrate Interface GUI sections and their Polkadot JS Apps counterpart.</p><pre>| <strong>Section      </strong>| <strong>Substrate Interface GUI</strong> | <strong>Polkadot JS Apps</strong> |                 <br>|--------------|-------------------------|------------------|<br>| Raw RPC      | <a href="http://127.0.0.1:8001/rpc-calls">link</a>                    | <a href="https://polkadot.js.org/apps/#/toolbox">link</a>             |<br>| Chain State  | <a href="http://127.0.0.1:8001/chain-state">link</a>                    | <a href="https://polkadot.js.org/apps/#/chainstate">link</a>             |<br>| Compose Call | <a href="http://127.0.0.1:8001/compose-call">link</a>                    | <a href="https://polkadot.js.org/apps/#/extrinsics">link</a>             |</pre><p><strong>Execute raw remote procedure calls (RPCs)</strong><br>The <em>method </em>control lists all remote procedure call methods the Substrate Interface offers. This includes all native Substrate-client methods and thus provides full backwards compatibility with a regular Substrate-client. Additionally a large number of <em>new </em>methods are available related to this project’s grant work. The example (image 3b) illustrates these ease at which <em>the TypeRegistry </em>of the Kusama CC3 runtime can be queried at any block height (by BlockNumber or BlockHash).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8M-zQfzlcWt4GxUolZGjWw.png" /><figcaption><em>Image 3b: Substrate Interface GUI: RPC methods</em></figcaption></figure><p><strong>Query runtime chain state</strong><br>The <em>storage function</em> control lists all storage functions the runtime offers. The example (image 3c) illustrates these ease at which a <em>FreeBalance</em> can be queried for a <em>SS58-encoded account address</em> at any block height (by BlockNumber or BlockHash).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HA6EizJiFQf1sqLAbNQLbw.png" /><figcaption><em>Image 3c: Substrate Interface GUI: Chain state methods</em></figcaption></figure><p><strong>Compose calls (unsigned transaction payloads)</strong><br>The <em>call function</em> control lists all call functions the runtime offers. The example (image 3d) illustrates these ease at which a <em>Balances.Transfer</em> transaction payload can be composed for a <em>SS58-encoded account address</em>. Unsigned transaction payloads can be signed by external wallets/signers such as Parity Signer. This requires some further research and requires implementation of <a href="https://github.com/maciejhirsz/uos">Universal Offline Signatures</a> through <a href="https://github.com/polkadot-js/ui/tree/master/packages/react-qr">QR-codes</a>. Hence external signing remains off-scope for this project’s deliverables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ddd3P8uvpCd2UEM5t7KrlA.png" /><figcaption><em>Image 3d: Substrate Interface GUI: Compose call (unsigned transaction payload)</em></figcaption></figure><p>Final note: Substrate Interface GUI has been included primarily as a convenience for it illustrates how to utilize the Substrate Interface API (section 2) in a Typescript (Angular) application framework. That said, this artifact is far from polished and warrants significant enhancement, such as: <em>dynamic input-control parsing</em> for varying types of each of the three sections’ input-parameters. Such feature is however beyond the scope of this project.</p><h3>4. Python Substrate Interface</h3><p>The Python Substrate Interface library specializes in interfacing with a Substrate node, providing additional convenience methods to deal with <em>SCALE encoding/decoding</em> (the default output and input format of the Substrate JSON-RPC), <em>metadata parsing</em>, <em>type registry management</em> and <em>versioning of types</em>. The Python Substrate Interface library is utilized by the Substrate Interface (and of course by the broader Polkascan-stack).</p><p>The grant work that has been completed with this development update has feature-completed the Python Substrate Interface for general use and can be used as an independent Python library.</p><p>Full Python library documentation has been made available through <a href="https://pdoc3.github.io/pdoc/">Pdoc</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cHnzFZzy-rbwgTZ-" /><figcaption><em>Image 4a: Documentation: </em><a href="https://polkascan.github.io/py-substrate-interface/"><em>Python Substrate Interface</em></a></figcaption></figure><p>The documentation illustrates how to use all available methods. These methods should look familiar since feature-wise it repeats the available JSON-RPC-methods that have been made available through the Substrate Interface API (section 2).</p><p>The grant work provides a full stack of artifacts to illustrate how this library could be applied. That said, this library could be applied independently in any Python-based application. The <a href="https://github.com/polkascan/py-substrate-interface/blob/master/README.md">readme</a> in the root of the repository provides details on how to get started with using the Pyhton Substrate Interface library in your own Python project.</p><p><strong>Initialization</strong><br>Initialize the interface and get head block hash of Kusama CC3 chain. WebSocket support is still quite limited at the moment as connections are not yet re-used. Until support is improved it is recommended to use HTTP-endpoints with your local Substrate-node (e.g.<a href="http://127.0.0.1:9933/"> http://127.0.0.1:9933</a>)</p><pre>substrate = SubstrateInterface(<br> url=&quot;wss://kusama-rpc.polkadot.io/&quot;,<br> address_type=2,<br> type_registry_preset=&#39;kusama&#39;<br>)<br>substrate.get_chain_head()</pre><p>The readme contains additional examples that illustrate how to <em>get extrinsics for a certain block</em>, <em>make a storage call</em> and <em>compose an unsigned transaction payload</em>.</p><h3>5. Python SCALE Codec</h3><p>The Python SCALE Codec library is a lightweight, efficient, binary serialization and deserialization codec. The Python SCALE Codec is utilized by the Python Substrate Interface (and of course by the broader Polkascan-stack).</p><p>The grant work that has been completed with this development update has feature-completed the Python SCALE Codec for general use and as an independent Python library.</p><p>Full Python library documentation has been made available through <a href="https://pdoc3.github.io/pdoc/">Pdoc</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*si8bzBBTFDJb-eeC" /><figcaption><em>Image 5a: Documentation: </em><a href="https://polkascan.github.io/py-scale-codec/"><em>Python Scale Codec</em></a></figcaption></figure><p>Additionally — as part of the grant work — we have provided an extensive set of <a href="https://github.com/polkascan/py-scale-codec/tree/master/test">unit tests</a> to assure quality and conformity of the library’s functionality. Additionally these unit tests should provide a Python developer with sufficient hints on how to utilize the library’s rich features. The Python SCALE Codec’s unit tests include the following sections: <em>metadata</em>, <em>type-encoding</em>, <em>type-registry</em>, <em>core scale-type</em> and <em>compose transaction payload</em>.</p><p>The unit-test in the example (image 5.b) illustrates how to compose an unsigned transaction payload for a balance transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z9FNVIB3Eh5_7x-j" /><figcaption><em>Image 5b: Unit tests for </em><a href="https://github.com/polkascan/py-scale-codec/blob/master/test/test_extrinsic_payload.py"><em>composing transactions</em></a><em>: Balances.Transfer</em></figcaption></figure><p>The input of the unit test illustrates how to use a <em>SS58-encoded account address</em> or a <em>HEX-formatted public key</em> to identify the account and then illustrates how to use a <em>decimal representation of the amount</em> to be transferred. The unit-test results in an <em>unsigned transaction payload</em>, which could be signed by an external wallet provider or signer, such as <em>Parity Signer</em> (as illustrated in section 2 which covers the Substrate Interface GUI). The unit-tests evaluate the quality of the library’s methods with an expected output. The base-line for the expected outputs for all unit-tests in the <em>compose transaction payload</em> section have been gathered from the <em>Polkadot JS Apps</em> application as a reference client. Since the unit-tests are complete for a recent <em>Kusama CC3 runtime (1040)</em>, we are fairly confident that the Python SCALE Codec conforms to features of the available reference clients of SCALE Codec (<a href="https://github.com/polkadot-js/api/tree/master/packages/types"><em>JS</em></a><em> </em>and <a href="https://github.com/paritytech/parity-scale-codec"><em>RUST</em></a>).</p><h3>6. Outlook</h3><p>With this development update and the respective deliverables we have gone beyond the work we outlined in our <a href="https://github.com/w3f/Web3-collaboration/blob/master/grants/speculative/python_substrate_api.md">grant application</a>. This project could result in being the go-to library/application for any non-Typescript application developer that intends to interact with any Substrate-runtime. The artifacts of this project provide a rich API to the Substrate-runtime with full decoding context. Our team will continue to develop and mature the artifacts that have been covered in this development update.</p><h4>6.1. Immediate future development activities</h4><ol><li><strong>Onboarding networks</strong><br>Substrate Interface currently supports Kusama CC3. We aim to provide turn-key support for all major public Substrate-networks.</li><li><strong>WS-support</strong><br>Extension of the currently limited WebSocket support of Substrate Interface.</li><li><strong>Refactoring block explorer repositories</strong><br>Substrate Interface allows for a better separation of concerns in our existing block explorer repositories. A significant amount of refactoring will happen which will improve and clean-up the block explorer repositories code-base.</li><li><strong>Parity Signer support</strong><br>Unsigned transaction payloads can be signed by external wallets/signers such as Parity Signer. This requires some further research and requires implementation of <a href="https://github.com/maciejhirsz/uos">Universal Offline Signatures</a> through <a href="https://github.com/polkadot-js/ui/tree/master/packages/react-qr">QR-codes</a>.</li><li><strong>Beta release</strong><br>A v1.0 beta release of Substrate Interface will be released at some point in the near future.</li></ol><h4>6.2. Exploration of major future projects</h4><ol><li><strong>Polkadot JS Apps alternative</strong><br>The grant work covered in this development update has resulted in a number of low-level feature-complete Python libraries. We will be exploring the development of a full <a href="https://github.com/polkadot-js/apps">Polkadot JS Apps</a> alternative based solely on our Python stack. The appeal of this approach to the broader community would be to have a full alternative to Polkadot JS Apps without any reliance on Javascript/Typescript based libraries. Polkadot JS Apps is becoming increasingly important to the broader Polkadot/Substrate community and from a risk management/mitigation perspective the community would benefit from a completely independent alternative.</li><li><strong>Python-based Polkadot Runtime Environment</strong><br>The python libraries aligns with our mid to long-term objective of building a full Python-based implementation of the Polkadot Runtime Environment (PRE). Critical components for building a Python PRE are: 1) SCALE-codec, 2) Trie DB, 3) Libp2p Networking, 4) Consensus Babe/Grandpa. 5) WASM interpreter. Time can work in our favor since some components (3 and 5) may be available soon due to work in neighboring communities.</li></ol><h3>About Polkascan &amp; WEB3SCAN</h3><p>Polkascan contributes to the Polkadot ecosystem by providing block exploration and data analytic technologies. We will continue providing updates to our multi-chain explorer platform <a href="https://polkascan.io/">polkascan.io</a>. The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58521f2c8d66" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-5-58521f2c8d66">Polkascan Development Update #5</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Economic Analysis]]></title>
            <link>https://medium.com/polkadot-network/polkascan-economic-analysis-a5861abef63f?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5861abef63f</guid>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[economic-analysis]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[accountancy]]></category>
            <category><![CDATA[polkadot]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 16:02:27 GMT</pubDate>
            <atom:updated>2019-12-03T16:02:27.231Z</atom:updated>
            <content:encoded><![CDATA[<h4>Financial accounting methods for cyberspace economies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NzeT_R79GRghvSZFV7LkFg.png" /></figure><p>WEB3SCAN’s mission is to make multi-chain data accessible and understandable. With the Polkascan project, we are working towards a multi-chain exploration and data analytic platform for the Polkadot-ecosystem.</p><p>This article asserts that a multi-chain and its native economic agents function similarly to a regular (geographically bound) economy and its constituent economic agents. By borrowing established (mental) models we bring about novel ways of thinking about the financial performance of cyberspace economies and their respective native constituents.</p><p>Microeconomic analysis and macroeconomic analysis are well-established fields that provide research and practices for thinking about financial performance of geographically bound economies and their economic agents.</p><p>This article explores one such microeconomic analysis method, called: ‘financial accounting’. We introduce the notion of ‘Cyberspace Accountancy’ as a new way to think about financial performance of cyberspace economies and their native constituents. By applying financial accounting practices on blockchains, its multi-chain data is made accessible and understandable for a wide and potentially new audience, beyond the tech-savvy.</p><h3>1. Cyberspace economies</h3><p>This article asserts that multi-chains and their respective native economic agents function similarly to <em>regular geographically bound economies</em> and their respective constituent economic agents. Blockchain economies exist in cyberspace and regular economies exist in geographical space. <a href="https://www.eff.org/cyberspace-independence">Cyberspace is inherently different from geographical space</a>. That said, at WEB3SCAN we believe it is not a stretch to assert that a blockchain fits the definition of an economy.</p><h4>1.1. What makes an economy?</h4><p>An <a href="https://en.wikipedia.org/wiki/Economy">economy</a> is an area of the production, distribution and trade, as well as consumption of goods and services by different agents. Understood in its broadest sense, ‘<em>The economy is defined as a social domain that emphasize the practices, discourses, and material expressions associated with the production, use, and management of resources</em>’. Economic agents can be individuals, businesses, organizations, or governments. Economic transactions occur when two groups or parties agree to the value or price of the transacted good or service, commonly expressed in a certain currency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BRhoom0xRA-BYxcF" /><figcaption><em>Image 1.1: Cyberspace economies (</em><a href="https://relaychain.fm/5-polkascan-open-source-block-explorer"><em>Relay Chain Podcast #5</em></a><em>)</em></figcaption></figure><p>It is common to refer to activities related to a blockchain as <em>on-chain</em> and <em>off-chain</em>. A blockchain’s on-chain activities clearly delineate a <em>social domain </em>and thus boundary of an <em>economy</em>. Such cyberspace economies have particular practices (<em>mining</em>, <em>staking</em>), discourses (<em>finality</em>, <em>security</em>, <em>immutability</em>, <em>sovereignty</em>), and material expressions associated with the production (<em>states</em>, <em>protocols</em>, <em>runtimes</em>, <em>smart contracts</em>), use (<em>state changes</em>, <em>transactions</em>), and management (<em>policy</em>, <em>governance</em>) of resources.</p><h4>1.2. Cyberspace economies</h4><p>With Bitcoin, cyberspace economies started as relatively simple economies with only limited classes of economic agents.</p><ol><li><strong>The protocol serves as a central bank and regulator of the economy</strong><br>The <em>blockchain protocol</em> has a dual-function to serve as a <em>central bank</em>, enforcing <em>monetary policy</em> and to serve as a <em>regulator</em>, enforcing the <em>rules of the cyberspace economy</em> in the broadest sense.</li><li><strong>Accounts are simple economic agents</strong><br>Accounts are the simplest of economic agents in a cyberspace economy. Accounts are externally enactable native economic agents capable of owning the economy’s native assets and transacting with those assets within the cyberspace economy.</li><li><strong>Miners are specialized economic agents</strong><br>Miners are specialized accounts. Miners benefit as economic agents by producing the cyberspace’s native assets.</li></ol><p>In the context of economies and their constituent economic agents, a significant number of technological innovations have been made in the blockchain industry over the past 10 years. More sophisticated and more specialized economic agents have emerged within cyberspace economies. Furthermore, cyberspace economies increasingly show characteristics of open-economies rather than the closed-economies they have been so far.</p><h4>1.3. Specialized economic agents</h4><p>Innovations in economic agents’ ability to specialize have so far gone through three distinct eras which we coin as the <em>Protocol Era</em>, the <em>Smart Contract Era</em> and the <em>Interoperability Era</em>.</p><ol><li><strong>Protocol Era (2008–2013)<br></strong>The <em>protocol era</em> peaked with Bitcoin as the dominant cyberspace economy with its relatively simple economic agents. In this era there were significant barriers to introduce new classes of economic agents (<a href="https://en.bitcoin.it/wiki/Script"><em>Script</em></a>). Additionally in this era there were significant barriers to changing the rules of the economy (<a href="https://en.wikipedia.org/wiki/Fork_(blockchain)"><em>forks</em></a>). These drawbacks were a major driver for the emergence of alternative cyberspace economies, with altered protocols and new classes of economic agents.</li><li><strong>Smart Contract Era (2014–2019)<br></strong>The <em>smart contract era</em> peaked with Ethereum as a dominant cyberspace economy. This era provided solutions to drawbacks of the <em>protocol era</em> by lowering the barriers to introduce new classes of economic agents and by enabling the creation of sub-economies within the larger cyberspace economy. The Ethereum Virtual Machine (<em>EVM</em>) and its programmable smart contracts spawned an explosion of new specialized economic agents (<a href="https://en.wikipedia.org/wiki/Smart_contract"><em>smart contracts</em></a>) and sub-economies (<a href="https://etherscan.io/tokens"><em>tokens</em></a>). More importantly, this era brought so-called <em>intraoperability</em>: i.e. <em>interoperability between these sub-economies</em> but still within the boundaries of the larger cyberspace economy. Limits to the capacity of smart contract platforms (<em>cost</em>, <em>throughput</em>) were a major driver for the emergence of alternative smart contract blockchains, again with altered protocols and again with new economic agents.</li><li><strong>Interoperability Era (&gt;2020)<br></strong>Most blockchains so far have been (and will remain) in a complete state of <a href="https://en.wikipedia.org/wiki/Autarky">autarky</a>. Autarky is the characteristic of self-sufficiency; the term is usually applied to political states or their economic systems. Autarky exists whenever an entity can survive or continue its activities without external assistance or international trade. If a self-sufficient economy also refuses to conduct any trade with the outside world then economists may term it a closed economy.<br>There are clear signs of major innovations in the blockchain industry that allow cyberspace economies to become more open economies. An <a href="https://en.wikipedia.org/wiki/Open_economy">open economy</a> is a type of economy where the domestic community and foreign communities have trade in products (goods and services).<br>The main benefit of open-economies is foreign trade (importing and exporting). In the context of blockchains, this implies a blockchain’s ability to sell goods or services to another blockchain and to buy goods and services from another blockchain.<br>A number of projects are making significant progress towards more open cyberspace economies through working on <em>blockchain interoperability</em>. We at WEB3SCAN believe that Polkadot holds the best cards to dominate the <em>interoperability era</em> by fostering specialized cyberspace economies and by fostering the broadest foreign trade mechanisms imaginable between these specialized cyberspace economies.</li></ol><h4>1.4. Specialized economies</h4><p>The value proposition of specialized economic agents within cyberspace economies was established in the <em>smart contract era</em>. However, the degree of specialization of its economic agents of this era’s cyberspace economies is inherently bound by the rules of the respective cyberspace economies themselves. In this regard, Polkadot advances its design from Ethereum 2.0 by implementing interoperability as a heterogeneous multi-chain rather than as a homogeneous multi-chain.</p><p>Ethereum 2.0 beacon chain will create a sharded multi-chain of many Ethereum Virtual Machines (EVMs) in ‘Execution Environments’. This will no doubt provide a scaling solution for cost and throughput. However, each of the autonomous shard-chains of the Ethereum 2.0 multi-chain will inherently be bound by the performance constraints of the identical EVM’s gas-systems of the individual shards. It should be acknowledged that an EVM is but one class of cyberspace economies and the Ethereum 2.0 multi-chain will, therefore, be a <em>homogeneous</em> multi-chain.</p><p>The Polkadot relay chain design, on the other hand, has a higher level of abstraction and allows interoperability between more classes of cyberspace economies. It is thus a <em>heterogeneous</em> multi-chain. Simply put, rather than facing the lock-in Ethereum 2.0’s Execution Environments introduce, Polkadot parachains and parathreads will be able to build their own state machine in their chain’s Wasm Runtime, optimized to their use case.</p><p>The <em>smart contract era</em> spawned many <em>software development kits</em> (SDKs) to foster the design of <em>cyberspace economic agents</em>. The <em>interoperability era</em> will spawn <em>SDKs</em> to foster the design of <em>cyberspace economies</em> as a whole. <a href="https://substrate.dev/"><em>Substrate</em></a> is a prime example of an advanced SDK that truly opens up the design space for cyberspace economy architects.</p><p>If the <em>smart contract era</em> explored the value proposition of specialization of economic agents within cyberspace economies, the <em>interoperability era</em> will explore the value proposition of specialization of cyberspace economies as a whole.</p><h4>1.5. Foreign trade</h4><p>The value proposition of <em>domestic trade</em> of cyberspace economies was established in the <em>smart contract era</em>. Each of the sub-economies that exist within any EVM-instance is perhaps characterized by their respective sub-economy’s token. The <em>smart contract era </em>showed that sub-economies can specialize and benefit by trading with other sub-economies within the larger cyberspace economy. A prime example is the <a href="https://makerdao.com/en/">DAI stable coin</a> sub-economy and its role in its larger cyberspace economy.</p><p>Such token-economies however are only scratching the surface of the design space that economic trade in cyberspace economies may have. Many examples of value propositions exist within the Ethereum cyberspace economy that go beyond the utility of a mere token. Examples that spring to mind are <a href="https://en.wikipedia.org/wiki/Decentralized_exchange">DEX</a>s, <a href="https://en.wikipedia.org/wiki/The_DAO_(organization)">DAO</a>s, <a href="https://en.wikipedia.org/wiki/Non-fungible_token">NFT</a>s, or any other smart contract-based economic agents that gain traction without a necessity for a primary role of the sub-economy’s (fungible) token in itself.</p><p>Interoperability leads to the emergence of foreign trade between cyberspace economies. If the <em>smart contract era</em> explored the value proposition of <em>domestic trade</em> of economic agents within cyberspace economies, the <em>interoperability era</em> will explore the value proposition of <em>foreign trade</em> between economic agents in different cyberspace economies.</p><p>One of the areas where Polkadot presents a clear advantage in design over existing systems is Polkadot’s ability to express foreign trade as arbitrary messages between cyberspace economies. While competing systems’ messaging is constrained to token-swaps as foreign trade mechanism, the <a href="https://medium.com/polkadot-network/polkadot-the-foundation-of-a-new-internet-e8800ec81c7">Polkadot relay chain can send arbitrary messages</a>, trust-free, between chains. Interchain messaging provides the most utility with the lowest friction when you want to have one chain autonomously affect a change of state on another chain. Arbitrary messaging is a prime example of a mechanism that truly opens up the design space for foreign trade between cyberspace economies.</p><h4>1.6. Economic analysis</h4><p>Microeconomic analysis and macroeconomic analysis are well-established fields that provide research and practices for thinking about behavior and financial performance of geographically bound economies (macroeconomics) and their constituent economic agents (microeconomics).</p><ol><li><strong>Macroeconomics</strong><br><a href="https://en.wikipedia.org/wiki/Macroeconomics">Macroeconomics</a> is a branch of economics dealing with the performance, structure, behavior, and decision-making of an economy as a whole. This includes regional, national, and global economies. While macroeconomics is a broad field of study, there are two areas of research that are emblematic of the discipline: the attempt to understand the causes and consequences of short-run fluctuations in national income (the business cycle), and the attempt to understand the determinants of long-run economic growth (increases in national income). Macroeconomic models and their forecasts are used by governments to assist in the development and evaluation of economic policy.</li><li><strong>Microeconomics</strong><br><a href="https://en.wikipedia.org/wiki/Microeconomics">Microeconomics</a> is a branch of economics that studies the behavior of individuals and firms in making decisions regarding the allocation of scarce resources and the interactions among these individuals and firms. One goal of microeconomics is to analyze market mechanisms that establish relative prices among goods and services and allocate limited resources among alternative uses. Microeconomics shows conditions under which free markets lead to desirable allocations.</li></ol><p>This article explores one such microeconomic analysis method, called: ‘financial accounting’. We introduce the notion of ‘Cyberspace Accountancy’ as a new way to think about the financial performance of cyberspace economies and their native economic agents. By applying financial accounting practices on blockchains, their combined multi-chain data is made accessible and understandable for a wide and potentially new audience, beyond the tech-savvy.</p><p>Future work may include other microeconomic analysis methods and macroeconomic analysis methods to further our thinking about aspects of cyberspace economies such as <em>aggregate economic activity</em>, <em>issues of growth</em>, <em>inflation</em>, <em>monetary policy</em> and more.</p><h3>2. Accountancy</h3><p><a href="https://en.wikipedia.org/wiki/Accounting">Accounting or accountancy</a> is the measurement, processing, and communication of financial and non-financial information about economic entities such as businesses and corporations. The terms <em>accounting</em> and <em>financial reporting</em> are often used as synonyms. Accounting can be divided into several fields including <em>financial accounting</em>, <em>management accounting</em>, <em>external auditing</em>, <em>tax accounting</em> and <em>cost accounting</em>. The remainder of this article will focus on the sub-field <em>financial accounting</em>.</p><h4>2.1. Financial Accounting</h4><p><a href="https://en.wikipedia.org/wiki/Financial_accounting">Financial accounting</a> is the field of accounting concerned with the summary, analysis and reporting of financial transactions related to a business. This involves the preparation of financial statements available for public use. Stockholders, suppliers, banks, employees, government agencies, business owners, and other stakeholders are examples of people interested in receiving such information for decision-making purposes.</p><h4>2.2. Financial statements</h4><p>Financial statements generally have three distinct components:</p><ol><li><strong>Statement of financial position (balance sheet)</strong><br>The balance sheet is a financial statement showing a firm’s <em>assets</em>, <em>liabilities</em> and <em>equity</em> (capital) at a set point in time, usually the end of the fiscal year reported on the accompanying income statement. The total assets always equal the total combined liabilities and equity. This statement best demonstrates the basic accounting equation: Assets = Liabilities + Equity. The statement can be used to help show the status of a company.</li><li><strong>Statement of profit and loss</strong><br>The <em>statement of profit</em> or <em>income statement</em> represents the changes in the value of a company’s accounts over a set period and may compare the changes to changes in the same accounts over the previous period. All changes are summarized on the ‘bottom line’ as net income or ‘net loss’ when income is less than zero.</li><li><strong>Statement of cash flows</strong><br>The statement of <em>cash flows</em> considers the inputs and outputs in concrete cash within a stated period. This component will remain off-scope in the remainder of this article.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*woyeu72omTHk3NBQ" /><figcaption><em>Image 2.1: Financial statements: balance sheet + profit &amp; loss</em></figcaption></figure><h4>2.3. Qualitative characteristics of financial statements</h4><p>Financial accounting is the preparation of financial statements that can be consumed by the public and the relevant stakeholders. Financial information would be useful to users if such qualitative characteristics are present. When producing financial statements, the following qualitative characteristics apply:</p><ol><li><strong>Relevance</strong><br>Relevance is the capacity of financial information to influence the decision of its users. The ingredients of relevance are the predictive value and confirmatory value.</li><li><strong>Faithful representation</strong><br>Faithful representation means that the actual effects of the transactions shall be properly accounted for and reported in the financial statements. The words and numbers must match what really happened in the transaction. The ingredients of faithful representation are completeness, neutrality and free from error.</li><li><strong>Verifiability</strong><br>Verifiability implies a consensus between the different knowledgeable and independent users of financial information. Such information must be supported by sufficient evidence to follow the principle of objectivity.</li><li><strong>Comparability</strong><br>Comparability is the uniform application of accounting methods across entities in the same industry. The principle of consistency is under comparability. Consistency is the uniform application of accounting across points in time within an entity.</li><li><strong>Understandability</strong><br>Understandability means that accounting reports should be expressed as clearly as possible and should be understood by those to whom the information is relevant.</li><li><strong>Timeliness</strong><br>Timeliness implies that financial information must be presented to the users before a decision is to be made.</li></ol><h3>3. Cyberspace Accountancy</h3><p>This section explores what financial statements would show for economic agents in cyberspace economies.</p><h4>3.1. Accounts</h4><p>Accounts are the simplest economic agent in cyberspace economies. Accounts are externally enactable native agents capable of executing transactions. In Polkadot, Kusama and most other Substrate-based blockchains, accounts have balances, can make balance transfers and can participate in staking activities. The financial statements for this class of economic agents can be found in image 3.1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c0HfLCPOGmKJmVVI" /><figcaption><em>Image 3.1: Financial statements for accounts</em></figcaption></figure><h4>3.2. Validators and nominators</h4><p>Validators actively participate in the block production mechanism and contribute to the security of the cyberspace economy. Although validators can be enacted by individual accounts, more often a ‘validator’ comprises a more sophisticated construct including many ‘nominators’. Validators and nominators combined provide economic staking services in which good behavior is rewarded and bad behavior is punished. On Polkadot and Kusama, validators and nominators have a native reporting period measured in <em>epochs </em>and <em>eras</em>. The financial statements for this class of economic agents can be found in image 3.2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jmeldoiVGX4Y6_FF" /><figcaption><em>Image 3.2: Financial statements for validators and nominators</em></figcaption></figure><h4>3.3. Treasury</h4><p>The treasury is a relatively simple economic agent that controls its assets by a governance (voting) mechanism. The treasury can be considered as a DAO. The DAO’s revenue consists of fees, staking rewards and spends its reserves on spending proposals and minor deflationary burns. On Polkadot and Kusama, the treasury has a native reporting period measured in <em>spending periods</em>. The financial statements for this class of economic agents can be found in image 3.3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8JStDPx035pPIGdp" /><figcaption><em>Image 3.3: Financial statements for the treasury</em></figcaption></figure><h4>3.4. Parachains and parathreads</h4><p>Parachains and parathreads (and bridges) can be considered <em>foreign </em>economic agents in Polkadot and Kusama. These foreign economic agents are willing to pay for access to services the relay-chain has to offer, such as <em>security </em>and <em>interoperability</em>. Parachains pay through deposits, parathreads pay through fees (registration and usage). On Polkadot and Kusama, parachains have a native reporting period measured in auction slots and slot lease periods. Parathreads appear to have no such native reporting period. The financial statements for this class of economic agents can be found in image 3.4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*unrF1Qyrgowi_bAR" /><figcaption><em>Image 3.4: Financial statements for parachains and parathreads</em></figcaption></figure><h4>3.5. Reserve bank</h4><p>The reserve bank can be considered as the central bank of the cyberspace economy and its financial statements provide an overview of the assets and liabilities of the entire economy. The reserve bank has the singular task of controlling issuance of its native unit of account by burn-activities and mint-activities. The financial statements for this class of economic agents can be found in image 3.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fd2XmqJpSV3oUCEp" /><figcaption><em>Image 3.5: Financial statements for the reserve bank</em></figcaption></figure><h3>4. Polkascan and cyberspace economies</h3><h4>4.1. Polkascan as accountant</h4><p>Polkascan aims to provide financial accounting services for the Polkadot and Kusama cyberspace economies. Polkascan will provide financial statements for key classes of economic agents in cyberspace ecosystems as outlined in this article.</p><p>Polkascan’s financial statements aim to comply with the qualitative characteristics outlined in section 2.3 by providing: <em>faithful representations</em> of <em>relevant </em>and <em>timely </em>financial statements, understandable ledger <em>accounting schemas</em>, <em>relevant </em>and <em>comparable </em>accounting periods.</p><p><em>Polkascan Accountancy</em> is built on top of our ecosystem platform <a href="https://polkascan.io/">polkascan.io</a> which provides <em>verifiable data</em> all the way down to the lowest possible level of <em>granularity </em>(<em>accounts</em>, <em>blocks</em>, <em>transactions </em>and <em>events</em>).</p><p>Polkascan intends to offer its accountancy services to the Polkadot and Kusama ecosystem and intends to submit funding proposals to both ecosystem’s treasuries in order to fund its operational cost.</p><h4>4.2. Polkascan as a bureau of economic analysis</h4><p>This article sets Polkascan’s multi-year strategy of providing valuable services to multi-chain ecosystems. Our accountancy services are the first of many services imaginable when framing blockchains as economies. We are driven by a belief that the fields of microeconomic analysis and macroeconomic analysis provide research and practices for thinking about behavior and financial performance of cyberspace economies. Polkascan will continue its research and will continue to apply practices to make multi-chain data accessible and understandable. Polkascan intends to further take on the role of the <em>Bureau of Economic Analysis for Cyberspace Economies</em>.</p><h3>About Polkascan &amp; WEB3SCAN</h3><p>Polkascan contributes to the Polkadot ecosystem by providing block exploration and data analytic technologies. We will continue providing updates to our multi-chain data analytic platform: <a href="https://polkascan.io/">polkascan.io</a>. The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7_RGzDHyn2S4Rru6" /><figcaption><em>Image 5.1: WEB3SCAN’s mission: to make multi-chain data accessible and understandable</em></figcaption></figure><p><strong>WEB3SCAN </strong>— the organization behind the Polkascan project — offers professional services around blockchain data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5861abef63f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-economic-analysis-a5861abef63f">Polkascan Economic Analysis</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #4]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-4-584705a00cc6?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/584705a00cc6</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[kusama]]></category>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[substrate]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Thu, 12 Sep 2019 09:56:29 GMT</pubDate>
            <atom:updated>2019-09-13T10:27:52.931Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twT_CluADvOFc0f9mlPdRQ.png" /></figure><h3>Completion of wave one grant work</h3><p>WEB3SCAN’s mission is to make multi-chain data accessible and understandable and with the Polkascan-project we are working towards a multi-chain exploration &amp; data analytic platform. This development update is part of the work related to the <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Grant</a> that ensures that the Polkadot-ecosystem has access to an open-source block explorer from day one!</p><p>‘Day one’ is something we at WEB3SCAN have always taken to heart, and it shows because — due to the Polkascan-project — the recently launched <a href="https://kusama.network/">Kusama-network</a> has a <a href="https://polkascan.io/pre/kusama/dashboard">block explorer</a> already.</p><p>WEB3SCAN contributes to the Polkadot-ecosystem with the Polkascan-project by providing a generalized open-source block explorer for any Substrate-based blockchain, such as the Polkadot relay chain. This fourth development update is released together with the delivery of our fourth project milestone as <a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">announced here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pwuV8I5XBtBaH9qINk2Iw.jpeg" /><figcaption><em>Image 0.1: WEB3SCAN’s Emiel Sebastiaan at Web3 Summit 2019.</em></figcaption></figure><p><strong><em>Milestone 4 | search, optimizations and usability</em></strong>: The fourth milestone has extended the base system-architecture for all artifacts of the <em>Polkascan ‘open-source block explorer’-</em>stack with the basics of search &amp; filter functions. Additionally this phase has implemented a wide-range of performance optimizations and usability enhancements.</p><h3>1. Getting started</h3><p>This section of the development update will help you get started by running the fourth milestone release of <em>Polkascan PRE</em> yourself.</p><h4>1.1. Polkascan PRE on Github</h4><p><strong><em>Repositories</em>: </strong>The source code for <em>Polkascan PRE</em> can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of a number of distinct repositories which collectively form <em>Polkascan PRE</em>. We apply a number of conventions for branches and versioned releases across these <em>Polkascan PRE</em> repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cqIT9xkVgPPL7IC8" /><figcaption><em>Image 1.1: Polkascan on Github:</em><a href="https://github.com/polkascan"><em> https://github.com/polkascan</em></a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent — but possibly unstable — work in the<a href="https://github.com/polkascan/polkascan-pre/tree/master"> <em>master</em></a>-branch. The milestone 4 work can be found in the <a href="https://github.com/polkascan/polkascan-pre/tree/milestone4"><em>milestone4</em></a>-branch.</p><p><strong><em>Releases</em>: </strong>The Milestone 4 work is released as ‘v0.4.x’.</p><h4>1.2. What makes Polkascan PRE?</h4><p><em>Polkascan PRE</em> consists of a number of distinct software artifacts which collectively orchestrate <em>Polkascan PRE</em>. The <a href="https://github.com/polkascan/polkascan-pre-harvester"><em>Harvester</em></a> transforms a Substrate node’s raw data into relational data, with the help of the <a href="https://github.com/polkascan/py-substrate-interface"><em>Substrate Interface Library</em></a> and the <a href="https://github.com/polkascan/py-scale-codec"><em>SCALE Codec Library</em></a>. The produced relational data is disseminated by the <a href="https://github.com/polkascan/polkascan-pre-explorer-api"><em>Explorer API</em></a> and in turn made accessible to end-users by the <a href="https://github.com/polkascan/polkascan-pre-explorer-gui"><em>Explorer GUI</em></a>. We have chosen to provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root.</p><p>Although these five distinct components of <em>Polkascan PRE</em> could be applied independently (even in other projects), we offer a sixth piece of software, called: <a href="https://github.com/polkascan/polkascan-pre"><em>Polkascan PRE</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ol><li>Recommended hardware: Memory: &gt;8GB (more is better), Storage: &gt;100GB (SSD is better), Processor: more and faster cores is better (Intel i7 quad core), Bandwidth: more and faster is better (&gt;10 Mbps). These requirements will go down as the project matures.</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of <em>Polkascan PRE</em> has been tested on Mac, Linux and Windows.</li><li>The <em>Explorer GUI</em> has been tested on Safari, Firefox, Chrome, Edge and Brave.</li></ol><h4>1.4. Running Polkascan PRE</h4><p>This paragraph provides a step-by-step guide on running our milestone 4 release of <em>Polkascan PRE</em> on your own machine. The instructions outlined in this paragraph can be found in our <a href="https://github.com/polkascan/polkascan-pre/tree/milestone3">Github repository</a>.</p><p>Step 1: Clone the repository:</p><pre>git clone <a href="https://github.com/polkascan/polkascan-pre.git">https://github.com/polkascan/polkascan-pre.git</a></pre><p>Step 2: Go to the new folder:</p><pre>cd polkascan-pre</pre><p>Step 3: Check available releases:</p><pre>git tag</pre><p>Step 4: Checkout the latest release in the v0.4.x range (replace ‘x’ with highest number):</p><pre>git checkout v0.4.x</pre><p>Step 5: Initialize and update submodules:</p><pre>git submodule update --init --recursive</pre><p>Step 6: Build and initialize the MySQL container:</p><pre>docker-compose -p dev -f docker-compose.yml up -d mysql</pre><p>Step 7: Build and initialize the other containers:</p><pre>docker-compose -p dev -f docker-compose.yml up --build</pre><p>Result: The Explorer GUI should now be available in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHbehXsOBpeAs8HVnIeWvw.png" /><figcaption><em>Image 1.2: Polkascan PRE in a browser: </em><a href="http://127.0.0.1:8080/"><em>http://127.0.0.1:8080</em></a></figcaption></figure><h4>1.5. Interact through Polkadot-JS Apps</h4><p><em>Polkascan PRE </em>is ‘<em>block exploration &amp; data analytic</em>’-technology and does not offer features to actively interact with a blockchain. However, the Docker Compose setup ships with <em>Polkadot-JS Apps</em>, which allows you to interact with the chain — for example by composing and submitting transactions. <em>Polkadot-JS Apps</em> should now be available in a browser: <a href="http://127.0.0.1:8081/">http://127.0.0.1:8081</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nGL-US0FL-NIO0f_" /><figcaption><em>Image 1.3: Polkadot-JS Apps in a browser: </em><a href="http://127.0.0.1:8081/"><em>http://127.0.0.1:8081</em></a></figcaption></figure><h4>1.6. Cleaning up</h4><p>The following docker[-compose] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.</li></ul><pre>docker-compose -p dev -f docker-compose.yml down</pre><ul><li>Remove all unused containers and images (caution!!).</li></ul><pre>docker system prune<br>[confirm] Y</pre><ul><li>Remove all containers and images (caution!!).</li></ul><pre>docker system prune -a<br>[confirm] Y</pre><ul><li>Remove all unused volumes (caution!!).</li></ul><pre>docker volume prune<br>[confirm] Y</pre><h3>2. Exploring Polkascan PRE</h3><p>The milestone 4 release of <em>Polkascan PRE</em> offers various performance optimizations and usability enhancements. The release provides more, better and richer details on useful data entities that were already supported by milestone 3, such as: <em>logs</em>, <em>accounts</em>, <em>indices</em>, <em>transfers</em>, <em>sessions</em>, <em>validators</em>, <em>nominators</em>, <em>proposals </em>and <em>referenda</em>. And the release provides more, better and richer details on the more abstract entities that were already supported by milestone 2, such as: <em>blocks</em>, <em>extrinsics</em>, <em>transactions</em>, <em>inherents</em>, <em>events </em>and <em>runtime specification</em> entities. Basic definitions of these notions can be found in the Substrate’s <a href="https://substrate.dev/docs/en/overview/glossary">official documentation</a>.</p><h4>2.1. Exploring the GUI</h4><p>The <em>Explorer GUI</em> is an Angular (mobile friendly) application that consumes data from the <em>Explorer API</em>. The application’s landing page is accessible at the following URL when running the steps in the previous paragraph: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a>.</p><p>The top section of the landing page displays a navigation menu to the following sections: <em>chain</em>, <em>account</em>, <em>staking</em>, <em>governance</em>, <em>analytics </em>&amp; <em>runtime</em>. The Polkascan-logo returns you to this landing page.</p><p>The header sections shows you the name of the network you are on, optionally supported by a color-code if it is a known (pre-configured) network. Additionally this section allows you to search by <em>block number</em>, <em>transaction hash</em> or <em>account address</em>.</p><p>The next section of the landing page lists a number of key indicators, such as: the most recent <em>finalized blocks</em>, the number of <em>transactions</em>, the number of <em>module events</em>, the number of <em>active accounts</em> and the number of <em>distinct runtimes</em> that have been harvested.</p><p>Furthermore, the bottom section of the landing page lists some details of the most recently harvested blocks and of the most recently harvested balance transfers. Both these list have buttons that allow you to find more details.</p><p>Below you can find a list of useful sections of the <em>Explorer GUI</em>:</p><p><strong>Chain menu entities</strong></p><pre><strong>Blocks</strong>: <a href="http://127.0.0.1:8080/block">http://127.0.0.1:8080/block</a><br><strong>Extrinsics</strong>: <a href="http://127.0.0.1:8080/extrinsic">http://127.0.0.1:8080/extrinsic</a><br><strong>Transactions</strong>: <a href="http://127.0.0.1:8080/transaction">http://127.0.0.1:8080/transaction</a><br><strong>Inherents</strong>: <a href="http://127.0.0.1:8080/inherent">http://127.0.0.1:8080/inherent</a><br><strong>Events</strong>: <a href="http://127.0.0.1:8080/event">http://127.0.0.1:8080/event</a><br><strong>Logs</strong>: <a href="http://127.0.0.1:8080/log">http://127.0.0.1:8080/log</a></pre><p><strong>Account menu entities</strong></p><pre><strong>Accounts</strong>: <a href="http://127.0.0.1:8080/account">http://127.0.0.1:8080/account</a><br><strong>Account Indices</strong>: <a href="http://127.0.0.1:8080/indices/account">http://127.0.0.1:8080/indices/account</a><br><strong>Transfers</strong>: <a href="http://127.0.0.1:8080/balances/transfer">http://127.0.0.1:8080/balances/transfer</a><br><strong>Contracts</strong>: <a href="http://127.0.0.1:8080/contracts/contract">http://127.0.0.1:8080/contracts/contract</a></pre><p><strong>Staking menu entities</strong></p><pre><strong>Sessions</strong>: <a href="http://127.0.0.1:8080/session/session">http://127.0.0.1:8080/session/session</a><br><strong>Validators</strong>: <a href="http://127.0.0.1:8080/session/validator">http://127.0.0.1:8080/session/validator</a><br><strong>Nominators</strong>: <a href="http://127.0.0.1:8080/session/nominator">http://127.0.0.1:8080/session/nominator</a></pre><p><strong>Governance menu entities</strong></p><pre><strong>Democracy Proposals</strong>: <a href="http://127.0.0.1:8080/democracy/proposal">http://127.0.0.1:8080/democracy/proposal</a><br><strong>Democracy Referenda</strong>: <a href="http://127.0.0.1:8080/democracy/referendum">http://127.0.0.1:8080/democracy/referendum</a></pre><p><strong>Analytics menu entities</strong></p><pre><strong>Search</strong>: <a href="http://127.0.0.1:8080/analytics/search">http://127.0.0.1:8080/analytics/search</a></pre><p><strong>Runtime menu entities</strong></p><pre><strong>Runtime modules</strong>: <a href="http://127.0.0.1:8080/runtime-module">http://127.0.0.1:8080/runtime-module</a><br><strong>Runtime type registry </strong>: <a href="http://127.0.0.1:8080/runtime-type">http://127.0.0.1:8080/runtime-type</a><br><strong>Runtime upgrade history</strong>: <a href="http://127.0.0.1:8080/runtime">http://127.0.0.1:8080/runtime</a></pre><h4>2.2. Exploring the API</h4><p>The <em>Explorer API</em> is a <a href="https://falconframework.org/">Falcon</a>-application that disseminates data from the relational database that is maintained by the <em>Harvester</em>. Falcon offers a fast RESTful API and we apply the <a href="https://jsonapi.org/">JSON-API</a> standard as message envelope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4aJyO4W7zikvPZdnr_btRQ.png" /><figcaption>Image 2.1: Exploring the API</figcaption></figure><p>We use <a href="https://docs.nginx.com/">NGINX</a> proxy rules to embed the <em>Explorer API</em> in the routing schema of the <em>Explorer GUI</em>. Below you can find a list of useful API endpoints of the <em>Explorer API</em>:</p><p><strong>Chain API endpoints</strong></p><pre><strong>Blocks </strong>: <a href="http://127.0.0.1:8080/api/v1/block">http://127.0.0.1:8080/api/v1/block</a><br><strong>Extrinsics</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic">http://127.0.0.1:8080/api/v1/extrinsic</a><br><strong>Transactions</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic?filter[signed]=1">http://127.0.0.1:8080/api/v1/extrinsic?filter[signed]=1</a><br><strong>Inherents</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic?filter[signed]=0">http://127.0.0.1:8080/api/v1/extrinsic?filter[signed]=0</a><br><strong>Events</strong>: <a href="http://127.0.0.1:8080/api/v1/event">http://127.0.0.1:8080/api/v1/event</a><br><strong>Logs</strong>: <a href="http://127.0.0.1:8080/api/v1/log">http://127.0.0.1:8080/api/v1/log</a></pre><p><strong>Account API endpoints</strong></p><pre><strong>Accounts</strong>: <a href="http://127.0.0.1:8080/api/v1/account">http://127.0.0.1:8080/api/v1/account</a><br><strong>Account Indices</strong>: <a href="http://127.0.0.1:8080/api/v1/accountindex">http://127.0.0.1:8080/api/v1/accountindex</a><br><strong>Transfers:</strong> <a href="http://127.0.0.1:8080/api/v1/balances/transfer">http://127.0.0.1:8080/api/v1/balances/transfer</a><br><strong>Contracts</strong>: <a href="http://127.0.0.1:8080/api/v1/contract/contract">http://127.0.0.1:8080/api/v1/contract/contract</a></pre><p><strong>Staking API endpoints</strong></p><pre><strong>Sessions</strong>: <a href="http://127.0.0.1:8080/api/v1/session/session">http://127.0.0.1:8080/api/v1/session/session</a><br><strong>Validators</strong>: <a href="http://127.0.0.1:8080/api/v1/session/validator">http://127.0.0.1:8080/api/v1/session/validator</a><br><strong>Nominators</strong>: <a href="http://127.0.0.1:8080/api/v1/session/nominator">http://127.0.0.1:8080/api/v1/session/nominator</a></pre><p><strong>Governance API endpoints</strong></p><pre><strong>Democracy proposals</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/proposal">http://127.0.0.1:8080/api/v1/democracy/proposal</a><br><strong>Democracy referenda</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/referendum">http://127.0.0.1:8080/api/v1/democracy/referendum</a></pre><p><strong>Runtime API endpoints</strong></p><pre><strong>Runtime modules</strong>: <a href="http://127.0.0.1:8080/api/v1/runtime-module">http://127.0.0.1:8080/api/v1/runtime-module</a><br><strong>Runtime type registry</strong>: <a href="http://127.0.0.1:8080/api/v1/runtime-type">http://127.0.0.1:8080/api/v1/runtime-type</a><br><strong>Runtime upgrade history</strong>: <a href="http://127.0.0.1:8080/api/v1/runtime">http://127.0.0.1:8080/api/v1/runtime</a></pre><h4>2.3. Exploring the DB</h4><p><em>Polkascan PRE</em> is DBMS-<em>agnostic</em>. That said, we have set up the <em>Docker Compose</em> configuration for this milestone with recent version of <em>MySQL</em>. You can connect to the <em>MySQL-</em>DBMS with you favorite tool. The default connection details are listed below:</p><pre>Host: 127.0.0.1<br>Port: 33061<br>Database: polkascan<br>Username: root<br>Password: root</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxeLs7ttti6hk80LcYYS_Q.png" /><figcaption>Image 2.2: Exploring the DB</figcaption></figure><p>The database consists a number of tables which are outlined below:</p><pre><strong>alembic_version</strong>: version data to enforce data-definition by <a href="https://www.sqlalchemy.org/">SQLAlchemy</a>.<br><strong>data_account</strong>: account data.<br><strong>data_account_audit</strong>: account audit data.<br><strong>data_account_index</strong>: indices account data.<br><strong>data_account_index_audit</strong>: indices account audit data.<br><strong>data_block</strong>: block data.<br><strong>data_block_total</strong>: additional block data.<br><strong>data_contract</strong>: contract data.<br><strong>data_democracy_proposal</strong>: democracy proposal data.<br><strong>data_democracy_proposal_audit</strong>: democracy proposal audit data.<br><strong>data_democracy_referendum</strong>: democracy referendum data.<br><strong>data_democracy_referendum_audit</strong>: democracy referendum audit data.<br><strong>data_democracy_vote</strong>: democracy vote data.<br><strong>data_democracy_vote_audit</strong>: democracy vote audit data.<br><strong>data_event</strong>: event data.<br><strong>data_extrinsic</strong>: extrinsic (and transaction and inherent) data.<br><strong>data_log</strong>: digest log data.<br><strong>data_session</strong>: session data.<br><strong>data_session_total</strong>: additional session data.<br><strong>data_session_nominator</strong>: session nominator data.<br><strong>data_session_validator</strong>: session validator data.<br><strong>runtime</strong>: runtime specification data.<br><strong>runtime_call</strong>: runtime specification data of call functions.<br><strong>runtime_call_param</strong>: runtime specification data of call function parameters.<br><strong>runtime_constant</strong>: runtime specification data of constants and their values.<br><strong>runtime_storage</strong>: runtime specification data of storage functions.<br><strong>runtime_event</strong>: runtime specification data of events.<br><strong>runtime_event_attribute</strong>: runtime specification data of event attributes.<br><strong>runtime_module</strong>: runtime specification data of modules.<br><strong>runtime_type</strong>: runtime specification data of types.</pre><h4>2.4. Exploring Docker Compose</h4><p>This paragraph documents and explains the components that can be found in the Docker Compose setup.</p><p><strong>Version</strong></p><pre><strong>version: &#39;3.2&#39; </strong>| At one point this version was chosen for compatibility with AWS-deployments of the stack. This may need to be revisited.</pre><p><strong>Services</strong></p><pre><strong>substrate-node:</strong> this instance of the image runs a <a href="https://hub.docker.com/r/polkasource/substrate-client">Polkasource</a>-distribution of the Substrate-node.<br><strong>mysql:</strong> this instance of the image runs the <a href="https://www.mysql.com/">MySQL</a>-dbms.<br><strong>redis:</strong> this instance of the image runs the <a href="https://redis.io/">Redis</a> key/value-store as message broker.<br><strong>harvester-worker:</strong> this instance of the image runs <a href="http://www.celeryproject.org/">Celery</a> as distributed task queue and listens to the <a href="https://redis.io/">Redis</a> message broker for available tasks.<br><strong>harvester-beat:</strong> this instance of the image runs the task scheduler engine for <a href="http://www.celeryproject.org/">Celery</a>-processes.<br><strong>harvester-api:</strong> this instance of the image runs <a href="https://falconframework.org/">Falcon</a> which serves <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">RESTful</a> endpoints with control-functions for the harvester.<br><strong>harvester-monitor:</strong> this instance of the image runs <a href="https://github.com/mher/flower">Flower</a> as a front-end application for <a href="http://www.celeryproject.org/">Celery</a>.<br><strong>explorer-api:</strong> this instance of the image runs <a href="https://falconframework.org/">Falcon</a> which serves <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">RESTful</a> endpoints following the <a href="https://jsonapi.org/">JSON-API</a> specification to serve data from the database.<br><strong>explorer-gui:</strong> this instance of the image serves a <a href="https://en.wikipedia.org/wiki/Single-page_application">SPA</a> <a href="https://angular.io/">Angular</a>-application.<br><strong>polkadot-ui:</strong> this instance of the image runs a <a href="https://hub.docker.com/r/polkasource/substrate-ui">Polkasource</a>-distribution of the <a href="https://github.com/polkadot-js/apps">Polkadot-JS Apps</a>.</pre><p><strong>Volumes</strong></p><pre><strong>db-data:</strong> this volume provides a storage-volume for the (<a href="https://www.mysql.com/">MySQL</a>-)dbms.<br><strong>substrate-data:</strong> this volume provides a storage-volume for the Substrate-node’s data.</pre><h3>3. Usability enhancements</h3><p>The milestone 4 release has implemented a number of usability enhancements.</p><h4>3.1. Menu-structure</h4><p>The menu-structure groups the various sections of the explorer into coherent clusters, such as: ‘Chain’, ‘Accounts’, ‘Staking’, ‘Governance’ and ‘Runtime’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SNh3Acu874jFJwh5" /><figcaption><em>Image 3.1: Polkascan PRE menu-structure</em></figcaption></figure><h4>3.2. Color-coding</h4><p>The default Substrate-node set-up in the Docker Compose configuration is a ‘development’ configuration for the latest Kusama-runtime. The color-coding used for this default configuration is ‘grey’. Other network configurations have a distinct color-code, such as: Kusama (kusama-pink), Alexander (alexander-pink), Edgeware (blue) and Joystream (turquoise).</p><h4>3.3. Tab-structure</h4><p>Tab UI-controls can be found on detail pages such as the ‘block detail’-page. The tab UI-control allows for a better overview of the many 1-to-n relationships an entity may have. A <em>block</em> for example may have many <em>transactions</em>, <em>inherents</em>, <em>logs</em>, etc. This UI-control minimizes a need for vertical page scrolling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zidvom0b1CfYM0wq" /><figcaption><em>Image 3.2: Polkascan PRE tab-structure</em></figcaption></figure><h4>3.4. Data-rendering</h4><p>In many sections of the <em>Explorer GUI</em> complex and nested data-structures are rendered. In many cases Substrate’s <em>metadata</em> provides proper <em>decoding context</em> for the data-structure. The examples serve as a proof-of-concept and this feature will be implemented in many more sections during our future development cycle.</p><p><strong>Account address</strong></p><p>Whenever an <em>account-address</em> is encountered it is rendered in such a way that it may include <em>an identicon</em>, <em>resource deep-links</em> and <em>abbreviation</em>-rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f42Hg7l5152nwzSNvEdxLQ.png" /><figcaption><em>Image 3.3: </em>Rich account-address rendering</figcaption></figure><p><strong>Referendum proposal</strong></p><p>Whenever a <em>referendum </em>takes place, <em>votes </em>need to be cast on a <em>proposal</em>. Substrate allows anything that can be expressed as a <em>call </em>to be <em>voted </em>on through a <em>proposal</em>. Since the available <em>calls </em>are defined <em>dynamically </em>by the Substrate <em>runtime</em>, no <em>objective decoding context</em> exists for <em>proposals</em>. The way the <em>proposal </em>needs to be <em>rendered </em>is therefore subject to the <em>runtime</em>’s <em>dynamic metadata </em>and can even be <em>recursive </em>with <em>nested</em>-structures. The example shows a <em>democracy proposal</em> through which the <em>free balance</em> of a specific <em>account</em> is set to a specific <em>value</em>. <em>Recursion </em>is shown with the <em>rendering </em>of the <em>account address</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHjLHxzA-xAbQ2jYCxZaJQ.png" /><figcaption><em>Image 3.4: </em>Rich democracy-referendum-proposal rendering</figcaption></figure><h4>3.5. Filters</h4><p>Basic <em>filters </em>have been added to the <em>transaction</em>, <em>inherent </em>and <em>event </em>overview pages. These <em>filters </em>allow to easily <em>filter </em>for the respective records that match the dynamic categories set by the <em>runtime</em>. The examples serve as a proof-of-concept and this feature will be implemented in many more sections during our future development cycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0c3ZKcFiBODMhO1_80cDow.png" /><figcaption><em>Image 3.5: </em>Basic filters on transaction overview page</figcaption></figure><h4>3.6. Search</h4><p>Basic search is available on the landing page and on a specific page in the ‘Analytics’-menu. Search is available for the following entities and their attributes: <em>block hash</em>, <em>block number</em>, <em>account address</em>, <em>account index</em>, <em>transaction hash</em> and <em>inherent id</em>. A search-match will direct to the particular resource’s detail page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OD1Rl8rh4ryO4xyHtYErmQ.png" /><figcaption><em>Image 3.6: </em>Basic search page</figcaption></figure><p>Additionally the landing page is a placeholder for future advanced search functions with logical search and a results-page for many more indexed data-points.</p><h3>4. Performance optimizations</h3><p>The milestone 4 release has implemented a number of performance optimizations.</p><p>Through our work on ‘<em>multi-chain exploration &amp; data analytic</em>’-technologies we learned that performance is a continuous challenge. Any <a href="https://fortune.com/2018/06/18/cryptokitties/">single application</a> or any <a href="https://blog.ethereum.org/2016/09/22/transaction-spam-attack-next-steps/">single attack vector</a> can push a blockchain to its capacity limits. In general, if you require the explorer to provide near <em>real-time</em> data — and thus keep up with the chaintip of the blockchain — you need to be able to perform all data processing and storage operations within the constraints of the <em>blocktime</em>.</p><h4>4.1. Basic benchmark</h4><p>The milestone 4 release has undergone a basic benchmark test with a preliminary conclusion that the Polkascan-stack will be able to scale-up and handle Substrate-based blockchains at very high capacity.</p><p>The setup for this benchmark test used a mock-up of Substrate’s JSON-RPC to serve a million blocks with an increasing order of magnitude for the number of distinct extrinsics (transactions) per block to simulate a Substrate-based chain at high capacity.</p><p>Vanilla Polkascan PRE will be able to process up to 5000 transactions per block at a constant rate on consumer-grade hardware. Up-scaling performance beyond this constant capacity threshold can be achieved through horizontal scaling.</p><h4>4.2. Horizontal scaling</h4><p>The Polkascan-stack allows for horizontal scaling on multiple levels.</p><p>Horizontal scaling is achieved on a high-level by dividing the work per blockchain. I.e. as long as the harvester — on average — is capable of processing the blockchain’s data within the blocktime of the chain, it will be able to keep up with the chaintip and serve real-time data. The multi-chain explorer of the Polkascan-project consists of one harvester application per blockchain.</p><p>Further horizontal scaling is achieved on a more fine-grained level within a single blockchain through asynchronous multi-threading by <a href="http://www.celeryproject.org/">Celery</a>-workers on a <a href="https://redis.io/">Redis</a> message-broker architecture. The <em>Harvester </em>has two distinct processes, which we call the <strong><em>accumulator</em></strong>, which harvests stateless data and the <strong><em>sequencer </em></strong>which builds stateful data based on the already available stateless data. The accumulator’s tasks scale really well because they can be parallelized and executed in any random order. Only very few tasks have to be executed by the sequencer.</p><h4>4.3. Database optimizations</h4><p>Through our previous work on our generalized EVM block explorer we learned that managing very large database is a continuous challenge. In general, if you require the explorer to provide analytics over all data in a particular blockchain then your databases will grow very large. The database for our Ethereum mainnet explorer is &gt;10TB in size. The following strategies have proven to successfully deal with such large databases.</p><p><strong>Transaction-based commits</strong></p><p>The <em>Harvester</em> applies a transaction-based commit strategy. Such strategy writes all data of an entire block or fails through exception. Such strategy ensures data integrity per block.</p><p><strong>Deterministic keys</strong><br>The data-definition of the explorer’s data-structures have deterministic primary keys. In many cases this has resulted in composite key-structures. Examples are <em>extrinsics</em> and <em>events</em>, for which the primary key is a composite key of the <em>block_id</em> and the record’s <em>index</em> within that block. Deterministic keys — and thus deterministic data for the entire database — result in the ability to perform data integrity checks across databases. Please note that some entities have yet to be optimized.</p><p><strong>Write-once</strong></p><p>Write-once database-strategies are applied to ensure that data is only <em>written</em> once to the data-structure without the need for additional <em>reads</em>. This implies that in almost all cases no update-statements are required, thus limiting database-i/o.</p><p><strong>Bulk-writes</strong></p><p>Whenever possible bulk-write database-strategies are applied. E.g. when a block consists of ‘n’-transactions, one insert-statement with ‘n’ transaction-records is more efficient than ‘n’ insert-statements with one transaction-record, thus limiting database-i/o.</p><p><strong>Index optimizations</strong></p><p>Additional database-indices result in higher read-performance (<em>querying</em>, <em>filtering</em> &amp; <em>sorting</em>), but result in lower write-performance. Optimization-strategies have been applied through which the added index’ footprint is justified by the additional functionality.</p><p>Additionally a hard separation between the database-models of <em>Harvester </em>and the <em>Explorer API </em>has been made. The <em>Harvester </em>inherently has the task of writing data to the database and the <em>Explorer API </em>inherently has the task of reading data from the database. Although both applications currently use the same database-model, these models have currently been duplicated over the two repositories. This separation will eventually allow for different database index-strategies for each application. The <em>Harvester’</em>s index-strategies could be optimized for database-writes and the <em>Explorer API’</em>s index-strategies could be optimized for database-reads.</p><p><strong>Partition-ready</strong></p><p>Blockchain databases have an inherent property that the bulk of its data is stateless, which implies that is does not change. Partitioning-strategies per block-range allow for optimizations of service management activities for large static partitions of data. Although the <em>partition</em>-strategies have yet to be implemented, the data-structure for the bulk of the data can be partitioned by block-range of say 100.000 blocks.</p><h4>4.4. API Caching</h4><p>A simple argument for implementing <em>cache</em>-strategies for any web-application is to limit database-i/o. Filesystem-i/o or memory-i/o is more efficient than database-i/o. As stated earlier blockchain databases have an inherent property that the bulk of its data is stateless. Any stateless resource that is served more than once merits from a <em>cache</em>-engine.</p><p><em>Cache</em>-requirements are amplified whenever web-applications are publicly serviced and have high traffic. A significant number of technical preparations have been made to effectively deal with <em>cache</em>- and <em>traffic</em>-control, such as: json-output caching, mutex locking, resource-based TTL, rate-limiting &amp; throttling and access control. This will be further explored in a future blog post.</p><h4>4.5. Application optimizations</h4><p>The <em>Explorer GUI</em> is an <em>Angular</em>-application which uses <em>Typescript</em> as primary language to transpile into pure <em>Javascript</em>. The application has a so-called <a href="https://en.wikipedia.org/wiki/Single-page_application"><em>SPA</em></a><em>-</em>architecture that runs entirely in the browser and interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. The application’s data is served entirely through external — local or remote — API-endpoints (<em>Explorer-API</em>).</p><p>The architecture can fairly easily be made compatible with many of the libraries that are available in the ecosystem.</p><p>The <a href="https://bulma.io/"><em>Bulma</em></a>-framework is implemented to ensure cross-browser compatibility of user-interface components and controls and applies responsive-design standards to allow screen-layout optimizations for various devices, including: <em>web</em>, <em>tablet </em>and <em>mobile</em>.</p><p>The <em>Angular</em>-architecture is mobile ready and is ready to be shipped as cross-platform hybrid and progressive web apps for <em>Android </em>and <em>iOS </em>and their respective <em>App Stores</em> with the <a href="https://ionicframework.com/">Ionic</a>-framework.</p><h3>5. Hacking on Polkascan PRE</h3><p>The Polkascan-stack is based on Python frameworks for the <em>Harvester </em>and the <em>Explorer API</em> and the Angular framework for the <em>Explorer GUI</em>. Our application-stack is glued together with <a href="https://docs.docker.com/">Docker</a> and <a href="https://docs.docker.com/compose/overview/">Docker-Compose</a> which allows it to run <em>virtually</em> everywhere. Many cool hacks can be achieved by hacking the docker compose file we referenced earlier in this document. We have documented many cool hacks in a <a href="https://medium.com/polkadot-network/polkascan-development-update-2-966d549f77ef">previous development update</a>, such as: <em>customizing ports</em>, <em>running other networks</em>, <em>using your own Substrate-node</em> and <em>using your own database server</em>. Our workshop at <a href="https://web3summit.com/">Web3 Summit 2019</a> explored this a bit further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5YCijcP8GggOAI5GLce2kA.jpeg" /><figcaption><em>Image 5.1: WEB3SCAN’s Arjan Zijderveld at Web3 Summit 2019: Hacking on Polkascan PRE.</em></figcaption></figure><h3>6. About Polkascan</h3><p>The Polkascan-project contributes to the Polkadot-ecosystem by providing a generalized open-source block explorer, called <em>Polkascan PRE</em>. <em>Polkascan PRE</em> offers a block explorer for any Substrate-based blockchain, such as the Polkadot relay chain (Kusama network). This block explorer harvests and decodes data from Substrate-nodes, stores the decoded data in a relational database and disseminates the data through an API to be used in a block explorer user interface. The <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Wave One Grant</a> ensures that the Polkadot-ecosystem has access to an open source block explorer from day one!</p><h4>6.1. Polkascan and the ecosystem</h4><p>Our development activities are closely aligned with key ecosystem-organizations <a href="https://web3.foundation/">(Web3 Foundation</a> and <a href="https://www.parity.io/">Parity Technologies</a>). We support various new networks and future parachains <a href="https://edgewa.re/">(Edgeware</a>, <a href="https://robonomics.network/">Robonomics</a><a href="https://www.joystream.org/">, Joystream</a> and many more to come). We are very excited about <a href="https://wiki.polkadot.network/en/latest/polkadot/learn/parathreads/">Parathreads</a> and we expect Polkascan PRE to be fully compatible with any Parathread blockchain. We are in ongoing dialog with other ecosystem service providers (<a href="https://www.speckleos.io/">wallets</a>, <a href="https://faucets.blockxlabs.com/">faucets</a>, <a href="https://polkadot.js.org/">clients</a>) about integration with our platform.</p><p>We have had our first <a href="https://github.com/polkascan/py-scale-codec/pulls?q=is%3Apr+is%3Aclosed">community code-contributions</a> to our repositories and we have been granted a first — of hopefully many — Web3 Foundation Bounties for scoped feature-development activities of our open-source repositories. The first Gitcoin bounty funds the <a href="https://gitcoin.co/issue/polkascan/polkascan-pre-explorer-gui/1/3410">internationalization and localization of the <em>Explorer GUI</em></a> which should allow for multi-language support of Polkascan (English, Chinese, Russian, Japanese, etc). This project will add to wide-spread adoption of our <em>multi-chain exploration &amp; data analytics </em>technology.</p><p>WEB3SCAN is building <em>multi-chain exploration and data analytic</em> technology of which the Polkascan-stack is a key component. The Polkadot-ecosystem already <a href="http://polkaproject.com/">shows signs of other block explorers</a>. Particularly interesting is <a href="https://polkadot.js.org/apps/#/explorer">Polkadot JS Apps</a>. In contrast to Polkascan this project has a focus on the current state of the blockchain, rather than focusing on full and multi-chain analytics. Like Polkascan however this project has developed its entire stack from the ground up and is like Polkascan a project that has been around from day one. A key difference is that the Polkadot JS Apps project has a Typescript/Javascript codebase and the the Polkascan project has a Python codebase. This is a logical choice given the different goals and objectives of both projects. The other block explorers in the ecosystem all re-use major parts of the technology-stack of either Polkadot JS Apps project (<a href="https://polka.io/">Polka.io</a>) or the Polkascan-project (<a href="https://subscan.io/">Subscan</a> and <a href="http://boka.network/">Boka</a>).</p><h4>6.2. Polkascan-project updates</h4><p>This post wraps-up our work related to Web3 Foundation’s Wave One Grant. We will continue working on the open-source components of our block explorer stack and we will continue providing updates to our multi-chain explorer platform <a href="https://polkascan.io/">polkascan.io</a>.The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><h3>7. About WEB3SCAN</h3><h4>7.1. WEB3SCAN | Service Provider</h4><p><strong>WEB3SCAN </strong>— the organization behind the Polkascan-project — offers professional services around blockchain data and blockchain information management, including but not limited to providing full-service multi-chain exploration &amp; data analytic technologies, consultancy services &amp; systems integration services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XTAngDYmpKclBHUf" /><figcaption>Image 7.1: WEB3SCAN’s mission: making multi-chain data accessible and understandable</figcaption></figure><h4>7.2. Polkascan.io | The Polkadot-ecosystem multi-chain explorer</h4><p>WEB3SCAN is working on a multi-chain explorer called <em>Polkascan MC</em> of which <a href="https://polkascan.io/">polkascan.io</a> is one instance. This multi-chain explorer <a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">aims to make multi-chain data accessible and understandable</a>. In order to further our goals with the <em>Polkascan Multi-chain Explorer</em> we are developing block explorers that works well with many individual chains. Block explorers for these individual chains are — in turn — aggregated into the <em>Polkascan Multi-chain Explorer</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLJCdV-kIoGnWYqTQNGACQ.png" /><figcaption>Image 7.2: Polkascan.io the multi-chain block explorer for the Polkadot-ecosystem. (<a href="https://polkascan.io/">link</a>)</figcaption></figure><h4>7.3. WEB3SCAN | Media</h4><p>Learn more about <a href="https://www.web3scan.com/">WEB3SCAN</a> and reach out to us if you have any questions.</p><p><strong>Blogs</strong></p><ul><li>Parity Technologies Blog: ‘<a href="https://www.parity.io/built-on-substrate-polkascan/">Polkascan Built on Substrate</a>’</li><li>LongHash Blog: ‘<a href="https://longhash.com.sg/press/meet-the-team-behind-polkascan/">WEB3SCAN: The Team behind Polkascan</a>’</li><li>Polkadot Blog: ‘<a href="https://medium.com/polkadot-network/polkascan-development-update-3-fdea45ab959f">Development Update #3</a>’</li><li>Polkadot Blog: ‘<a href="https://medium.com/polkadot-network/polkascan-development-update-2-966d549f77ef">Development Update #2</a>’</li><li>Polkadot Blog: ‘<a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">Development Update #1</a>’</li><li>Web3 Foundation Grant Announcement: ‘<a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Wave One Grant Recipients</a>’</li><li>Polkadot Blog: ‘<a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">Announcement of Polkascan</a>’</li></ul><p><strong>Podcasts</strong></p><ul><li>Decentralize Data NOW! Hangout: ‘<a href="https://www.youtube.com/watch?v=gGXsQlfXKmA">Episode #23</a>’</li></ul><p><strong>Presentations</strong></p><ul><li>LongHash in Singapore: ‘<a href="https://www.youtube.com/watch?v=h33TBD_Rpxs">Demo Day</a>’</li><li>Sub0 in Berlin: ‘<a href="https://www.youtube.com/watch?v=TmfXDduVQLI">Development Update</a>’</li><li>Web3 Foundation at EthCC 2019 in Paris: ‘<a href="https://www.youtube.com/watch?v=NmkGuG2eQPA">Interview</a>’</li><li>Parity Technologies-event at Devcon4 in Prague: ‘<a href="https://www.youtube.com/watch?v=LaDiD5per80">Announcement of Polkascan</a>’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2ckmugGtvLWQVpoNwKGrw.jpeg" /><figcaption><em>Image 7.3: WEB3SCAN’s Dave Hoogendoorn at DotCon 0.5 2019.</em></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=584705a00cc6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-4-584705a00cc6">Polkascan Development Update #4</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #3]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-3-fdea45ab959f?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdea45ab959f</guid>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[polkadot]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Thu, 11 Jul 2019 23:28:01 GMT</pubDate>
            <atom:updated>2019-07-11T23:28:01.031Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*jscX3oyJjUOazIPVOxWM3A@2x.png" /></figure><h3>Milestone 3: key runtime data entities</h3><p>With the Polkascan project we are working towards a multi-chain explorer. This development update is part of the work related to the <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Grant</a> that ensures that the Polkadot-ecosystem has access to an open source block explorer from day one! Our project contributes to the Polkadot ecosystem by providing an MVP for a generalized open-source block explorer for any Substrate-based blockchain, such as the Polkadot relay chain.</p><p>This third development update is released together with the delivery of our third project milestones as <a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">announced here</a>.</p><p><strong><em>Milestone 3 | key runtime data entities</em></strong>: The third milestone extends the base system-architecture of the explorer with a number of Substrate Runtime Module Libraries (SRML) that are key to the inner workings of the Polkadot Relay Chain, such as: timestamp, indices (accounts), sessions, democracy &amp; staking. With this milestone the explorer should provide basic data structures for the following entities: block timestamps, accounts, staking (validators), sessions (validators) &amp; democracy (proposals, referenda).</p><h3>1. Getting started</h3><p>This development update will help you get started by running the third milestone release of <em>Polkascan PRE</em> yourself.</p><h4>1.1. Polkascan PRE on Github</h4><p><strong><em>Repositories</em>: </strong>The source code of <em>Polkascan PRE</em> can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of a number of distinct repositories which collectively form <em>Polkascan PRE</em>. We apply a number of conventions for branches and versioned releases across these <em>Polkascan PRE</em> repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DSkx5zJb9VlTEHDPzJKog.png" /><figcaption>Image 1: Polkascan on Github: <a href="https://github.com/polkascan">https://github.com/polkascan</a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent — but possibly unstable — work in the <a href="https://github.com/polkascan/polkascan-pre/tree/master"><em>master</em></a>-branch. The milestone 3 work can be found in the <a href="https://github.com/polkascan/polkascan-pre/tree/milestone3"><em>milestone3</em></a>-branch.</p><p><strong><em>Releases</em>: </strong>The milestone 3 work is released as ‘v0.3.x’.</p><h4>1.2. What makes Polkascan PRE?</h4><p><em>Polkascan PRE</em> consists of a number of distinct software artifacts which collectively orchestrate <em>Polkascan PRE</em>. The <a href="https://github.com/polkascan/polkascan-pre-harvester"><em>Harvester</em></a> transforms a Substrate node’s raw data into relational data, with the help of <a href="https://github.com/polkascan/py-substrate-interface"><em>Substrate Interface Library</em></a> and the <a href="https://github.com/polkascan/py-scale-codec"><em>SCALE Codec Library</em></a>. The produced relational data is disseminated by the <a href="https://github.com/polkascan/polkascan-pre-explorer-api"><em>Explorer API</em></a> and in turn made accessible to end-users by the <a href="https://github.com/polkascan/polkascan-pre-explorer-gui"><em>Explorer GUI</em></a>. We have chosen to provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root.</p><p>Although these five distinct components of <em>Polkascan PRE</em> could be applied independently (and likely even in other projects), we offer a sixth piece of software, called: <a href="https://github.com/polkascan/polkascan-pre"><em>Polkascan PRE</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ul><li>Recommended hardware: Memory: &gt;8GB (more is likely better), Storage: &gt;100GB (SSD is likely better), Processor: more and faster cores is better (Intel i7 quad core), Bandwidth: more and faster is better (&gt;20 Mbps). These requirements will likely go down as the project matures.</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of <em>Polkascan PRE</em> has been tested on Mac, Linux and Windows.</li><li>The <em>Explorer GUI</em> has been tested on Safari, Firefox, Chrome and Edge.</li></ul><h4>1.4. Running Polkascan PRE</h4><p>This paragraph provides a step-by-step guide on running our milestone 3 release of <em>Polkascan PRE</em> on your own machine. The instructions outlined in this paragraph can be found in our <a href="https://github.com/polkascan/polkascan-pre/tree/milestone3">Github repository</a>.</p><p>Step 1: Clone the repository:</p><pre>git clone <a href="https://github.com/polkascan/polkascan-pre.git">https://github.com/polkascan/polkascan-pre.git</a></pre><p>Step 2: Go to the new folder:</p><pre>cd polkascan-pre</pre><p>Step 3: Check available releases:</p><pre>git tag</pre><p>Step 4: Checkout the latest release in the v0.3.x range (replace ‘x’ with highest number):</p><pre>git checkout v0.3.x</pre><p>Step 5: Initialize and update submodules:</p><pre>git submodule update --init --recursive</pre><p>Step 6: Build and initialize the MySQL container:</p><pre>docker-compose -p dev -f docker-compose.yml up -d mysql</pre><p>Step 7: Build and initialize the other containers:</p><pre>docker-compose -p dev -f docker-compose.yml up --build</pre><p>Result: The Explorer GUI should now be available in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3ukV0LuJ97gN54iYtz6jg.png" /><figcaption>Image 2: A successful build of <em>Polkascan PRE</em></figcaption></figure><h4>1.5. Cleaning up</h4><p>The following [docker] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.</li></ul><pre>docker-compose -p dev -f docker-compose.yml down</pre><ul><li>Remove all unused containers and images (caution!!).</li></ul><pre>docker system prune<br>[confirm] Y</pre><ul><li>Remove all containers and images (caution!!).</li></ul><pre>docker system prune -a<br>[confirm] Y</pre><ul><li>Remove all unused volumes (caution!!).</li></ul><pre>docker volume prune<br>[confirm] Y</pre><h3>2. Exploring Polkascan PRE</h3><p>The milestone 3 release of <em>Polkascan PRE</em> offers details on a number of new data entities, such as: <em>logs</em>, <em>accounts</em>, <em>indices</em>, <em>transfers</em>, <em>proposals </em>and <em>referenda</em>. These entities provide useful and meaningful data sets to the more abstract entities that were already supported by the milestone 2 release, such as: <em>blocks</em>, <em>extrinsics</em>, <em>events </em>and <em>runtime specification</em> entities. Basic definitions of these notions can be found in the Substrate’s <a href="https://substrate.dev/docs/en/overview/glossary">official documentation</a>.</p><h4>2.1. Exploring the GUI</h4><p>The <em>Explorer GUI</em> is an Angular (mobile friendly) application that consumes data from the <em>Explorer API</em>. The application’s landing page is accessible at the following link: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a>. The top section of the landing page displays a navigation menu to the following sections: <em>blocks</em>, <em>extrinsics</em>, <em>events</em>, <em>logs</em>, <em>accounts</em>, <em>indices</em>, <em>transfers</em>, <em>proposals</em>, <em>referenda </em>and <em>runtime specifications</em>. The Polkascan logo returns you to this landing page.</p><p>The header sections shows you the name of the network you are on, optionally supported by a color-code if it is a known (pre-configured) network. Additionally this section allows you to search by <em>block number</em>, <em>extrinsic hash</em> or <em>account address</em>. The next section of the landing page lists a number of key indicators, such as: the most recent finalized blocks, the number of signed extrinsics, the number of module events, the number of active accounts and the number of distinct runtime specifications that have been harvested. Furthermore, the bottom section of the landing page lists some details of the most recently harvested blocks and of the most recently harvested balance transfers. Both these list have buttons that allow you to find more details. Below you can find a list of useful sections of the <em>Explorer GUI</em>:</p><p><strong>Core blockchain entities</strong></p><pre><strong>Blocks</strong>: <a href="http://127.0.0.1:8080/block">http://127.0.0.1:8080/block</a><br><strong>Extrinsics</strong>: <a href="http://127.0.0.1:8080/extrinsic">http://127.0.0.1:8080/extrinsic</a><br><strong>Events</strong>: <a href="http://127.0.0.1:8080/event">http://127.0.0.1:8080/event</a><br><strong>Logs</strong>: <a href="http://127.0.0.1:8080/log">http://127.0.0.1:8080/log</a><br><strong>Accounts</strong>: <a href="http://127.0.0.1:8080/account">http://127.0.0.1:8080/account</a><br><strong>Runtime specifications</strong>: <a href="http://127.0.0.1:8080/runtime">http://127.0.0.1:8080/runtime</a></pre><p><strong>Key runtime module entities</strong></p><pre><strong>Account Indices</strong>: <a href="http://127.0.0.1:8080/indices/account">http://127.0.0.1:8080/indices/account</a><br><strong>Transfers</strong>: <a href="http://127.0.0.1:8080/balances/transfer">http://127.0.0.1:8080/balances/transfer</a><br><strong>Democracy Proposals</strong>: <a href="http://127.0.0.1:8080/democracy/proposal">http://127.0.0.1:8080/democracy/proposal</a><br><strong>Democracy Referenda</strong>: <a href="http://127.0.0.1:8080/democracy/referendum">http://127.0.0.1:8080/democracy/referendum</a></pre><h4>2.2. Exploring the API</h4><p>The <em>Explorer API</em> is a <a href="https://falconframework.org/">Falcon</a> application that disseminates data from the relational database that is maintained by the <em>Harvester</em>. The Falcon-framework offers a fast RESTful API and we apply the <a href="https://jsonapi.org/">JSON-API</a> standard as message envelope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4aJyO4W7zikvPZdnr_btRQ.png" /><figcaption>Image 3: Exploring the API</figcaption></figure><p>Docker Compose uses <a href="https://docs.nginx.com/">NGINX</a> proxy rules to embed the <em>Explorer API</em> in the routing schema of the <em>Explorer GUI</em>. Below you can find a list of useful API end-points of the <em>Explorer API</em>:</p><p><strong>Core blockchain API endpoints</strong></p><pre><strong>Block overview</strong>: <a href="http://127.0.0.1:8080/api/v1/block">http://127.0.0.1:8080/api/v1/block</a><br><strong>Block detail</strong>: <a href="http://127.0.0.1:8080/api/v1/block/12345">http://127.0.0.1:8080/api/v1/block/12345</a><br><strong>Extrinsic overview</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic">http://127.0.0.1:8080/api/v1/extrinsic</a><br><strong>Extrinsic detail by id</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic/12345-0">http://127.0.0.1:8080/api/v1/extrinsic/12345-0</a><br><strong>Extrinsic detail</strong>: <a href="http://127.0.0.1:8080/api/v1/extrinsic/0x123...def">http://127.0.0.1:8080/api/v1/extrinsic/0x123...def</a><br><strong>Event overview</strong>: <a href="http://127.0.0.1:8080/api/v1/event">http://127.0.0.1:8080/api/v1/event</a><br><strong>Event detail</strong>: <a href="http://127.0.0.1:8080/api/v1/event/12345-0">http://127.0.0.1:8080/api/v1/event/12345-0</a><br><strong>Log overview</strong>: <a href="http://127.0.0.1:8080/api/v1/log">http://127.0.0.1:8080/api/v1/log</a><br><strong>Log detail</strong>: <a href="http://127.0.0.1:8080/api/v1/log/12345-0">http://127.0.0.1:8080/api/v1/log/12345-0</a><br><strong>Account overview</strong>: <a href="http://127.0.0.1:8080/api/v1/account">http://127.0.0.1:8080/api/v1/account</a><br><strong>Account detail</strong>: <a href="http://127.0.0.1:8080/api/v1/account/5Cabdce">http://127.0.0.1:8080/api/v1/account/5Cabdce</a>..<br><strong>Runtime specification overview</strong>: <a href="http://127.0.0.1:8080/api/v1/runtime">http://127.0.0.1:8080/api/v1/runtime</a><br><strong>Runtime specification detail</strong>: <a href="http://127.0.0.1:8080/api/v1/runtime/112">http://127.0.0.1:8080/api/v1/runtime/112</a></pre><p><strong>Key runtime module API endpoints</strong></p><pre><strong>Account Index overview</strong>: <a href="http://127.0.0.1:8080/api/v1/indices/account">http://127.0.0.1:8080/api/v1/indices/account</a><br><strong>Account Index detail:</strong> <a href="http://127.0.0.1:8080/api/v1/indices/account/Fc12">http://127.0.0.1:8080/api/v1/indices/account/Fc12</a><br><strong>Transfer overview:</strong> <a href="http://127.0.0.1:8080/api/v1/balances/transfer">http://127.0.0.1:8080/api/v1/balances/transfer</a><br><strong>Transfer detail:</strong> <a href="http://127.0.0.1:8080/api/v1/balances/transfer/0x123..def">http://127.0.0.1:8080/api/v1/balances/transfer/0x123..def</a><br><strong>Democracy Proposal overview</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/proposal">http://127.0.0.1:8080/api/v1/democracy/proposal</a><br><strong>Democracy Proposal detail</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/proposal/1">http://127.0.0.1:8080/api/v1/democracy/proposal/1</a><br><strong>Democracy Referendum overview</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/referendum">http://127.0.0.1:8080/api/v1/democracy/referendum</a><br><strong>Democracy Referendum detail</strong>: <a href="http://127.0.0.1:8080/api/v1/democracy/referendum/1">http://127.0.0.1:8080/api/v1/democracy/referendum/1</a></pre><h4>2.3. Exploring the DB</h4><p>Polkascan PRE is DBMS-agnostic. That said, we have set up the Docker Compose configuration for this milestone with recent version of MySQL. You can connect to the MySQL DBMS with you favorite tool. The default connection details are listed below:</p><pre>Host: 127.0.0.1<br>Port: 33061<br>Database: polkascan<br>Username: root<br>Password: root</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNWyCQnWpfoYFyW005l4Yg.png" /><figcaption>Image 4: Exploring the DB</figcaption></figure><p>The database consists a number of tables which are outlined below:</p><pre><strong>alembic_version</strong>: version data to enforce ddl by SQLAlchemy.<br><strong>data_account</strong>: account data.<br><strong>data_account_audit</strong>: account audit data.<br><strong>data_account_index</strong>: indices account data.<br><strong>data_account_index_audit</strong>: indices account audit data.<br><strong>data_block</strong>: block data.<br><strong>data_block_total</strong>: additional block data.<br><strong>data_democracy_proposal</strong>: democracy proposal data.<br><strong>data_democracy_proposal_audit</strong>: democracy proposal audit data.<br><strong>data_democracy_referendum</strong>: democracy referendum data.<br><strong>data_democracy_referendum_audit</strong>: democracy referendum audit data.<br><strong>data_event</strong>: event data.<br><strong>data_extrinsic</strong>: extrinsic (and transaction and inherent) data.<br><strong>data_log</strong>: digest log data.<br><strong>data_session</strong>: session data.<br><strong>data_session_total</strong>: additional session data.<br><strong>data_session_validator</strong>: session validator data.<br><strong>runtime</strong>: runtime specification data.<br><strong>runtime_call</strong>: runtime specification data of call functions.<br><strong>runtime_call_param</strong>: runtime specification data of call function parameters.<br><strong>runtime_storage</strong>: runtime specification data of storage functions.<br><strong>runtime_event</strong>: runtime specification data of events.<br><strong>runtime_event_attribute</strong>: runtime specification data of event attributes.<br><strong>runtime_module</strong>: runtime specification data of modules.<br><strong>runtime_type</strong>: runtime specification data of types.</pre><h3>3. Stateful data in state-machine</h3><p>One of the key challenges we had to solve for our milestone 3 deliverables has been to devise a method to deal with <strong><em>Stateful </em></strong>entities in the explorer. <em>Accounts</em>, <em>indices</em>, <em>democracy proposals</em> and <em>democracy referenda</em> are examples of objects that actually live inside the blockchain and have a lifecycle in which they get their <em>state transitioned</em> by the <em>runtime</em>.</p><p>This, in contrast to the <strong><em>Stateless </em></strong>entities such as <em>extrinsics</em>, <em>events </em>and <em>blocks </em>which all get written to the blockchain once and remain <em>static </em>(or <em>immutable</em>).</p><p>Our milestone 3 harvester now has two distinct processes, which we call the <strong><em>Accumulator</em></strong>, which harvests stateless data and the <strong><em>Sequencer </em></strong>which builds stateful data based on the already available stateless data. The accumulator’s tasks scale really well because they can be parallelized and executed in any random order. Only very few tasks have to be executed by the sequencer.</p><p>In time our project may very well end up building a Python WASM-interpreter for handling the runtime binary or even building a full Python Substrate-client. However, for now, our method is very effective for our purposes.</p><h3>4. Polkascan and the ecosystem</h3><p>Our development activities are closely aligned with ecosystem partners <a href="https://web3.foundation/">(Web3 Foundation</a> and <a href="https://www.parity.io/">Parity Technologies</a>). We support various new networks and future parachains <a href="https://edgewa.re/">(Edgeware</a>, <a href="https://robonomics.network/">Robonomics</a><a href="https://www.joystream.org/">, Joystream</a> and many more to come). And we are in ongoing dialog with other ecosystem service providers (<a href="https://www.speckleos.io/">wallets</a>, <a href="https://faucets.blockxlabs.com/">faucets</a>, <a href="https://polkadot.js.org/">clients</a>) about integration with our platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fgVaoONatoxiN84NC8b7xQ.png" /><figcaption>Image 5: Integration between Polkadot-UI and Polkascan.io. (<a href="https://poc-3.polkadot.io/">link</a>)</figcaption></figure><h3>5. Hacking Polkascan PRE</h3><p>Our stack is mostly based on Python frameworks for our Harvester and API apps and the Angular framework for our GUI app. Our application is glued together with <a href="https://docs.docker.com/">Docker</a> and <a href="https://docs.docker.com/compose/overview/">Docker-Compose</a> which allow our stack to run virtually everywhere. Many cool hacks can be achieved by by hacking the docker compose file we used earlier in this document. We have documented many cool hacks in our <a href="https://medium.com/polkadot-network/polkascan-development-update-2-966d549f77ef">previous development update</a>, such as: <em>customizing ports</em>, <em>running other networks</em>, <em>using your own Substrate-node</em> and <em>using your own database server</em>. We will host a workshop at <a href="https://web3summit.com/">Web3 Summit 2019</a> to help you get started with hacking on Polkascan.</p><h3>About Polkascan &amp; WEB3SCAN</h3><p>Our project contributes to the Polkadot ecosystem by providing an MVP for a generalized open-source ecosystem block explorer, called <em>Polkascan PRE</em>. <em>Polkascan PRE</em> offers a block explorer for any Substrate-based blockchain, such as the Polkadot relay chain (Alexander network). This block explorer harvests and decodes data from Substrate-nodes, stores the decoded data in a relational database and disseminates the data through an API to be used in a block explorer user interface. The <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Wave1 Grant</a> ensures that the Polkadot-ecosystem has access to an open source block explorer from day one!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dg-w3qd1gQHCVeLuNtxEaw.png" /><figcaption>Image 6: Polkascan.io the multi-chain block explorer for the Polkadot ecosystem. (<a href="https://polkascan.io/">link</a>)</figcaption></figure><p>With the Polkascan project we are additionally working on a multi-chain explorer called <em>Polkascan MC</em> of which <a href="https://polkascan.io/">polkascan.io</a> is an instance. This multi-chain explorer <a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">aims to make multi-chain data accessible and understandable</a>. In order to further our goals with the <em>Polkascan Multi-chain Explorer</em> we are developing block explorers that works well with many individual chains. Block explorers for these individual chains are — in turn — aggregated into the <em>Polkascan Multi-chain Explorer</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mwWrZVYkrk6l7rrh" /><figcaption>Image 7: Polkascan’s Dave Hoogendoorn participating in the LongHash incubation program in Singapore. (<a href="https://twitter.com/longhashhatch/status/1137940427280044032">tweet</a>)</figcaption></figure><h4>Polkascan project updates</h4><p>Our fourth milestone is due soon and will provide various performance optimizations of our stack. You can expect frequent updates and we intend to finish this project before the end of summer 2019. The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XTAngDYmpKclBHUf" /></figure><h4>WEB3SCAN | Service Provider</h4><p><strong>WEB3SCAN </strong>— the organization behind the Polkascan project — offers professional services around blockchain data and blockchain information management, including but not limited to providing full-service block explorers, consultancy services &amp; systems integration services. Reach out to us if you would like to learn more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdea45ab959f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-3-fdea45ab959f">Polkascan Development Update #3</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #2]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-2-966d549f77ef?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/966d549f77ef</guid>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[multichain]]></category>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[polkadot]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Wed, 22 May 2019 13:43:42 GMT</pubDate>
            <atom:updated>2019-06-04T08:28:30.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*VIZCodSQi8MhHrppW0lA1g@2x.png" /></figure><h4>Architecture (milestone 1) &amp; core data entities (milestone 2)</h4><p>With the Polkascan project we are working towards a multi-chain explorer. This development update is part of the work related to the <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Grant</a> that ensures that the Polkadot-ecosystem has access to an open source block explorer from day one! Our project contributes to the Polkadot ecosystem by providing an MVP for a generalized open-source block explorer for any Substrate-based blockchain, such as the Polkadot relay chain (Alexander network).</p><p>This second development update is released together with the delivery of our first two project milestones as <a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">announced here</a>.</p><ol><li><strong><em>Milestone 1 | architecture</em></strong>: The first milestones implements the basic system-architecture for all artifacts of our open source block explorer for Substrate-based blockchains, called <em>Polkascan PRE</em>. With this milestone <em>Polkascan PRE</em> provides a minimum set of harvested data for a number of Substrate-based blockchains. The first milestone release illustrates how all components of the architecture work together.</li><li><strong><em>Milestone 2 | core data entities</em></strong>: The second milestone extends the base system-architecture with data entities that are core to Substrate, such as: runtime metadata entities, extrinsics &amp; events. The second milestone release provides a full set of harvested data, including fully decoded views of: blocks, runtime modules, runtime call functions, runtime events, runtime types, extrinsics and events. These entities should exist in [most] Substrate-based blockchains. Therefore support for these entities makes <em>Polkascan PRE</em> compatible with [most] Substrate-based blockchains.</li></ol><h3>1. Getting started</h3><p>This development update will help you get started by running the second milestone release of <em>Polkascan PRE</em> yourself.</p><h4>1.1. Polkascan PRE on Github</h4><p><strong><em>Repositories</em>: </strong>The source code of <em>Polkascan PRE</em> can be found at our <a href="https://github.com/polkascan">Github organization</a>. This organization consists of several distinct repositories which collectively form <em>Polkascan PRE</em>. We apply some conventions for branches and versioned releases across these <em>Polkascan PRE</em> repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UJPi0N3WVbbXCBanb3Ygw.png" /><figcaption>Image 1: Polkascan on Github: <a href="https://github.com/polkascan">https://github.com/polkascan</a></figcaption></figure><p><strong><em>Branches</em>: </strong>Each repository has our most recent — but possibly unstable — work in the <a href="https://github.com/polkascan/polkascan-pre/tree/master"><em>master</em></a>-branch. We have defined a <a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">number of project milestones</a> for our open-source block explorer. The source code and software releases of <em>Polkascan PRE</em> are aligned with our project milestones. Milestone 1 work can be found in the <a href="https://github.com/polkascan/polkascan-pre/tree/milestone1"><em>milestone1</em></a>-branch, milestone 2 work can be found in the <a href="https://github.com/polkascan/polkascan-pre/tree/milestone2"><em>milestone2</em></a>-branch, etc.</p><p><strong><em>Releases</em>: </strong>In addition to these distinct branches per milestone we align our <a href="https://github.com/polkascan/polkascan-pre/releases">software releases</a> with our milestones. Milestone 1 work is released as version ‘0.1.x’, milestone 2 work is released as ‘v0.2.x’, etc.</p><p><strong><em>Future support</em>: </strong>Our milestones are cumulative in nature, this means for example that our milestone 2 work provides all features that were offered in the milestone 1 branch and releases. This also implies that the <em>milestone1</em>-branch is deprecated and new commits will no longer be back-ported to this branch. And additionally as soon as the <em>milestone3</em>-branch becomes available the <em>milestone2</em>-branch will be deprecated. This development update hence focuses on our most recent milestone 2 release.</p><h4>1.2. What makes Polkascan PRE?</h4><p><em>Polkascan PRE</em> consists of a number of distinct software artifacts which collectively orchestrate <em>Polkascan PRE</em>. The <a href="https://github.com/polkascan/polkascan-pre-harvester"><em>Harvester</em></a> transforms a Substrate node’s raw data into relational data, with the help of <a href="https://github.com/polkascan/py-substrate-interface"><em>Substrate Interface Library</em></a> and the <a href="https://github.com/polkascan/py-scale-codec"><em>SCALE Codec Library</em></a>. The produced relational data is disseminated by the <a href="https://github.com/polkascan/polkascan-pre-explorer-api"><em>Explorer API</em></a> and in turn made accessible to end-users by the <a href="https://github.com/polkascan/polkascan-pre-explorer-gui"><em>Explorer GUI</em></a>. We have chosen to provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root.</p><p>Although these five distinct components of <em>Polkascan PRE</em> could be applied independently (and likely even in other projects), we offer a sixth piece of software, called: <a href="https://github.com/polkascan/polkascan-pre"><em>Polkascan PRE</em></a> that glues together all these components with Docker Compose.</p><h4>1.3. Requirements</h4><ol><li>Recommended hardware: &gt;8GB memory (more is likely better), &gt;100GB storage: (SSD is better), multi-core processor (more and faster cores is better) &amp; &gt;20 Mbps bandwidth (more and faster is better). These requirements will likely go down as the project matures.</li><li>Software requirements: Git, Docker &amp; Docker Compose.</li><li>Deployment of <em>Polkascan PRE</em> has been tested on Mac, Linux and Windows.</li><li>The <em>Explorer GUI</em> has been tested on Safari, Firefox, Chrome and Edge.</li></ol><h4>1.4. Running Polkascan PRE</h4><p>This paragraph provides a step-by-step guide on running our milestone 2 release of <em>Polkascan PRE</em> on your own machine. The instructions outlined in this paragraph can be found in our <a href="https://github.com/polkascan/polkascan-pre/tree/milestone2">Github repository</a>.</p><p>Step 1: Clone the repository:</p><pre>git clone <a href="https://github.com/polkascan/polkascan-pre.git">https://github.com/polkascan/polkascan-pre.git</a></pre><p>Step 2: Go to the new folder:</p><pre>cd polkascan-pre</pre><p>Step 3: Check available releases:</p><pre>git tag</pre><p>Step 4: Checkout the latest release in the v0.2.x range (replace ‘x’ with highest number):</p><pre>git checkout v0.2.x</pre><p>Step 5: Initialize and update submodules:</p><pre>git submodule update --init --recursive</pre><p>Step 6: Build and initialize the MySQL container:</p><pre>docker-compose -p dev -f docker-compose.yml up -d mysql</pre><p>Step 7: Build and initialize the other containers:</p><pre>docker-compose -p dev -f docker-compose.yml up --build</pre><p>Result: The Explorer GUI should now be available in a browser: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9aIHUl98VUVyy-6iwUGhw.png" /><figcaption>Image 2: A successful build of <em>Polkascan PRE</em></figcaption></figure><h4>1.5. Cleaning up</h4><p>The following [docker] commands should help you clean up.</p><ul><li>Stop all containers of the Docker Compose file.</li></ul><pre>docker-compose -p dev -f docker-compose.yml down</pre><ul><li>Remove all unused containers and images (caution!!).</li></ul><pre>docker system prune<br>[confirm] Y</pre><ul><li>Remove all containers and images (caution!!).</li></ul><pre>docker system prune -a<br>[confirm] Y</pre><ul><li>Remove all unused volumes (caution!!).</li></ul><pre>docker volume prune<br>[confirm] Y</pre><h3>2. Exploring Polkascan PRE</h3><p>The milestone 2 release of <em>Polkascan PRE</em> offers details on a number of useful data entities, such as: blocks, extrinsics, events and runtime specifications. Basic definitions of these notions can be found in the Substrate’s <a href="https://docs.substrate.dev/docs/glossary">official documentation</a>.</p><h4>2.1. Exploring the GUI</h4><p>The <em>Explorer GUI</em> is an Angular (mobile friendly) application that consumes data from the <em>Explorer API</em>. The application’s landing page is accessible at the following URL when running the steps in the previous paragraph: <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a>. The top section of the landing page displays a navigation menu to the following sections: blocks, extrinsics , events and runtimes. The Polkascan logo returns you to this landing page.</p><p>The header sections shows you the name of the network you are on, optionally supported by a color-code if it is a known (preconfigured) network. Additionally this section allows you to search by <em>block number</em>, <em>extrinsic hash</em> or <em>account address</em>. The next section of the landing page lists a number of key indicators, such as: the most recent finalized blocks, the number of signed extrinsics, the number of events and the number of distinct runtimes that have been harvested. Furthermore bottom section of the landing page lists some details of the most recently harvested blocks and of the most recently harvested balance transfers. Both these list have buttons that allow you to find more details. Below you can find a list of useful sections of the <em>Explorer GUI</em>:</p><p><strong>Blocks</strong></p><ol><li>Block overview page: <a href="http://127.0.0.1:8080/system/block">http://127.0.0.1:8080/system/block<br></a>Provides an overview of harvested blocks sorted by block number in descending order. The details button allows you to navigate to the block details page.</li><li>Block detail page: <a href="http://127.0.0.1:8080/system/block/12345">http://127.0.0.1:8080/system/block/12345<br></a>Displays the harvested details of one particular block by block number.</li></ol><p><strong>Extrinsics</strong></p><ol><li>Extrinsic overview page: <a href="http://127.0.0.1:8080/system/extrinsic">http://127.0.0.1:8080/system/extrinsic<br></a>Provides an overview of harvested extrinsics sorted by block number in descending order and extrinsic index in ascending order. The details button allows you to navigate to the extrinsic details page.</li><li>Extrinsic detail page: <a href="http://127.0.0.1:8080/system/extrinsic/12345-0">http://127.0.0.1:8080/system/extrinsic/12345-0<br></a>Displays the harvested details of one particular extrinsic by block number and extrinsic index.</li><li>Extrinsic detail page: <a href="http://127.0.0.1:8080/system/extrinsic/0x123...def">http://127.0.0.1:8080/system/extrinsic/0x123...def<br></a>Displays the harvested details of one particular extrinsic by extrinsic hash. Please note that the extrinsic hash is only available for signed extrinsics and is equal to the (32 byte) blake2b-hash of the extrinsic data itself.</li></ol><p><strong>Events</strong></p><ol><li>Event overview page: <a href="http://127.0.0.1:8080/system/event">http://127.0.0.1:8080/system/event<br></a>Provides an overview of harvested events sorted by block number in descending order and event index in ascending order. The details button allows you to navigate to the event details page.</li><li>Event detail page: <a href="http://127.0.0.1:8080/system/event/12345-0">http://127.0.0.1:8080/system/event/12345-0<br></a>Displays the harvested details of one particular event by block number and event index.</li></ol><p><strong>Runtimes</strong></p><ol><li>Runtime landing page: <a href="http://127.0.0.1:8080/system/runtime">http://127.0.0.1:8080/system/runtime<br></a>Provides an overview of distinct runtime specifications for harvested blocks sorted by specification number in descending order. The details button allows you to navigate to the runtime details page.</li><li>Runtime detail page: <a href="http://127.0.0.1:8080/system/runtime/112">http://127.0.0.1:8080/system/runtime/112<br></a>Displays the harvested details of one particular runtime specification by specification number.</li></ol><h4>2.2. Exploring the API</h4><p>The <em>Explorer API</em> is a <a href="https://falconframework.org/">Falcon</a> (Python framework) application that disseminates data from the relational database that is maintained by the <em>Harvester</em>. The Falcon-framework offers a fast RESTful API and we apply the <a href="https://jsonapi.org/">JSON-API</a> standard as message envelope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tWElxLylNONhhBhTi5aHXA.png" /><figcaption>Image 3: Exploring the API</figcaption></figure><p>Docker Compose uses <a href="https://docs.nginx.com/">NGINX</a> proxy rules to embed the <em>Explorer API</em> in the routing schema of the <em>Explorer GUI</em>. Below you can find a list of useful API end-points of the <em>Explorer API</em>:</p><p><strong>Blocks</strong></p><ol><li>Block overview page: <a href="http://127.0.0.1:8080/api/v1/system/block">http://127.0.0.1:8080/api/v1/system/block</a></li><li>Block detail page: <a href="http://127.0.0.1:8080/api/v1/system/block/12345">http://127.0.0.1:8080/api/v1/system/block/12345</a></li></ol><p><strong>Extrinsics</strong></p><ol><li>Extrinsic overview page: <a href="http://127.0.0.1:8080/api/v1/system/extrinsic">http://127.0.0.1:8080/api/v1/system/extrinsic</a></li><li>Extrinsic detail page: <a href="http://127.0.0.1:8080/api/v1/system/extrinsic/12345-0">http://127.0.0.1:8080/api/v1/system/extrinsic/12345-0</a></li><li>Extrinsic detail page: <a href="http://127.0.0.1:8080/api/v1/system/extrinsic/0x123...def">http://127.0.0.1:8080/api/v1/system/extrinsic/0x123...def</a></li></ol><p><strong>Events</strong></p><ol><li>Event overview page: <a href="http://127.0.0.1:8080/api/v1/system/event">http://127.0.0.1:8080/api/v1/system/event</a></li><li>Event detail page: <a href="http://127.0.0.1:8080/api/v1/system/event/12345-0">http://127.0.0.1:8080/api/v1/system/event/12345-0</a></li></ol><p><strong>Runtimes</strong></p><ol><li>Runtime landing page: <a href="http://127.0.0.1:8080/api/v1/system/runtime">http://127.0.0.1:8080/api/v1/system/runtime</a></li><li>Runtime detail page: <a href="http://127.0.0.1:8080/api/v1/system/runtime/112">http://127.0.0.1:8080/api/v1/system/runtime/112</a></li></ol><h4>2.3. Exploring the DB</h4><p><em>Polkascan PRE</em> is DBMS-agnostic. That said, we have set up the Docker Compose configuration for this milestone with recent version of MySQL. You can connect to the MySQL DBMS with you favorite tool. The default connection details are listed below:</p><pre>Host: 127.0.0.1<br>Port: 33061<br>Database: polkascan<br>Username: root<br>Password: root</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ad_weqTghbzGnnwW1AgTsg.png" /><figcaption>Image 4: Exploring the DB</figcaption></figure><p>The database consists a number of tables which are outlined below:</p><p><strong>Blocks</strong></p><pre><strong>data_block</strong>: provides decoded block data.<br><strong>primary key</strong>: id<br><strong>indexes</strong>: hash, parent_hash<br><strong>columns</strong>: id, parent_id, hash, parent_hash, state_root, extrinsics_root, count_extrinsics, count_events, spec_version_id, debug_info</pre><p><strong>Extrinsics</strong></p><pre><strong>data_extrinsic</strong>: provides decoded extrinsic data.<br><strong>primary key</strong>: block_id, extrinsic_idx<br><strong>indexes</strong>: block_id, extrinsic_idx, extrinsic_hash, call_id, signed, unsigned, account_index, address, module_id<br><strong>columns</strong>: block_id, extrinsic_idx, extrinsic_length, extrinsic_version, signed, unsigned, address_length, address, account_index, signature, nonce, era, call, module_id, call_id, params, success, error, spec_version_id, codec_error, extrinsic_hash</pre><p><strong>Events</strong></p><pre><strong>data_event</strong>: provides decoded event data.<br><strong>primary key</strong>: block_id, event_idx<br><strong>indexes</strong>: block_id, event_idx, extrinsic_idx, module, system, type, module_id, event_id<br><strong>columns</strong>: block_id, event_idx, extrinsic_idx, type, spec_version_id, module_id, event_id, system, module, phase, attributes, codec_error</pre><p><strong>Runtimes</strong></p><pre><strong>runtime</strong>: provides decoded runtime specification data.<br><strong>runtime_call</strong>: provides decoded runtime specification data of call functions.<br><strong>runtime_call_param</strong>: provides decoded runtime specification data of call function parameters.<br><strong>runtime_event</strong>: provides decoded runtime specification data of events.<br><strong>runtime_event_attribute</strong>: provides decoded runtime specification data of event attributes.<br><strong>runtime_module</strong>: provides decoded runtime specification data of modules.<br><strong>runtime_type</strong>: provides decoded runtime specification data of types.</pre><p><strong>Other</strong></p><pre><strong>alembic_version</strong>: provides version data to enforce table definition version management by SQLAlchemy.</pre><h3>3. Hacking Polkascan PRE</h3><p>It is recommended that you familiarize yourself with <a href="https://docs.docker.com/">Docker</a> and <a href="https://docs.docker.com/compose/overview/">Docker-Compose</a>. The following topics cover smart hacks to the Docker Compose file that has been used earlier in this document.</p><h4>3.1. Customizing the exposed UI port</h4><p><strong>Problem</strong>: The Docker Compose file uses port 8080 in the default configuration to expose the <em>Explorer GUI</em> and the <em>Explorer API</em> and you would like to use a different port for that.</p><p><strong>Solution</strong>: Simply substituting the occurrence of ‘8080’ before the colon (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L113">change 1</a>) and substituting the occurrence of ‘8080’ in the URL (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L111">change 2</a>) will do the job. (changes: <a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L113">1</a> &amp; <a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L111">2</a>)</p><h4>3.2. Customizing the exposed DB port</h4><p><strong>Problem</strong>: The Docker Compose file uses port 33061 in the default configuration to expose the MySQL DBMS and you would like to use a different port for that.</p><p><strong>Solution</strong>: Simply substituting the occurrence of ‘33061’ before the colon (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L87">change 1</a>) with the required port in the Docker Compose file will do the job.</p><h4>3.3. Customizing the exposed Substrate client’s RPC port</h4><p><strong>Problem</strong>: The Docker Compose file uses port 9933 in the default configuration to expose the Substrate node’s RPC endpoint and you would like to use a different port for that.</p><p><strong>Solution</strong>: Simply substituting the occurrence of ‘9933’ before the colon (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L99">change 1</a>) with the required port in the Docker Compose file will do the job.</p><h4>3.4. Customizing the exposed Substrate client’s WS port</h4><p><strong>Problem</strong>: The Docker Compose file uses port 9944 in the default configuration to expose the Substrate node’s WS endpoint and you would like to use a different port for that.</p><p><strong>Solution</strong>: Simply substituting the occurrence of ‘9944’ before the colon (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L100">change 1</a>) with the required port in the Docker Compose file will do the job.</p><h4>3.5. Running other networks</h4><p><strong>Problem</strong>: The Docker Compose file builds and runs a block explorer for a single node development network with the relay-chain client runtime.</p><p><strong>Solution</strong>: <em>Polkascan PRE</em> comes with four different public network configurations for the <a href="https://github.com/polkascan/polkascan-pre/blob/milestone2/docker-compose.alexander.yml">Alexander testnet</a>, the <a href="https://github.com/polkascan/polkascan-pre/blob/milestone2/docker-compose.edgeware.yml">Edgeware testnet</a>, the <a href="https://github.com/polkascan/polkascan-pre/blob/milestone2/docker-compose.robonomics.yml">Robonomics testnet</a> and the <a href="https://github.com/polkascan/polkascan-pre/blob/milestone2/docker-compose.joystream.yml">Joystream testnet</a>. Please inspect these Docker Compose files to see how you could adjust to other networks. In addition it is recommended that you adjust the docker-compose command by changing the ‘project-name’ [‘<em>-p’</em> or ‘<em> — project-name’</em>-option]. I.e. you should substitute ‘-p dev’ with ‘-p [network-name]’ to avoid conflicts with instances of <em>Polkascan PRE</em> you have running for other networks. Example commands can be found <a href="https://github.com/polkascan/polkascan-pre/blob/milestone2/README.md">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rfh-D8PEcA49lqdC" /><figcaption>Image 5: Arjan Zijderveld demonstrates <em>Polkascan PRE</em> for the Alexander network at Sub0 in Berlin. (<a href="https://youtu.be/TmfXDduVQLI?t=1027">video</a>)</figcaption></figure><h4>3.6. Using your own Substrate-node</h4><p><strong>Problem</strong>: The Docker Compose file builds and runs a Substrate node for the selected network. You may already have a Substrate node configured and you may want to use this node.</p><p><strong>Solution</strong>: Substitute the hostname and port in the Docker Compose file (<a href="https://github.com/polkascan/polkascan-pre/blob/f7e8db266584ad719d97d7940216fb9a2495e29c/docker-compose.yml#L40">change 1</a>) with the connection settings (hostname and port) of another Substrate node. And additionally completely remove the service called ‘substrate-node’ from the Docker Compose file.</p><h4>3.7. Using your own database server</h4><p><strong>Problem</strong>: The Docker Compose file builds and runs a MySQL DBMS. You may already have a MySQL DBMS configured and you may want to use that DBMS.</p><p><strong>Solution</strong>: Substitute the (multiple) connection configuration setting environment variables in the Docker Compose file (DB_HOST, DB_PORT, DB_USER, DB_PASSWORD and DB_NAME) with the connection configuration settings of the external DBMS. Before building and running the Docker Compose command ensure that the database and user account work. And additionally remove the service called ‘mysql’ from the Docker Compose file.</p><h4>3.8. Other off-scope topics</h4><p>The Docker Compose files also contains multiple instances of the <em>Harvester</em> which are in turn glued together with a <a href="https://redis.io/documentation">Redis</a> messaging system. These topics and inner workings remain off-scope for this development update.</p><h3>About Polkascan &amp; WEB3SCAN</h3><p>Our project contributes to the Polkadot ecosystem by providing an MVP for a generalized open-source ecosystem block explorer, called <em>Polkascan PRE</em>. <em>Polkascan PRE</em> offers a block explorer for any Substrate-based blockchain, such as the Polkadot relay chain (Alexander network). This block explorer harvests and decodes data from Substrate-nodes, stores the decoded data in a relational database and disseminates the data through an API to be used in a block explorer user interface. The <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">Web3 Foundation Wave1 Grant</a> ensures that the Polkadot-ecosystem has access to an open source block explorer from day one!</p><p>With the Polkascan project we are additionally working on a multi-chain explorer called <em>Polkascan MC</em> of which <a href="https://polkascan.io/">polkascan.io</a> is an instance. This multi-chain explorer <a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">aims to make multi-chain data accessible and understandable</a>. In order to further our goals with the <em>Polkascan Multi-chain Explorer</em> we are developing block explorers that works well with many individual chains. Block explorers for these individual chains are — in turn — aggregated into the <em>Polkascan Multi-chain Explorer</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6TNyvwJLDKAaHJuN" /><figcaption>Image 6: Emiel Sebastiaan on the relation between <em>Polkascan PRE</em> &amp; <em>Polkascan MC</em> at Sub0 in Berlin. (<a href="https://youtu.be/TmfXDduVQLI">video</a>)</figcaption></figure><h4>Polkascan project updates</h4><p>Our third milestone is due soon and will provide support for specific frequently used runtime modules. You can expect frequent updates and we intend to finish this project before the end of summer 2019. The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XTAngDYmpKclBHUf" /></figure><h4>WEB3SCAN | Service Provider</h4><p><strong>WEB3SCAN </strong>— the organization behind the Polkascan project — offers professional services around blockchain data and blockchain data analytics, including but not limited to providing full-service block explorers, consultancy services &amp; systems integration services. Reach out to us if you would like to learn more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=966d549f77ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-2-966d549f77ef">Polkascan Development Update #2</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polkascan Development Update #1]]></title>
            <link>https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/8451c4fcfc2e</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3-foundation]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Thu, 11 Apr 2019 09:55:32 GMT</pubDate>
            <atom:updated>2019-05-17T16:11:48.475Z</atom:updated>
            <content:encoded><![CDATA[<h4>Progress towards the <em>Polkascan Multi-chain Explorer</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*NROjYG0qKSW7hxpJ6oR9sA@2x.png" /></figure><p>Hello from the team building Polkascan. We are humbled that our project has been included in Web3 Foundation’s <a href="https://medium.com/web3foundation/web3-foundation-grants-wave-one-winners-2a9cd39f1fbc">first wave of grants</a>. The blockchain community will also benefit from this as W3F Grants requires all work resulting from this grant to be open-sourced.</p><p>Our project contributes to the Polkadot ecosystem by providing an MVP for a generalized open-source block explorer for Substrate-based blockchains, such as the Polkadot relay chain (Alexander network). The block explorer harvests and decodes data from Substrate-nodes, decoded data is stored in a relational database and is disseminated by an API to be used in a block explorer user interface. This grant ensures that the Polkadot-ecosystem has access to an open source block explorer from day one!</p><p>With the Polkascan project we are working towards a multi-chain explorer. We <a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">aim to make multi-chain data accessible and understandable</a>. In order to get to the <em>Polkascan Multi-chain Explorer</em> we are developing an explorer that works well with many individual chains. Explorers for these individual chains can in turn be aggregated into the <em>Polkascan Multi-chain Explorer</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q6i7rymV67yG3RuVe99Gdg.png" /><figcaption>Image 1: A growing Polkadot-ecosystem</figcaption></figure><p>Substrate — as blockchain development framework — is ideal for this generalized approach. By making our explorers compatible with Substrate, we are also making our explorers compatible with all the blockchains that are being built on Substrate. An increasing number of <a href="https://forum.web3.foundation/t/teams-building-on-polkadot/67">teams</a> are developing their blockchain projects with Substrate. All these teams and their respective communities will require explorers to some extent.</p><p>In this first update, we would like to give you a brief overview of our immediate development milestones as part of the ecosystem grant, and update you on our current progress.</p><h3>Overview of the open source explorer</h3><p>The generalized open source explorer for Substrate-based blockchains consists of a number of artifacts (applications, libraries and scripts).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dpY8lHuLq8DJx9Rj" /><figcaption>Image 2: The Polkascan Open Source Explorer stack</figcaption></figure><ol><li><strong>Python Harvester Application<br></strong>The purpose of the <em>Harvester Application</em> is to transform a Substrate node’s raw data into relational data for various classes of objects, such as: blocks, runtime metadata entities, extrinsics, events and various runtime data entities, such as: timestamps, accounts and balances.</li><li><strong>Python Substrate RPC Wrapper Library<br></strong>One repetitive task of the <em>Harvester Application</em> is to query a Substrate node for required data. A generalized library will specialize in this task. This library should independently be useful for the wider Polkadot-ecosystem.</li><li><strong>Python SCALE Codec Library<br></strong>Most of the data that the RPCs output is encoded with the <em>SCALE Codec</em>. This codec is used by the nodes’ internal runtime. In order to get to meaningful data — which applies to most of the data of the block explorer — this data will need to be decoded. The <em>SCALE Codec Library</em> will specialize in this task. This library should independently be useful for the wider Polkadot-ecosystem.</li><li><strong>Python Explorer API Application<br></strong>The purpose of the <em>Explorer API Application</em> is to make the data which is produced by the <em>Harvester Application</em> accessible to developers of the respective blockchains. The <em>Explorer API Application</em> will provide endpoints to all harvested data. This artifact may spawn a whole new range of applications which utilize rich data sets which are not directly offered by the Substrate node itself.</li><li><strong>Angular Explorer GUI Application<br></strong>The purpose of the <em>Explorer GUI Application</em> is to make the data which is produced by the <em>Harvester Applicatio</em>n and disseminated by the <em>Explorer API Application</em> accessible to day-to-day end-user of the respective blockchains. The <em>Explorer GUI Application</em> provides a user interface to the <em>Explorer API Application</em> and intends to showcase what developers should be able to build on top of the <em>Explorer API Application</em> for a wide audience of day-to-day users.</li><li><strong>Docker Compose<br></strong>Deploying all artifacts with Docker containers leaves the stack hardware agnostic and provides the freedom to easily scale up service management requirements. For example early stage deployment on AWS and subsequent migration to self-managed hardware due to cost efficiencies. All listed artifacts will be Dockerized.</li></ol><h3>Challenges</h3><p>We have solved a number of technical challenges when developing the <em>Polkascan Open Source Explorer</em>.</p><ol><li><strong>Performance<br></strong>Performance is a continuous challenge. In general, if you require the explorer to keep up with the chaintip of the blockchain, then you need to be able to perform all data processing and storage operations within the constraints of the blocktime.</li><li><strong>Large databases</strong><br>Managing very large database is a continuous challenge. In general, if you require the explorer to provide analytics over all data in a particular blockchain then your databases will grow very large.</li><li><strong>Archive nodes</strong><br>The explorer requires historical state data which is not necessarily found in a typical configuration of a Substrate node. Substrate nodes need to be configured as — so called — ‘archive’ nodes. Nodes with this configuration disable state pruning and keep historical states available.</li><li><strong>Service management</strong><br>A successful blockchain will be used extensively and thus will grow considerably. This leads to substantial amounts of data and thus high data storage requirements. In addition, a publicly served block explorer will have high data traffic requirements.</li><li><strong>Substrate specific challenges</strong><br>Substrate has relatively few RPC endpoints because it is a generalized low-level blockchain system. Most of the data that is provided by the RPC endpoints is encoded with the <em>SCALE Codec</em> and a number of cryptographic primitives and other codecs are applied by Substrate.</li></ol><h3>Milestones</h3><p>The ecosystem grant allows us to develop key parts of the <em>Polkascan Multi-chain Explorer</em>’s architecture. Our immediate priorities have been broken down into four distinct milestones outlined below.</p><ol><li><strong>Milestone 1: architecture<br></strong>This milestone implements the base system-architecture for all artifacts of the <em>Polkascan Open Source Explorer</em> stack. With this milestone the explorer should provide a minimum set of harvested data to show how all components of the stack’s architecture work together.</li><li><strong>Milestone 2: core data entities<br></strong>This milestone extends the base system-architecture for all artifacts of the <em>Polkascan Open Source Explorer</em> stack with the data entities that are core to Substrate, such as: runtime metadata entities, extrinsics &amp; events. With this milestone the explorer should provide a full set of harvested data, including fully decoded views of the following entities: blocks, runtime modules, runtime call functions, runtime storage functions, runtime events, runtime types, extrinsics and events. These entities should exist in [most] Substrate-based blockchains. Therefore support for these entities makes the <em>Polkascan Open Source Explorer</em> compatible with [most] Substrate-based blockchains.</li><li><strong>Milestone 3: key runtime data entities<br></strong>This milestone extends the base system-architecture for all artifacts of the <em>Polkascan Open Source Explorer</em> stack with a number of Substrate Runtime Module Libraries (SRML) that are key to the inner workings of the Polkadot Relay Chain, such as: timestamp, indices (accounts), balances, sessions, democracy, staking &amp; parachains. With this milestone the explorer should provide a full set of harvested data for the following entities: timestamps (for blocks), accounts (balances), staking (validators, nominators, balances), sessions (rewards), democracy (proposals, votes), parachains. These entities may not exist in all Substrate-based blockchains. Therefore support for these entities should be optional and configurable.</li><li><strong>Milestone 4: search, optimizations &amp; usability<br></strong>This milestone extends the base system-architecture for all artifacts of the <em>Polkascan Open Source Explorer</em> stack with search and filter functions. Furthermore this phase will implement performance optimizations and usability optimizations. With this milestone the explorer should efficiently provide a full set of harvested data for Substrate’s core data entities, Substrate’s key SRML entities and basic search/filter functions. Documentation and tutorials should allow Polkadot-ecosystem community members to run the <em>Polkascan Open Source Explorer</em> for the Polkadot relay chain (Alexander network) or for their own Substrate-based blockchain.</li></ol><h3>Project Updates</h3><p>Our first milestone is due soon. You can expect frequent updates and we intend to finish this project before the end of summer 2019. The following <strong><em>public </em></strong>resources enable tracking of progress of the project: <a href="https://medium.com/polkascan">Medium</a>, <a href="https://twitter.com/polkascan">Twitter</a> &amp; <a href="https://github.com/polkascan">GitHub</a>.</p><h3>Reach out to us</h3><p>We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jZawnAf4YSc9I0Mm" /><figcaption>Image 3: Polkascan makes Multi-chain Data Accessible &amp; Understandable</figcaption></figure><p><strong>WEB3SCAN </strong>— the organization behind the Polkascan project — offers professional services around blockchain data and blockchain information management, including but not limited to providing fully serviced block explorers, consultancy services &amp; systems integration services. Reach out to us if you would like to learn more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8451c4fcfc2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/polkascan-development-update-1-8451c4fcfc2e">Polkascan Development Update #1</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Polkascan]]></title>
            <link>https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe?source=rss-bf4dc3bf1050------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8bcf8de6bbe</guid>
            <category><![CDATA[substrate]]></category>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[block-explorer]]></category>
            <category><![CDATA[polkascan]]></category>
            <category><![CDATA[polkadot-network]]></category>
            <dc:creator><![CDATA[Emiel Sebastiaan]]></dc:creator>
            <pubDate>Thu, 13 Dec 2018 14:28:49 GMT</pubDate>
            <atom:updated>2019-05-17T16:08:33.648Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring Polkascan: The Multi-Chain Block Explorer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*7DqVJeVG0Rx0RYKZKiIfHQ@2x.png" /></figure><p>Polkadot is roughly 12 months from being delivered. As Polkadot approaches a feature-complete codebase, applications, services, and businesses can begin integrating with Polkadot. With Polkascan, we are one of the first independent service providers in the Polkadot ecosystem. This blog details our contribution to this great emerging ecosystem.</p><p>To get you started watch our <a href="https://www.youtube.com/watch?v=LaDiD5per80">recent presentation</a> in Prague and check out our live prototype: <a href="https://polkascan.io/">polkascan.io</a>.</p><h3>Why Polkascan</h3><p>Polkascan.io is not just any block explorer, but a multi-chain explorer. Polkascan intends to make multi-chain data accessible and understandable. In the past few years we have worked with a number of blockchains and blockchain technologies and we have learned several important things along the way:</p><ol><li>A never-ending list of things is being put onto blockchains to service a <a href="https://www.wired.com/story/187-things-the-blockchain-is-supposed-to-fix/">never-ending list of applications</a>.</li><li>Blockchain client software allows for easy access to some types of data (Figure 1: pink section), but most of the useful pieces of information are really hard to get.</li><li>More frequently, the pieces of information you need cannot be found in a single (blockchain) source.</li></ol><p>When we say that Polkascan makes multi-chain data accessible and understandable we are talking about the entire spectrum of Figure 1 below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sa3Es936LVCZNJX-" /><figcaption><em>Figure 1: Things on blockchains you want to know</em></figcaption></figure><h3><strong>Guiding principles</strong></h3><p>We have identified a number of trends in blockchains and explorers that have guided us in our approach to building Polkascan:</p><ol><li>The future will consist of <em>many blockchains</em>, but there will be a <em>consolidation of core blockchain technology frameworks</em>.</li><li>Block explorers will be <em>key infrastructure</em> components in the broader ecosystem.</li><li>Building and operating block explorers requires <em>specialized skills</em> that many of the talented blockchain developers and stewards will happily <em>outsource </em>to specialized <em>service providers</em>.</li></ol><p>WEB3SCAN — the organization behind the Polkascan service — intends to be one such service provider.</p><h3>A brief history</h3><p>This idea of building block explorers started in 2015 with a fascination and appreciation for some of the more advanced explorers in the Ethereum ecosystem. These explorers have been mostly closed or proprietary projects.</p><p>WEB3SCAN has been actively participating in the “Open Source Block Explorers NOW!” initiative. This initiative aims to work towards the goal of getting block explorer technology and blockchain data more accessible and readily available. Check out the <a href="https://www.youtube.com/playlist?list=PL4Artm1rmCWE5qYEOTaaPRl4fD5ORXFty">open discussions</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9AYyVM9QfKmJxNfV" /><figcaption><em>Emiel Sebastiaan exploring Polkascan (</em><a href="https://www.youtube.com/watch?v=LaDiD5per80"><em>watch video</em></a><em>)</em></figcaption></figure><h3><strong>Enter Polkadot &amp; Substrate</strong></h3><p>Until Q2 of 2018 we were building Ethereum Virtual Machine explorers. This helped us mature both our technology stack and our methodology. We have pivoted towards Polkadot and the general development framework <a href="https://www.youtube.com/watch?v=0IoUZdDi5Is">Substrate</a>.</p><p>We believe Substrate is one of the core technology frameworks that allows teams to easily and rigorously develop a very broad spectrum of blockchains and state machines. By building explorers that are compatible with Substrate, we make our explorers compatible with all the tech that is being built using Substrate.</p><p>We are anticipating a Cambrian explosion of innovation with Substrate, and consequently expect a market that will need to be serviced. One early example of the power of Substrate is the ease with which someone <a href="https://www.coindesk.com/ethereum-startup-parity-adds-casper-code-to-custom-blockchain-toolbox">implemented a basic skeleton of an Ethereum 2.0</a> client. With the Ethereum 2.0 Shasper client running on Substrate, we realised that by building a generalized Substrate explorer we will get an Ethereum 2.0 explorer as a bonus.</p><h3>Polkascan as blockchain middleware</h3><p>Our <em>multi-chain explorer</em><a href="https://polkascan.io/"> polkascan.io</a> should be seen as one particular general purpose application built on top of blockchains — and other data sources. The general purpose nature of polkascan.io is to support a broad spectrum of use cases listed in Figure 1, such as: history, search, correlations, forensics, etc.</p><p>Polkascan should be seen as a flexible blockchain middleware service between <em>any </em>(blockchain) data source and <em>any</em> (blockchain) application, as illustrated in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*052a5mQ_CmxaLoef" /><figcaption><em>Figure 2: Polkascan as blockchain middleware</em></figcaption></figure><p>Our current technology stack consists of two thin transformation services and one storage service. The first transformation service harvests data off the data sources and translates the data (normalizing, indexing, associating, etc) into data we store in a general purpose relational DBMS. The second transformation service prepares that data for the particular application.</p><p>There are a few easy critiques to this approach — although we believe this to be the methodology also applied by some of the other notable block explorers.</p><ol><li><em>Centralization</em>: having a centralized large database does not fit well with the WEB3 vision of a fully<a href="https://en.wikipedia.org/wiki/Decentralized_application"> decentralized application stack</a>.</li><li><em>Performance</em>: having a general purpose large database may not be very performant for all potential applications (such as: network analysis or forensics).</li><li><em>Scalability</em>: with the assumption of the future multi-chain reality, how does managing increasingly large databases scale?</li></ol><p>We acknowledge these critiques but at the same time we believe that we can address them and make our services future-proof. It’s a matter of trade-offs and priorities. Currently we lean towards agility and preparedness for as many applications as possible, as fast as possible, effectively enabling us to provide accessible data services now.</p><h3>Our Collaborations</h3><p>Our activities are tightly coupled with those of both <a href="https://web3.foundation/">Web3 Foundation</a> and <a href="https://www.parity.io/">Parity Technologies</a>. We have been working very hard on our live prototype <a href="https://polkascan.io/">polkascan.io</a>. This is an ongoing effort and aligns closely with the Polkadot/Substrate development roadmap.</p><p>Numerous projects and organizations have announced their intentions — and have shown effort — to develop state-of-the-art blockchains or state machines on Substrate (examples: <a href="https://medium.com/tokyo-fintech/ewald-hesse-energy-web-foundation-932bccdbac03">here</a>, <a href="https://medium.com/web3foundation/web3-foundation-and-chainlink-announce-collaboration-df55ed462a3a">here</a>).</p><p>We are proud to announce our collaboration with <a href="https://commonwealth.im/">Commonwealth</a> on their <a href="https://medium.com/commonwealth-labs/meet-edgeware-25e881e4a37e">Edgeware</a> project. We intend to support Edgeware in our Polkascan service from day one and thereby contribute to this wonderful experiment that will help advance the ongoing on-chain governance debate.</p><p>We are also excited to announce our collaboration with <a href="https://chainx.org/">ChainX</a>. ChainX is an inter-chain crypto-asset financial blockchain that will become a Polkadot parachain when their platform launches in 2019. ChainX has completed the development of a BTC bridge and DEX, and we can expect BCH, LTC, ZEC bridges to become available in the near future. We will be exploring how to make these datasets available in the Polkascan service.</p><p>We have many more exciting collaborations with ecosystem service providers and other notable Substrate implementers on the horizon and you can expect more collaboration announcements when these projects’ testnets draw closer.</p><h3>Get in touch</h3><p>We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the <a href="https://riot.im/app/#/room/%23polkadot-watercooler:matrix.org">Riot</a> channels on a daily basis. Come say hello and talk to us on how to get involved.</p><p>Follow us on <a href="https://twitter.com/polkascan">Twitter</a> for updates on our progress and feel free to reach out if you have any further questions or comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8bcf8de6bbe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polkadot-network/exploring-polkascan-the-multi-chain-block-explorer-c8bcf8de6bbe">Exploring Polkascan</a> was originally published in <a href="https://medium.com/polkadot-network">Polkadot Network</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>