Перейти к содержимому

Как загрузить картинку в блокчейн arweave

  • автор:

How To Upload Files Into Arweave

Altcoin Buzz

The Sandbox, a Metaverse firm, issued a security alert after a phishing attack targeted its users, urging caution and password changes.

Don't Pollute Our Motherland – Save Soil

save soil, save food, save nature, ksn token

By Kissan Token

Social Engagement Burning

Polygon Launches Decentralized ID Product Powered by ZK Proofs

US Terareum DEX Opens for TERA2 and Web3.0 Blue Chip Token Trade

TERA2/USDT pair trades successfully on its own TERAREUM DEX in the US. TERA2/WETH trading pair could be listed on the top 10 tier exchanges.

How To Upload Files Into Arweave

  • 16:31How Ethereum Can Appeal to Institutional Investors: Fidelity
  • 16:03Ethereum Future ETFs: VanEck to Donate 10% Profit to Protocol Guild for 10 Yearsuniswap
  • 14:33Tron TVL Balloons To Over $15 Billion: DeFi Growth Evident?
  • 14:01Effects of HTX’s $8M Hack on Centralized Crypto Exchanges: Experts Weigh In
  • 12:49New desalination system produces drinking water at high rate
  • 12:43Google Cloud is now a validator on Polygon
  • 11:40Coinbase CEO Brian Armstrong Says the US Needs Crypto Regulatory Clarity To Maintain the Dollar-Based Soft Powercoinbase
  • 11:16US Dollar (DXY) Reaches One-Year Peak, but Michael Saylor Sees Bitcoin (BTC) as ‘Lifeline’
  • 10:55Hubble spots expansion of 20,000-year-old supernova explosion
  • 10:29Bitcoin (btc) wobbly at $27k, chainlink (link) charts 2-month peak above $8: weekend watchbinance
  • 10:29Ripple v. SEC: Pro-XRP Lawyer Says This is the Regulator’s Dumbest Argument
  • 9:57Millions in Ether Tied to FTX Account Drainer on The Move
  • 8:04Terraform Labs’ Do Kwon Refutes Leaked Slack Messages as Insignificant Evidence
Like? Rate It!

The protocol work on the concept that matches the requirement of people (any organizations or individuals) who need data storage with those people who have some spare drive space to contribute in a decentralized distributed environment.

On top of , there exists a permanent and decentralized web, known as permaweb. It mainly comprises a set of modular and interchangeable protocols that can host a full, decentralized web application.

So, in this article, we will explain how you can keep your important data safe by uploading it into the permanent storage system by Arweave.

Table of Contents

Users need to have an AR token in their digital wallet to access the Arweave dApps. The platform offers sufficient free AR tokens from the Arweave faucet to upload a few files. You can follow the steps (Claim AR tokens) shown in this article to get some free AR tokens to start with. We will generate a wallet while claiming free tokens from the faucet. The wallet’s key file (.json file) will be downloaded into the user’s system that we will use later to connect with the Ardrive application. You also need a Twitter account to start working with the Arweave platform.

Users who wish to get more AR tokens can buy from any supported exchanges, and later use the ArConnect extension to create a wallet and transfer tokens into it.

Claim AR Token

To use Arweave, visit the webpage. You can see the below-landing page. At the top right corner, you may notice the Claim A Token button.

Click on it, and the application will redirect you to the Arweave faucet page where a few instructions are written:

  • Download & save your new wallet (.JSON key file). You only have 1 chance to do this
  • Post the tweet using your Twitter account

Users need to follow these instructions to get the AR token.

To proceed, click on the Check-box, and click on Continue.

You will receive a prompt on your computer screen to download the key file (.json file) of your wallet. Click on Download, and save the file properly. We will use this file to set up our Ardrive account.

Once you download the file, click on . In the later step, you need to post a tweet from your personal Twitter account (see the below screenshot)

Click on Open Tweet Pop-Up. Your Twitter page will open with a similar pop-up message (see below screenshot).

This process will verify your Arweave address. Click on to post it on your profile.

Once you finish this step, you will see that the application has started processing the tweet data.

In the end, you will receive a completion message on your screen for your successful token claiming process.

