Docs

Discover how Phala's AI Agent Contract offers the essential tools to develop and profit from intelligent applications.

Explore Now

How to create a Phat Dashboard account and get test tokens

2024-02-02

💡
This post is the general tutorial on how to obtain an account for Phat Dashboard. Phat Dashboard is a dApp powered by Phat Contract, designed to simplify the deployment and management of your own Phat Contract. It can also serve as an example of how to build a dApp using decentralized computing resources.
Block table_of_contents not supported

Prerequisites

  • You need either
    • Any EVM wallet browser extension if you are using our PoC6 testnet. We plan to introduce EVM wallet support to the mainnet once it becomes stable.
  • Terminal.
  • A minimum Node.js version of v18.
  • The instructions has been tested on Mac and Ubuntu 22.04.

Create Phat Dashboard account from CLI

Optional: Generate mnemonic

Open your terminal app and paste follow up line:

npx @phala/fn create-profile --generate

If you use it later in an EVM wallet, like MetaMask, add the extra flag: --type evm.

npx @phala/fn create-profile --generate --type evm

Please save the mnemonic generated from the above instruction, and keep it safe. If you lose this wallet, all the data and tokens associated with it will also be lost.

Create profile

Since it is a new wallet, you will need to transfer some test tokens into this account first. If you are using the PoC6 testnet, you can get test tokens from our Faucet. If you are building something on top of Phat Contract, you can also consider applying to our Builder Program to get further allowance and financial support.

Once you have transferred tokens into your account, you can use the following command to continue:

npx @phala/fn create-profile --suri <SURI>

For EVM account, use --privateKey:

npx @phala/fn create-profile --privateKey <SURI>

Or you can set up the account via .env file, we support four ways to specified the account.

  • PRIVATE_KEY : EVM wallet private key. It always starts with 0x. It only works for PoC6 testnet currently.
  • MNEMONIC : The mnemonic (recovery phrase) for the EVM wallet private key can be specified using EVM_MNEMONIC_ADDRESS_INDEX to indicate the account index, if desired. We DO NOT RECOMMEND to use mnemonic directly. It only works for PoC6 testnet currently.
  • POLKADOT_WALLET_SURI: The Substrate Uri for your polkadot account.
  • POLKADOT_WALLET_ACCOUNT_FILE and POLKADOT_WALLET_ACCOUNT_PASSWORD: The JSON file exported from your polkadot wallet extension, and the account password for the JSON file.

Import into a polkadot wallet browser extension

For Talisman wallet, you can use “Import via Recovery Phrase”, than choose “Polkadot”. Paste your recovery phrase (mnemonic) and click “Import”.

Import into MetaMask

💡
EVM wallet is only available on PoC6 testnet currently.

We use Chrome and MetaMask in this example.

If you are using MetaMask for the first time, after the installation is complete, it will open the get started page where you can choose to import an existing wallet and proceed.

When it prompt for secret recovery phrase, paste your 12-word phrase (mnemonic) and click confirm.

Next, it will ask to create a password. Pick one and never share it to anyone. Once it completes, you will see your account balance on Ethereum mainnet.

Phala Blockchain supports a partial implementation of the Ethereum JSON-RPC protocol. This allows you to add and switch networks, enabling real-time checking of account balances.

Here is the value for each fields:

  • Network name: Phala PoC6
  • New RPC URL: https://poc6.phala.network/ws
  • Chain ID: 12035
  • Currency symbol: PHA

It results into following screenshot. Click “Save”.

And you are here!

Create Phat Dashboard account from Browser

You can visit Phat Dashboard WebUI via dashboard.phala.network . To switch between mainnet and PoC6 testnet, you can click the dot icon on the top-right, and the “switch network” dialog will show.

NOTE: The EVM wallet support is only available and visible on PoC6 testnet.

Click “Connect wallet”, you will see a dialog like screenshot. Pick a wallet extension to continue.

For MetaMask (or any EVM wallet), it will popup three times:

  1. Confirming that connect to this website.
  1. Signing to allows access the current wallet public key.
  1. Signing a certificate for Phat Contract offchain API communication.

When you use the Phat Dashboard for the first time, you will see the onboarding dialog:

For the mainnet, you need to transfer some tokens before continuing. For the PoC6 testnet, you can click the “Get test PHA“ button and wait for a few seconds. Once you got tokens in your account, the “Create Profile” button will turn to green. Click it, and you need signing transactions for three times.

Once you create the profile successfully, you can click the balance number on the top-right and go to the User Profile page, you will see some stats about your account here, includes:

  • On-chain balance
  • Cluster balance
  • Staked token number and the share of computing.
  • The associated Phat Contract IDs, the Phat Dashboard is built on-top of those Phat Contract.
  • List of custodial wallets.

Export EVM wallet private key for CLI

You can export private key from MetaMask. You can find it in account detail and show as the screenshot.

You can use follow up command list your custodial wallets to check your private key is correctly:

npx @phala/fn list-evm-accounts --privateKey <private_key>

If you are under the project folder, you can set the private key via .env :

echo 'PRIVATE_KEY=<private_key>' >> .env

Then you don’t need to specify the private key in future usage.

Export polkadot wallet from Talisman

You can export your account from Talisman as JSON. NOTE: we recommend you using another password for the exported JSON file and remember it for later use.

You can use the exported JSON file with account password like following command:

npx @phala/fn list-evm-accounts -a <path_to_json_file> -p <account_password>

If you are under the project folder, you can set the account JSON file and account password via .env :

echo 'POLKADOT_WALLET_ACCOUNT_FILE=<path_to_json_file>' >> .env
echo 'POLKADOT_WALLET_ACCOUNT_PASSWORD=<account_password>' >> .env

About Phala

Phala Network is a decentralized cloud that offers secure and scalable computing for Web3.

With Phat Contracts, an innovative programming model enabling trustless off-chain computation, developers can create new Web3 use cases.

Get the latest Phala Content Straight To Your Inbox.