Substrate & EVM accounts

Creditcoin is both a Substrate based and a fully EVM compatible blockchain. To achieve this it uses a dual-account system to keep the native Substrate interactions untouched while providing the Ethereum-like experience many web3 users are familiar with.

At its core, Web3 leverages blockchain technology and decentralized protocols to create a more transparent, secure, and trustless online environment. It is centered around the use of smart contracts, which are self-executing contracts with the terms of the agreement directly written into code. This enables a diverse range of applications, including decentralized finance (DeFi), where smart contracts autonomously manage financial transactions and services such as lending, borrowing, and trading, without the need for traditional financial institutions.

If you want to know more about Creditcoin new EVM and smart contracts check the EVM Compatibility section.

Each type of account is meant to interact with different parts of Creditcoin. Substrate accounts are required to participate in the Nominated Proof-of-Stake consensus system, bond CTC and earn rewards by either contributing to block production or nominating validators. Meanwhile, only EVM accounts can interact with smart contracts and user defined tokens.

Accounts

Accounts represent entities that interact with the Creditcoin blockchain. They can be owned by a single user or shared by teams and organizations, and anyone can own multiple accounts. Accounts have several components:

  • Mnemonic seed phrase: these are human readable phrases that must be kept secret and can be used to generate one or several private keys. The process of generating a private key from a seed phrase is called Derivation. For basic users, having one seed phrase per private key is recommended to make backup and safekeeping of the account easier.

  • Address: the public part of the account; anyone with an address can send funds to it or check its status (balance, staked funds, validator activity and more). Substrate and EVM accounts have different address formats.

  • Associated accounts: these are keyless accounts that cannot be directly controlled, but play a key role in allowing interactions between Creditcoin and its integrated EVM. Associated accounts can receive and store funds on the main accounts behalf. Depending on the type of the main account (Substrate or EVM), associated accounts behave differently.

Substrate Accounts

On the Substrate side, accounts generate SS58 addresses. This is a simple address format designed for Substrate based chains. All Creditcoin SS58 addresses are prefixed with 5 and are 48 characters long. These accounts can be managed by Substrate wallets such as Subwallet, Polkadot-JS Extension, Subkey and the Creditcoin CLI.

Associated account behavior

All user controlled substrate accounts have an associated EVM account with the only purpose of receiving CTC from other EVM accounts and storing it. The Substrate account will not be able to use the funds stored by the associated account till it executes a Withdraw extrinsic.

The secrets below are publicly known. Do not use them to store mainnet CTC as it it mostly result in getting your funds stolen.

EVM Accounts

EVM accounts are different, they use H160 addresses, which are commonly used by all Ethereum-like blockchains. These start with 0x and are 42 characters long. EVM accounts can only be managed by EVM compatible wallets such as Subwallet, Metamask and, with limited functionality, Creditcoin CLI.

Associated account behavior

All EVM accounts have an associated Substrate account. These work differently than their Substrate counterparts: all funds sent to the associated account will be available for use inside the EVM instantly; there is no need to withdraw.

Transferring from Substrate to EVM

Funding an EVM account means funding its associated Substrate account.

  1. Get the Substrate address associated with the EVM main account using creditcoin CLI.

  2. Send CTC from a Substrate account to the Substrate address generated from the EVM account (Substrate → Substrate transfer).

  3. Funds should automatically be reflected on EVM wallets such as Metamask.

As an alternative, you can use Polkadot-JS UI to call a transfer extrinsic directly to the EVM address by selecting Account20

Transferring from EVM to Substrate

  1. Get the EVM address for the owned Substrate account using creditcoin CLI or Subscan address convertion tool.

  2. Use any EVM wallet to send funds from the EVM account to the EVM address associated to the Substrate account we want to send CTC to (EVM → EVM transfer).

  3. The funds will be available in the associated EVM account, but not usable by the Substrate side. To make them available once again we must unlock them by calling the evm.withdraw extrinsic with the correct associated EVM address and the amount that we want to withdraw. creditcoinCLI and Polkadot-JS UI can be used to perform the withdraw.

3.1 UsingcreditcoinCLI you can type the following command : creditcoin evm withdraw

3.2 Using Polkadot-JS UI

  1. After calling withdraw funds should be available once again on the Substrate

Last updated