Arweave – Blockchain platform for data storage

Tram Ho

More and more blockchain platforms support the storage and use of data such as blockstack, sia or ocean protocol, and there is an emerging platform that also supports this, Arweave. If you do not know, the platform has raised $ 8M from storing corona information: details can be found here .

Too many platforms on the same mission will eventually go to a state of selection to find the most suitable platform. In this article, I will introduce Arweave for people to try to evaluate the prospects of this blockchain platform for storing data.

General introduction

Arweave focuses mainly on data storage, users will pay fees to create transactions to store their data for 100 years for miners (the amount is calculated according to the formula given by arweave is readable. in yellow paper ).

The main goal is to store data and applications, besides there are other use cases like Feedweave and Weavemail.

Architecture

First, the architecture of Arweave’s block chain will not be the same as regular blockchain chains (usually like a linked list chain) but rather a graph since the blocks are not only linked to the previous block, but also linked to a Any block in a chain called a recall block .

This chain is called Blockweave , where the block is linked to the block before it and a recall block (this block is determined based on the hash code and the height of the block in front). The purpose of adding this one is to enable a Proof of Access (PoA) consensus mechanism. The composition of Blockweave’s blocks is also quite correlated like other blockchains such as BTC, ETH, … also contain headers and bodies (however, a special point is that each Arweave trx supports up to 10MB of data)

Consensus mechanism (Consensus)

As mentioned above, the consensus mechanism of this network is Proof of AccessProof of Access . The main purpose of this platform is to store data so that a consensus mechanism is generated so that it can be demonstrated that the miners are storing the data for the user.

First of all, PoA is an upgrade of PoW – that is, power is still needed for computation to solve the problem of creating a new block, but it will balance data storage.

Below is the formula to solve the problem of creating a new block

Before combining with nonce to solve math problem, Block data segment (BDS) is synthesized from 3 parts:

  1. TXs: This is a list of moderated transactions in the mining pool
  2. Previous Block: The latest block in Blockweave
  3. Recall Block: First we will have to find the correct recall block by relying on the hash and the height of the previous block will then determine the address of the recall block – That ensures that no miner can cheat. because block recall is unpredictable.

=> From the above data and combine with nonce to solve the same problem as PoW

From there, the improvements to PoA will temporarily solve the data storage problems thanks to the Recall Block :

  • Ensuring that miners have to store user data because they want to create a new block, they must have access to the recall block to get the hash data.
  • Minimize power costs because it will not spend too much hashrate because the difficulty will not be like PoW but will be based on the computation speed of the miners who own the recall block.

However, there will still be some weaknesses:

When miners re-enter into large pools, they will still refer to the old PoW problem because they all already have full nodes and will compete with each other based on computational speed, solo miners will be difficult to compete and can stop mining. => Then the user’s data access speed will decrease significantly because a large number of nodes have stopped storing but are concentrated in large pools (The problem of blockchain pow)

Permaweb

Prepare

Arweave not only supports data storage, but also supports applications with libraries to interact with data on the blockweave.

Sign up for a wallet

Just like the public blockchain, we will have a wallet to hold tokens, we can create a wallet through:

  • Extension: Use the extension to create a wallet through the chrome extension
  • Generate wallet via package (Recommended because the following will also be used to deploy the application):

Interacting with blockchain through ArweaveJs

In the article, I will guide you to build web-based applications, so through this library:

https://github.com/ArweaveTeam/arweave-js

And also requires a bit of Reactjs experience

To easily visualize the application we are going to build, you can see in front of its nose through:

Sudoku in Arweave

In this application, we will create Trx to save the user’s score and get it to show the leaderboard

The full source code will be here: sudoku arweave – you can refer

Building the application

After cloning the code from github, you will focus on the index.js file because most of the operations are concentrated in this part.

Initialization

First to interact we will need an instance to be initialized from the Arweave package through the properties below

Create transaction

Login via key file: The difference compared to Ethereum dapps compared to Arweave is that the Arweave side does not log in through the extension that will import the key file, the below function will read the key file and get the jwk for later use to register. the Trx

After uploading, you can directly create a transaction:

Creating a transaction will directly push data (data will be in the form of text, so if you want to save multiple types of data, it should be handled properly to make it easier to retrieve in the future).

The addTag fields are intended to query data later, so they need to be properly tagged

Query transaction

To query data from Blockweace we will have to use 1 Arweave language, ArQL: https://github.com/ArweaveTeam/arweave-js#get-transaction-data

The syntax will look quite similar to SQL like Or hay and, but still quite sketchy. Below is a simple query to get data back according to the tags we typed.

Call this query and sort the data (This requires decode data to be readable because this data will be encrypted) https://github.com/ArweaveTeam/arweave-js#decode-tags-from-transactions :

Deploy the application

Finally, after the application is running properly locally, we can give it to permaweb by deploying:

https://github.com/ArweaveTeam/arweave-deploy

With reactjs app it will be very handy because we are supported build so we can use this command directly to upload app to permaweb:

Remember that the arweave-deploy packages have been installed and the AR token is required in the wallet to create trx

Conclude

Above is an overview of the Arweave platform to store data and how to build applications on it, in the next articles I can guide how to become a miner on Arweave network.

Share the news now

Source : Viblo