# Create and Manage an OCN Identity

Being part of the Open Charging Network requires participants to set up and manage a self-sovereign identity (OCN Identity).

A 'self-sovereign identity’ is an identity where an individual maintains control over their own credentials, as opposed to having them stored in a centralized server by a third-party. A user's self-sovereign identity could, for example, be partially derived from their cryptocurrency wallet address, which the user maintains control of at all times.

{% hint style="info" %}
You can read more about self-sovereign identity in our documentation [here](../../foundational-concepts/self-sovereign-identity-introduction).
{% endhint %}

Secure identities are critical for the automated routing of OCPI-messages, and for being able to use applications on top of the Open Charging Network.

Below are details on how to complete the steps necessary to create your OCN identity:

1. [Select your country\_code and party\_id\* (and register at your country’s national registry\*\*)](#1.-pick-a-country_code-and-party_id-and-register-at-your-countrys-national-registry) (not required for node operators)
2. [Create a private/public key pair](#2.-create-a-private-public-key-pair)
3. [Create, read, update and delete your OCN Identity](#3.3.-create-read-update-and-delete-your-ocn-identity)
4. [Store your private key safely](#4.)

{% hint style="info" %}
Access the full OCN technical documentation [here](https://shareandcharge.com/wp-content/uploads/2020/11/OCN-Documentation-v1.1.pdf).
{% endhint %}

## 1. Select and register your country\_code and party\_id <a href="#id-1.-pick-a-country_code-and-party_id-and-register-at-your-countrys-national-registry" id="id-1.-pick-a-country_code-and-party_id-and-register-at-your-countrys-national-registry"></a>

\* This step is NOT required for OCN Node Operators

Your unique identity on the Open Charging Network is based on an [eMI3](https://emi3group.com/) compliant name constructed from a country\_code (e.g. “CH”) and party\_id (e.g. “SNC”).

Today, in many countries, national registries exist to ensure uniqueness of IDs. Please refer to the OCPI documentation for further information both on the Provider and Operator abbreviation as well as for a list of existing authorities: [OCPI 2.2 Documentation](https://github.com/ocpi/ocpi/blob/master/terminology.asciidoc#provider-and-operator-abbreviation).

Note that currently not all countries have a national registry. To see a list of countries that currently have a national registry, [see the OCPI 2.2 documentation, section 2.5. Provider and Operator abbreviation.](https://evroaming.org/app/uploads/2020/06/OCPI-2.2-d2.pdf)

## 2. Create a private/public key pair

The Open Charging Network uses a cryptographic wallet structure to provide security and unique identities. Wallets are used to construct your OCN identity, and to sign (authorize) actions on the OCN, such as sending and receiving messages. Your wallet (or private/public key-pair), along with your country\_code and party\_id ([Step 1)](#1.-pick-a-country_code-and-party_id-and-register-at-your-countrys-national-registry) form your identity on the Open Charging Network.

As such, **you must have an Ethereum-compatible wallet to create your OCN identity.** If you do not already have an Ethereum-compatible cryptocurrency wallet, we recommend using [MetaMask](http://metamask.io)**.**

You can read more about what cryptocurrency wallets are, and how they are used in the context of the Energy Web Chain [here](../../foundational-concepts/wallets-and-exchanges).

A public-private key pair is generated programmatically by a wallet through a cryptographic algorithm. The algorithm produces a private key and a corresponding public key. The public key can be exposed and shared with others (it is used to identify participants in the OCN Registry smart contract), **but the private key should not be shared with anyone**. The algorithm used to generate the key-pair makes it virtually impossible for any outsider to guess your private key.

## 3. Register and Manage your OCN Identity with the OCN Registry <a href="#id-3.-manage-your-ocn-identity-at-the-ocn-registry" id="id-3.-manage-your-ocn-identity-at-the-ocn-registry"></a>

After completing [Step 1](#1.-pick-a-country_code-and-party_id-and-register-at-your-countrys-national-registry) and [Step 2](#2.-create-a-private-public-key-pair), you are now ready to register your OCN Identity with the OCN Registry. This registry serves as the address book for all OCN Identities.

The OCN Registry is implemented as a [smart contract ](https://ethereum.org/en/developers/docs/smart-contracts/)deployed on the Energy Web Chain. Anyone is allowed to register with the OCN Registry.

As a neutral platform, the Energy Web Foundation holds the administration key to this smart contract. The initial implementation requires a centralized authority to have administration rights (e.g. for updates). As the governance of the OCN Registry is a crucial piece to ensure openness of the Open Charging Network, Energy Web Foundation will further develop this governance together with the community (e.g. enable decentralized administration).

**There are several ways to manage your OCN Registry entry.** We recommend using the [Command Line Interface](https://github.com/energywebfoundation/ocn-registry#cli), [Java](https://github.com/energywebfoundation/ocn-registry#java-library) or [TypeScript library](https://github.com/energywebfoundation/ocn-registry#typescript-library) provided in the [OCN Registry repository on GitHub.](https://github.com/energywebfoundation/ocn-registry/blob/master/contracts/Registry.sol)

### 3.1 Gather Required Information

The required information varies according to your role within the network and whether you are running a node or not.

You will need to determine your party's role. The most common roles are "CPO" (Charge Point Operator) and "MSP" (Mobility Service Provider).

You can see a full list of supported roles within [OCPI 2.2 in the documentation at _6.4.2 Role_](https://evroaming.org/app/uploads/2019/02/OCPI-2.2-RC1.pdf).

|                          | OCPI Party (CPO, eMSP)                                                                                                                                                                                                                                                                                      |               Node Operator              |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------: |
| **Required Information** | <ul><li>Country_code</li><li>Party_id</li><li>Role (e.g. "CPO" or "MSP")</li><li>OCN Node Operator wallet address</li></ul>                                                                                                                                                                                 | <ul><li>Public URL of OCN Node</li></ul> |
| **Optional Information** | <ul><li>Implemented OCPI modules. To see the full list of OCPI modules, and which modules each party typically implements, see the <a href="https://evroaming.org/app/uploads/2020/06/OCPI-2.2-d2.pdf">OCPI 2.2. documentation</a> 2.3.1. <em>Typical OCPI imp</em>l<em>ementations per Role</em></li></ul> |                                          |
|                          |                                                                                                                                                                                                                                                                                                             |                                          |

### 3.2 **Fund your Ethereum-Compatible Wallet**

As a a final preparation step, you need to fund your Ethereum wallet that you created in [Step 2.](#2.-create-a-private-public-key-pair) The funds will be used to enter our data into the registry. The transaction cost associated with entering the data into the registry is very low - less than 1 [EWT](../../ew-dos-technology-components-2023/trust-layer-energy-web-chain/energy-web-token).

Depending on whether you want to connect to the [Energy Web Public Test Network (Volta)](../../../ew-dos-technology-components-2023/trust-layer-energy-web-chain/ewc-guides-and-tutorials/testnet-and-mainnet#developing-on-volta-test-network) or the [Energy Web Production Network (Energy Web Mainnet)](../../../ew-dos-technology-components-2023/trust-layer-energy-web-chain/ewc-guides-and-tutorials/testnet-and-mainnet#developing-on-energy-web-main-network) there are two ways of getting funds for your wallet:

| Public Test Network (Volta)                                                                                                                                                                                                                             | Production Network (Mainnet)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Take your generated public wallet address and visit the [Volta faucet](https://voltafaucet.energyweb.org/). Enter the address and request 1 Volta Ether. _This will be more than enough to pay for the transaction to add our details to the registry._ | You can purchase Energy Web Token (EWT) at the [Liquid Exchange](https://blog.liquid.com/why-now-is-the-right-time-for-the-energy-blockchain), the [BitMart Exchange](https://www.bitmart.com/trade/en?symbol=EWT_BTC) and the [Kucoin Exchange](https://www.kucoin.com/news/en-energy-web-token-gets-listed-on-kucoin). Create an account at the exchange, fund it with your preferred currency and purchase Energy Web Token. _One token should be enough cover the transaction cost_. Then, transfer the tokens to the wallet address of your OCN Identity. |

### 3.3 Create, read, update and delete your OCN Identity <a href="#id-3.3.-create-read-update-and-delete-your-ocn-identity" id="id-3.3.-create-read-update-and-delete-your-ocn-identity"></a>

After funding your wallet, you are now ready to make OCN Registry entries. Please follow the technical instructions on the[ OCN Registry repository on GitHub "Listing a Party" ](https://github.com/energywebfoundation/ocn-registry/tree/develop#listing-a-party)for more detailed steps on how to do this using the [CLI library](https://github.com/energywebfoundation/ocn-registry#cli), [TypeScript library](https://github.com/energywebfoundation/ocn-registry#typescript-library) or [Java library](https://github.com/energywebfoundation/ocn-registry#java-library).

### 4. Store your private key safely - and don’t lose it

Your OCN Identity is your key to participate in the Open Charging Network. **Your private key from your cryptographic wallet (**[**Step 2**](#2.-create-a-private-public-key-pair)**) is required for managing your OCN Registry entry** (your self-sovereign identity). **Keep your private key safe!** It is advised to follow best-practices for secure storage and usage (similar to API Token Management, management of cryptocurrencies, etc.)

If you have any issues with your OCN Identity, please reach out to us.
