Skip to content

Creating, Exporting, and Importing Freeverse Accounts

As usual in the blockchain space, all transactions (e.g. bids, trades etc.) require the use of cryptographic authentification. Our platform supports the industry standard cryptographic identities used in, for example, Ethereum.

OverviewUsers

The figure above shows an overview of your application should onboard new users when it comes to creating and trading NFTs with Freeverse. You should create a new FreeverseID for each of your users. The public component of that FreeverseID you can pass to your database, and use to assign assets to a user if you wish. The private key of that user should remain just that - private - and should not leave the local application without being encrypted. We provide libraries that enable you to export the encrypted private key to the user, which they can then use to trade their assets in the Freeverse marketplace.

Your Account

Your account is unique within the universe as it is the only one which has permissions to create new assets, assign an initial owner, and edit asset properties. You will need to sign all such transactions with your account.

You can follow the steps below to create your own account, passing us the FreeverseID (public address) only, so that we can register it as the owner of your universe.

Your User's Accounts

Your users will generate FreeverseIDs in order to acquire assets from you, and to trade within your universe. Users can accesss the Freeverse Marketplace with the assets created in your Universe by exporting/importing their FreeverseID. Likewise, if they created their ID directly from the Marketplace, and then acquired assets from your universe from there, you can let them import their account into your application to view their assets.

Creating a Freeverse Account

Freeverse Identities must be created client-side only (in the local installation of your game or application), so that the private key never leaves your users' devices at any time.

Warning

If you generated the account server-side, you would have access to the user's private key; if leaked, it would put in danger all assets owned now, and in the future, by your users.

Freeverse identies follow the same standard used for creating Ethereum addresses, with some of the main libraries being:

You can use any Ethereum library you prefer. Below are some examples of how to create an account.

Creating FreeverseIDs

Note

Freeverse Identities must be created locally only (the local installation of your game or app, or within the client-side code of your web application), so that the private key never leaves your users' devices at any time.

// npm install freeverse-crypto-js
const identity = require('freeverse-crypto-js');

const account = identity.createNewAccount();

// account.address => public FreeverseID of account
// account.privateKey => private key of account
// assuming Nethereum libraries installed

Nethereum.Signer.EthECKey ecKey = Nethereum.Signer.EthECKey.GenerateKey();

// ecKey.GetPublicAddress() => public FreeverseID of account
// ecKey.GetPrivateKey() => private key of account
# pip install web3

from web3 import Web3
w3 = Web3()
acct = w3.eth.account.create()

# acct._address => public FreeverseID of account
# acct._private_key => private key of account

Note

We strongly recommend that, once a user creates a pair (Private Key, FreeverseID) locally, the FreeverseID is communicated to your backend application, and stored in your application database, alongside any other information (username, email address etc.) that you store per-user.

You may now use this user's FreeverseID to assign assets to the user (should you wish) using the Freeverse API, as shown in the Getting Started guide.

Export a user account to trade on the Freeverse Marketplace

As soon as Living Assets are created for your users, the easiest way for them to trade them with other users is via the Freeverse Marketplace (if you are interested in licensing a custom version of this marketplace, please get in touch. In order to do this, you should permit users to export the FreeverseID (created locally in your application).

As permitting users to see and transmit their unencrypted private key is a security risk, the Marketplace requires import of private keys that have previously been encrypted using AES encryption. We provide a library for encryption and decryption of private keys, examples of whose use are found in our examples repository (see below).

Once you have encrypted the users private key using a user-provided password, the resulting string (referred to as the user's Encrypted Identity can be given to the user to enable them to login to the marketplace.

NodeJS Example

Clone into the Freeverse examples repository and, from the terminal, navigate to the examples/nodejs directory.

Run

npm install
npm run encrypt -- --password '<password>' --pk '<pvk_to_encrypt>'

where is the private key of the user you wish to encrypt, and is provided by the user.

The result printed to the console contains the encrypted private key, which can be used to import an identity either to our marketplace or other applications supporting Freeverse.

For more information regarding encrypting private keys, please see the documentation o¡n Creating, Exporting, and Importing Accounts.

Importing an existing FreeverseID to your application

It may be possible that a user in your application already has a FreeverseID (obtained either via the Freeverse Marketplace, or via a 3rd party application) and wishes to use it with your application. We recommend that you provide your users this option, as it provides a better experience for the user, though it is not strictly necessary. Should you wish to do this, you should follow the following steps:

  1. Request the users existing Encrypted Identity and password.
  2. Decrypt the Encrypted Identity to obtain the private key.
  3. Use the private key to derive the public address (the FreeverseID)
  4. Pass the public

NodeJS example

Clone into the Freeverse examples repository and, from the terminal, navigate to the examples/nodejs directory.

Run

npm run decrypt -- --password '<password>' --encrypted '<encryptedID>'

where is the private key of the user you wish to decrypt, and is provided by the user.

The result printed to the console contains the FreeverseID (public address) of the user, which can be used for assigning assets and making queries.

For more information regarding encrypting private keys, please see the documentation o¡n Creating, Exporting, and Importing Accounts.

Other languages

Should you wish to port our encryption algorithms to other languages, you can see the code used, along with a test suite, in our encryption repository.