How to create an Entry Credits address

Find below the steps necessary to create Entry Credits (EC) addresses and the relative commands. Before attempting to use your new EC addresses read this guide fully, at least once.

This is early beta software you should use this guide at your own risk, we suggest not to use large amount of EC in case there may be issues, bugs, or you mistype a command.

For this guide we are using labels to describe Factoid and EC addresses: factoid1, factoid2, entrycredits1. These labels are only known to your local wallet. You can also use the public address (public key) instead of the label, factoid public keys are strings of letters and numbers that start with FA while Entry Credits public keys start with EC. When you send transactions outside of your local wallet, always use the public key.

There are three ways to generate an EC address: via command line, via the Factoid Wallet GUI and using Python, they are described below.

Create New EC Address via Factoid Wallet GUI

Follow this guide to get started with the Factoid Wallet GUI which allows to generate a new EC address at the click of a button.

wallet3

You simply have to click on the "+ EC" button to generate a new address, it will appear in "Entry Credits Addresses" list.

wallet4

The string starting with EC is an actual Entry Credits address (public key) it can be used to buy EC from our store.

You are now ready to use your new EC address and create further as required.

Once you have received confirmation that EC have been sent to your own local address you can then verify receipt by clicking on "View All Balances".

Create New EC Address via Command Line

Note the difference when sending commands on different platforms:

  • Mac:

  • ./factom-cli < rest of the command >

  • Windows:

  • factom-cli.exe < rest of the command >

  • Linux:

  • factom-cli < rest of the command >

Make sure to change the following commands accordingly.

1. First you’ll need to have factomd and fctwallet running in separate terminal windows. See the guide here to learn how to install the binaries for your OS.

2. Then launch factom-cli in a new terminal window, this is where you will type all the commands. For the purpose of this guide we will only need to generate an EC address labeled entrycredits1. Type the following command:

factom-cli generateaddress ec entrycredits1

The terminal output will look like:

howentrycredits1

In the above command replace the label "entrycredits1" with something more meaningful to you.

The string starting with EC is an actual Entry Credits address (public key) it can be used to buy EC from our store.

You are now ready to use your new EC address and create further as required.

In our example we have just created a new empty EC address labeled entrycredits1 which can also be used to send factoids to be converted to EC.

3. Once you have received confirmation that EC have been sent to your own local address you can then verify by typing:

factom-cli balances

The terminal output will look like:

howentrycredits13

Create New EC Address via Python

If you are a developer you most likely will find this Python alternative to generate a new EC address very useful.

import hashlib
import base58
import ed25519
import os

# get a 32 byte random number. This is the raw ed25519 private key
ECprivatekey = os.urandom(32)

# if using an existing private key, uncomment and add your key here
#ECprivatekey = "0000000000000000000000000000000000000000000000000000000000000000".decode("hex")

# get the matching public key for the random private key
Ed25519PrivateKey = ed25519.SigningKey(ECprivatekey)
Ed25519PublicKey = Ed25519PrivateKey.get_verifying_key()

print "raw private key:" + ECprivatekey.encode("hex")
print "raw public key: " + Ed25519PublicKey.to_bytes().encode("hex")

# convert the private key to human readable form

# this is a magic number to make the first two letters be Es
privatePrefix = "5db6"

interimAddress = privatePrefix + ECprivatekey.encode("hex")
checksum = hashlib.sha256(hashlib.sha256(interimAddress.decode("hex")).digest()).digest()
b58encoding = base58.b58encode(interimAddress.decode("hex") + checksum[:4])

print "human readable Private Key: " + b58encoding

# convert the public key to human readable form

# this is a magic number to make the first two letters be EC
publicPrefix = "592a"

interimAddress = publicPrefix + Ed25519PublicKey.to_bytes().encode("hex")
checksum = hashlib.sha256(hashlib.sha256(interimAddress.decode("hex")).digest()).digest()
b58encoding = base58.b58encode(interimAddress.decode("hex") + checksum[:4])

print "human readable Public Key: " + b58encoding

The Python generated addresses can then be added to a wallet with the following command:

factom-cli importaddress YourLabel Es12345...

Where YourLabel is a name that is meaningful to your purposes and Es12345... is the private key of the newly generated address.

Recommendations

Entry Credits are necessary for developers who want to test our software, we offer an easy way to purchase them on our Store. Follow this guide to learn more about converting Factoids to Entry Credits. Don't use the same EC address shown in this guide, it's only an example, always generate your own and keep a backup of your wallet file.

If the destination address is not in your local wallet use http://explorer.factom.org to check the balance instead. Simply paste the EC address public key in the Explorer search bar to see its balance.

We strongly recommend to backup your local factoid wallet file every time you import or generate a new address. The wallet file is called “factoid_wallet_bolt.db” and is located in the .factom folder at the following locations:

  • Mac: /Users/YourUsername/.factom/factoid_wallet_bolt.db

  • Windows: /Users/YourUsername/.factom/factoid_wallet_bolt.db

  • Linux: ~/.factom/factoid_wallet_bolt.db

Note that the .factom folder is a hidden folder so perform a Google search for “how to show hidden files and folders on YOUR OS”, replace YOUR OS with Mac, Windows or Linux accordingly.

If you want to backup your local wallet file and setup a fresh one you can do so by first quitting factomd and fctwallet, then move your wallet file to a safe location and out of the .factom folder; there should be no wallet file left in there. You can then restart factomd and fctwallet and a fresh new wallet will be generated cointaining no addresses. If you want to restore a previously backup wallet repeat the above, making sure you backup the current wallet, and drag and drop the previous backup in the .factom folder. You can then restart factomd and fctwallet and your previously backup wallet will be used instead. Pay attention when performing backups, each wallet file cointains your Factom Secret Keys (private keys) for each of the addresses cointained within it, if you overwrite a wallet without backup first you may loose your Factoids and Entry Credits.