ArDrive is a file storage decentralized application designed on top of Arweave. Users can store files inside their Ardrive account. They can create folders and organize their data accordingly. The files can be stored privately. Users can generate unique links and share them with other users publicly.

To access Ardrive, scroll down the Arweave webpage, and you will find the option to connect with Ardrive.

Click on Store Permanently, and the application will lead you to the Ardrive login page.

Click on Select Wallet, and browse your computer to select the desired. JSON file (key file) for your wallet.

Next, provide your credentials i.e Username and Password correctly, otherwise, you won’t be able to access the wallet.

You can now see the Ardrive landing page (see the below screenshot).

Upload Files in Ardrive

Click on , and you will get various activities/features that you can do in your Ardrive profile:

  • Create New Folder
  • Upload Files
  • Upload Folder
  • New Drive
  • Attach Drive
  • Create Manifest

If you want to store your files in a folder, then you can create one by going to the New Folder option. Provide a name, and finally approve by clicking on the button.

If you wish to upload a file (any file) inside a folder, then navigate to the desired folder. Now, click on Upload Files. The browser option will open and it will allow you to search the file in your local drive.

Select the file, you can see that the platform is charging a very nominal fee (in AR token) to upload the file. Confirm the process by hitting the button.

You can now see your files inside the desired folder.

Conclusion

Arweave aims to provide a solution to one of the most common issues with data storage. Users can easily use the Arweave application (ArDrive) to store their data permanently and safely. The app allows you to upload bulk files, drives, etc at a very low fee.

. Finally, for more cryptocurrency news, check out the Altcoin BuzzYouTube channel

. Above all, find the most undervalued gems, up-to-date research and NFT buys with Altcoin Buzz Access. Join us for $99 per month now.

How to upload files to ardrive manually and with ardrive CLI?

In the following post I will explaining what is Arweave, how to create a wallet, and also how to upload files manually and with the CLI.

For this example I will be uploading some free images from unsplash.

What is Arweave?.

According to the Arweave website, Arweave is a protocol that allows you to store data permanently, sustainably, with a single upfront fee.

You can think of it as an alternative to IPFS

With Ardrive, we will able to upload and share our files, there is also a fee calculator in case you want to know how much you will pay for the amount of data that you want store.

Prerequisites

  • Node.js installed
  • Ardrive CLI installed

Creating Our Project

  1. Open your terminal and type the following commands
  2. mkdir ardrive-tutorial
  3. cd ardrive-tutorial
  4. npm init —y
  5. Open the project with your preferred code editor

Dependencies

To install dependencies go to your project folder open a terminal and type the following.

Exit fullscreen mode

We will be using import so open package.json and add the following line «type» : «module».

Exit fullscreen mode

Project File Structure

Exit fullscreen mode

Table of Contents

1. Log in to ArDrive

This is not difficult to do, assuming that you created your wallet, you just go to Ardrive login page, and log in with your wallet.

login screen

user_pass

The user and password are for private folders.

2. Uploading Files to ArDrive

Remember that all the files will be permanently stored, that means that the files cannot be deleted.

The first thing that we will do is create a new drive by clicking on the New button.

step1

Then set a name and choose between public or private, I am going to choose public.

step2

Then we are going to click the New button again, and this time select «upload folder» because we are going to upload a folder with files in it, like I said before in this example I will be using some free images from unsplash. you can use whatever you want, just make sure that you have the permission to upload the files.

You will also be able to see the price to upload those files, so you can decide if you want to upload them.

step3

upload_cost

Now you will be able to see a new folder in your drive, and if we open it we will be able to see the files in it, also we can download them, get details of each file, a preview link, etc.

file list

3. Uploading files with ArDrive CLI

To get more info about the commands that can be used type ardrive -h or in case you want more usage information about a command ardrive create-drive -h .

Now we are going to repeat the process but using ardrive cli instead, so the first thing that we are going to do is open our terminal and check if the ardrive CLI is installed with this command:

Exit fullscreen mode

You should get your ardrive CLI version.

Exit fullscreen mode

Then we are going to create a new drive, we must specify our wallet location and a name for the new drive, you can also specify if you want it to be a private drive with -p

