Starknet: Create a HardHat Project Using A Starknet Plugin Hosted On IPFS

Learn how to create a Hardhat project with a Starknet plugin that’s hosted on IPFS.

What is Starknet?

Starknet is a permissionless ZK-rollup blockchain network that provides connectivity and functionality for dApps to achieve unlimited scalability using the Ethereum network.

Read below to learn how to create a Hardhat project with a Starknet plugin that’s hosted on IPFS.

Prerequisites:

1. First, we need a Filebase IPFS bucket.

To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.

2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

Select ‘Create Bucket’ in the top right corner to create a new bucket.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.

4. Next, download and install S3FS-FUSE on a Linux or macOS system.

5. Set up an Access Key file for use with S3FS-FUSE.

Set up a credentials file for S3FS at ${HOME}/.passwd-s3fs. You will need to save your Filebase Access and Secret keys to this file and give it owner permissions. You can do so with the following commands:

echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs

chmod 600 ${HOME}/.passwd-s3fs

ACCESS_KEY_ID is your Filebase Access key, and SECRET_ACCESS_KEY is your Filebase Secret key. For more information on Filebase access keys, see here.

6. Mount your bucket.

You can mount a Filebase IPFS bucket with the command:

s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs -o url=https://s3.filebase.com

  • mybucket: name of your Filebase bucket

  • /path/to/mountpoint

7. Now, navigate into the mounted Filebase bucket.

cd /path/to/mounted/bucket

8. Next, git clone the Starknet Hardhat project template:

git clone https://github.com/Shard-Labs/starknet-hardhat-example.git

9. Navigate into the project’s directory:

cd starknet-hardhat-example

10. Install the project’s dependencies:

npm install @nomiclabs/hardhat-docker

npm ci

11. Compile a smart contract to test the project’s functionality:

npx hardhat starknet-compile contracts/contract.cairo

12. Then, run a test to test out your smart contract:

npx hardhat test test/quick-test.ts

If you have any questions, please join our Discord server, or send us an email at hello@filebase.com

Last updated