Topl Blockchain Address

The Topl blockchain address is a unique sequence of numbers and letters that functions similarly to an email address. In particular, the numbers and letters are Base58 encoded. The Topl blockchain address refers to a specific destination on the network to which assets can. For example, imagine that you want to make a transaction on the Topl network with your friend Bob. Bob will share his address with you and you will be able to transact with him via this address.

Generate an Address

Our public and private keys are generated using the Curve25519Curve25519 - Topl uses Curve25519 to generate public and private key pairs and for signing transactions. algorithm. You get a reference for your address in the following way:

Step 1: Add the network prefix

  • The network prefix allows nodes on the Topl network to verify which network the address is on

Network Prefix

Network

Notes

0x01

Topl Public Mainnet

Not yet available in Beta

0x10

Valhalla public testnet

Live in Beta

0x30

Local Developer Network

Used for BifrostBifrost - Project Bifrost is a Scala client designed over a cryptocurrency/blockchain protocol developed to achieve three specific goals: 1.) Facilitate movement and investment of capital from investors in developed economies to businesses in developing economies 2.) Create a commodity market that collateralizes a stable currency via storage and redemption 3.) Develop a reputation system and historical reference of business behaviour Developers

Step 2: Append the propositionType prefix

  • Topl supports addresses with public/private key pairs that are generated using two different algorithms.

Prefix

propositionType

Notes

0x01

Curve25519 Public Key Hash

Default Implementation by Brambl KeyManager

0x02

Curve25519 Threshold Hash

Another implementation accepted by the Topl Network

Step 3: Append the evidence content

The evident content is a 32 byte commitment to the proposition that must be supplied and satisfied by the transaction issuer.

propositionType

Generation Method

Notes

0x01

Blake2b-256 Hash of the Public Key

For Curve25519 Public Key Hash

0x02

Blake2b-256 Hash of all public keys in the threshold proposition

For Threshold Hash

Step 4: Append the address checksum

Finally, add the first 4 bytes of the Blake2b-256 hash of the preceding 34 bytes.

Step 5: Convert into Base58

The last step is to convert the address that you get after appending the four pieces of information into Base58.

Generate an address using the BramblJS KeyManager module

The easiest way to generate an address is using the Brambl KeyManager Module. An example of this is shown in the recipe below.

The KeyManager module is compliant with Bifrost's Gjallarhorn Key Manager service and provides an straightforward interface for creating new keyfiles as well as creating and verifying signatures on transactions. New encrypted keyfiles are generated using Curve25519 key pairs and are encrypted using an AES-256 cipher with a user-specified password. All data within the keyfile is encoded using Base58.

Generate an address using the BramblSc KeyRing

If you are using BramblSc, it is also simple to generate and address. An example is shown below

val address = brambl.keyRing.DiskOps.generateKeyFile("password").get

Generate multiple addresses using the BramblSC KeyRing

First, let's initialize our BramblSC instance, then create 3 addresses using the KeyRing.

📘

Note:

The password to encrypt the keyfile used must be encoded in Latin-1. In addition, please replace {{myProjectId}} with your projectID.

val provider: Provider = ValhallaTestNet(apiKey = "myApiKey", uri = "https://staging.vertx.topl.services/valhalla/{{myProjectId}}")
val brambl: Brambl = Brambl.standalone("./my_key_directory",Some( provider))
  
val addrs: Set[Address] = brambl.keyRing.generateNewKeyPairs(3) match {
  case Failure(exception) => throw exception
  case Success(value) => value.map(_.publicImage.address(brambl.networkPrefix))
  }

Import Bifrost Keyfile

If you are a Bifrost Developer, you can also import keys generated by Bifrost's Gjallarhorn KeyManager. An example is shown in the recipe below.

Import Keyfile BramblSC

In addition, you can also import keys generated by BramblSC's KeyRing. An example is shown below.

val provider: Provider = ValhallaTestNet(apiKey = "myApiKey", uri = "https://staging.vertx.topl.services/valhalla/{{myProjectId}}")
val brambl: Brambl = Brambl.standalone("./my_key_directory",Some( provider))
  
  val address1 = brambl.keyRing.DiskOps.unlockKeyFile("base58_encoded_address", "password") match {
            case Failure(exception) => throw exception
            case Success(value) => value
        }

🚧

Note

The string for the address has to be the same as the address generated by BramblSC and the naming convention for the keyfile has to include <address>.json.

In addition, BramblSC checks the whole directory for valid keyfiles so if there are other files in your key file directory that are not valid keys, or that are from different networks, then BramblSC will throw a validation error.