# Configure Filehub · Chromia Docs (concept)

> This topic describes the steps to set up and manage a Filehub instance effectively.

Source: https://docs.chromia.com/ecosystem/filehub/configure-filehub/filehub-configure/

# Configure Filehub

On this page

* [Step 1: Initialize Filehub](#step-1-initialize-filehub)
* [Step 2: Set up admin privileges](#step-2-set-up-admin-privileges)
* [Step 3: Register a Filechain](#step-3-register-a-filechain)
* [Step 4: Enable/Disable a Filechain](#step-4-enabledisable-a-filechain)
* [Step 5: Configure payment systems](#step-5-configure-payment-systems)
* [Step 6: Enable/Disable payments](#step-6-enabledisable-payments)

This topic describes the steps to set up and manage a Filehub instance effectively. It covers how to register
Filechains, toggle file storage payments on or off, and establish cross-chain asset payments. Proper setup ensures
streamlined operations in file storage, payment handling, and Filechain management.

## Step 1: Initialize Filehub

Start by initializing your Filehub with the required parameters. These should include the URL for the Directory Node and
the specific blockchain RID for your Filehub instance.

note

Make sure to install the filehub package via npm:

Terminal

```
npm install filehub
```

JavaScript

```
const filehub = new Filehub({
  directoryNodeUrlPool: DIRECTORY_NODE_URL_POOL, //URL for Directory Node
  blockchainRid: FILEHUB_BLOCKCHAIN_RID, //Blockchain RID for the Filehub
});
```

## Step 2: Set up admin privileges

Use the private key of the Filehub or Filechain administrator to grant admin privileges, depending on which operations
you need to perform.

note

Make sure to install the [postchain-client](https://www.npmjs.com/package/postchain-client) package via npm if you
haven't already:

Terminal

```
npm install postchain-client
```

JavaScript

```
const admin = newSignatureProvider({ privKey: FILEHUB_ADMIN_PRIVKEY });
const filehubAdministrator = new FilehubAdministrator(filehub, admin);
```

## Step 3: Register a Filechain

To enable a Filechain for file storage operations, register it with your Filehub. Providing an EVM address during
registration assigns administrative control over the Filechain and allows for fee collection.

JavaScript

```
await filehubAdministrator.registerFilechain(
  FILECHAIN_BLOCKCHAIN_RID, //Unique RID for Filechain
  FILECHAIN_ADMIN_EVM_ADDRESS //Admin EVM address for the Filechain
);
```

## Step 4: Enable/Disable a Filechain

You can disable a Filechain when its storage capacity is full or for maintenance purposes. Once disabled, the Filechain
will not accept any new file storage requests. Re-enable it when it is ready to handle new file uploads.

JavaScript

```
// Disable a Filechain
await filehubAdministrator.disableFilechain(FILECHAIN_BLOCKCHAIN_RID);

// Enable a Filechain
await filehubAdministrator.enableFilechain(FILECHAIN_BLOCKCHAIN_RID);
```

## Step 5: Configure payment systems

Configure the asset for file storage payments. Ideally, select an asset from the Economy Chain for this purpose.

JavaScript

```
await filehubAdministrator.configureCrosschainAsset(ft4Asset, issuingChain);
```

## Step 6: Enable/Disable payments

Administrators have the ability to enable or disable payments for file storage. Disabling payments stops file uploads
until you enable payments again.

JavaScript

```
// Enable payments for file storage
await filehubAdministrator.enablePayments();

// Disable payments for file storage
await filehubAdministrator.disablePayments();
```

After completing these steps, your Filehub will be equipped to manage file storage, handle payments, and oversee
Filechain operations efficiently. For more detailed configurations and integrations, consult the Filehub API
documentation.

[View this page on docs.chromia.com](https://docs.chromia.com/ecosystem/filehub/configure-filehub/filehub-configure/)Content mirrored from the live docs