Exit fullscreen mode

You should get an object with information about the drive and the folder like the following one:

Exit fullscreen mode

Then we are going to upload some files to it, if we want upload them to the root folder we will need to add the entityId of the previous object with «type»: «folder» , anyways if you open your ardrive and look for the drive that you created you can get the root folder id like this.

drive id and folder id

We also need the file location, or folder location that we want to upload

Exit fullscreen mode

You will get a message like this:

Exit fullscreen mode

So as you can see, a new folder was created, also two files with it.

Now we can download that folder (it will be downloaded in your current console location) with this command:

Exit fullscreen mode

4. Script to create a .json with files info

Now we are going to create a custom script to get files and folder information and finally create a .json file with it that would be helpful for a real life NFT project.

First create a .env file in the root of your project and create a WALLET_PATH variable and add your wallet path like this C:\\YOUR\\WALLET\\PATH .

Then go to src folder and open index.js , copy and paste the following code, don’t worry I will explain it step by step.

I am going to use a folder form our previous example, but you can also work for a folder arDrive structure like this.

Exit fullscreen mode

We are going to import from ‘ardrive-core-js’ . we’ll be able to read our wallet with readJWKFile and use arDrive operations with arDriveFactory .

We are going to create a .json file at the end of our script so we need to use fs .

The script will prompt the user for the folder ID, with the folder ID we can get all folders inside that folder and we can also get the drive ID that will be needed to build the link to the folder.

We need sort the folders in case there are more than one and have a project name e.g. (PROJECT_NAME_1, PROJECT_NAME_2, PROJECT_NAME_3, etc) because probably we won’t get them sorted by default.

We will create a const foldersId = [] that will store every folder name and folder id.

Now we will use a for loop to loop through foldersId and will get the files of each folder with .

Exit fullscreen mode

We will sort those files because we could obtain them unsorted.

Then we are going to create a const filesInformation = [] that will store the information of each one of the files per folder.

After that we are going to use another for loop trough them inside our current loop, So with this approach we will get all the files info from the current folder.

Now we will store the folderName, folderLink, and also the filesInformation (fileName, fileId, and fileLink from the previous loop) and will be stored in a Files array.

Finally we will create a json file and we will write the stored data in Files.

Exit fullscreen mode

The final output will be similar to this:

Exit fullscreen mode

5. Conclusion

We have learned how to upload and share files with arDrive manually and with the CLI, also how to create a custom script to interact with the files uploaded.

I really hope you have been able to follow the post without any trouble, otherwise I apologize, please leave me your doubts or comments.

You can also find me on Discord Appu#9136

Thank you for your time.

Top comments (0)

For further actions, you may consider blocking this person and/or reporting abuse

How to upload and retrieve images from Arweave using Javascript

Storing data in a decentralized way is incredibly important when building a dapp and arweave makes it easy to permanently store data on the decentralized web.

Here’s how to upload an image file and display it from arweave in Javascript.

I will be using Reactjs, Nodejs and Firebase Functions but you could use almost any framework or backend here.

Step 1) Setup our frontend

This component handles an image input and saves it to a state variable. Note I removed all the styling for simplicity.

Step 2) Upload file to Firebase Storage

Step 3) Setup Arweave Function

Our firebase function will wrap the arweave JS package.

You can get your arweave private key by creating a new Arweave wallet:

Our function accepts the file path pointing to the location of our file in Google Cloud Storage, then converts it to an ArrayBuffer to send to Arweave.

From there, Arweave returns a transaction Id which we can use to retrieve our file.

Step 4) Display Image in our Frontend

We can use the arweave JS package to get the raw data from the transaction or we can simply display the file from the remote arweave url. I chose the latter because it’s easier, but here’s how can download arweave transaction

To display the transaction data you can simply append the transaction id to arweave’s url:

Then all you gotta do is add an image component

Step 5) Celebrate! ��

You can now store and display files on the decentralized web using arweave.

If you want to learn more checkout my other projects Ownchain and Mortar which are using arweave for file storage.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Школа онлайн: живые уроки с аттестатом государственного образца