Following block height 222270 on 2019-12-09, PEG conversions will be restricted to 5k PEG per block until a time that inflation falls below a predefined curve. All PEG conversions will be allocated a maximum share of 5k PEG per block. Users will still be able to make unlimited conversions to non-PEG pAssets.

This tutorial will walk you through how to convert FCT to PEG on OSX and Linux. Experienced Windows users will be able to retrofit it for their needs, but Windows is not directly supported.

Disclaimer: I suggest you run through this process with a small amount of FCT to make sure everything is working before breaking out the big guns. This process is done at your own risk. Be cautious.

1. Download the required binaries

Three binaries are required to perform the conversion from FCT to PEG. Note that Mac binaries are marked as Darwin.

i. Pegnetd

Tracks PegNet and handle pAsset conversions/transactions. Download here

ii. walletd and factom-cli

Wallet to store keys and command line tool to interact with Factom daemons. Get the releases for Linux or Mac.

The Sha256 of the OSX zip is b91ec5a46eb095ac23e8b20668a5c137fa05613bac49f2ec4c3d8e5f5f466428 .

2. Rename the pegnetd binary

The name of the pegnetd binary is likely suffixed with the OS it runs on. Change the name of that binary to simply be pegnetd The other binaries, factom-cli and factom-walletd, should already be named correctly. If not, rename those too.

3. Place binaries in your PATH

Check that /usr/local/bin is in your $PATH:

echo $PATH

If you do not see it anywhere in the output string, head over to Google to discover how to create it or use another directory that is listed in that output. Again, Google will help you with which.

OSX and Linux GUI users can simply drag and drop the above binaries into /usr/local/bin . CLI users can use the following command, modified for each of the binaries (hint: might need sudo):

mv [binary] /usr/local/bin/[binary]

4. Grant execute permissions

Pegnetd needs execute permissions (hint: might need sudo):

chmod +x /usr/local/bin/pegnetd

Check that each binary is installed correctly:

pegnetd help factom-cli help factom-walletd

If any of the above commands fail, something went wrong. Go back and check everything was done correctly.

The final command would have started walletd. You can close it again for now.

5. Create pegnetd config file

Create the .pegnetd directory in your $HOME folder. CLI users can use:

mkdir ~/.pegnetd

Next, copy the contents of this default config file into ~/.pegnetd/pegnetd-conf.toml .

Edit server = "http://localhost:8088/v2" to be server = https://api.factomd.net/v2

6. Bootstrap pegnetd

It would take a while to sync pegnetd from OpenNode, so let's bootstrap it.

First, download mainnet.tar.gz (Sha256: 9026b55afbb273baa3939d7fd8d8448abe6a994fc3fc8bcafbe0ae4a0f8ebb0d )

Next, place it in ~/.pegnetd .

Finally, unzip it. You should now have the databse in ~/.pegnetd/mainnet .

7. Start pegnetd

Next, you need to start pegnetd to let it build the bytemap table. This should take 10 to 20 minutes and is complete when Pass 4 reaches 100%. It will also need to sync the remaining blocks since I last updated the above DB bootstrap. That could take a few minutes to a few hours, depending on when I last updated it.

pegnetd

8. Create a factomd config file

Yes, another config file!

Place the following config into ~/.factom/m2/factomd.conf

[Walletd] FactomdLocation = "https://api.factomd.net"

9. Start walletd

Now open a terminal window (if you do not have one already) and start walletd.

factom-walletd

Advanced users can create an encrypted wallet. However, the rest of this guide assumes the wallet is unencrypted as it adds another layer of complexity. CLI reference commands can be found here.

factom-walletd -encrypted -passphrase="[ENTER A PASSPHRASE]"

10. Create new FCT and EC addresses or import address into walletd

We're making progress now. Just hang in there.

Next we need to get your FCT and EC into walletd. If you don't have any EC yet, don't worry. We will create some later.

Make sure walletd is still running and open a new terminal. You can either import existing Factom addresses or create new addresses that you will then fund.

a. Create new addresses

factom-cli newfctaddress factom-cli newecaddress

Copy down the public addresses.

b. Import existing addresses

The imported address should be a private address that starts with Fs and Es .

factom-cli importaddress Fs... factom-cli importaddress Es...

11. Export your private keys

Export your private keys and keep them somewhere safe and secure.

factom-cli exportaddresses

12. Use your FCT to create some EC

This will burn a small amount of FCT. You won't need much.

factom-cli buyec [publicFctAddress] [publicEcAddress] [ecAmount]

For example, to create 100 EC, issue the following command with your own public addresses:

factom-cli buyec FA... EC... 100

13. Convert FCT to pFCT

We're finally ready to make a transaction from FCT to pFCT! Phew!

First, eyeball the pegnetd process we started in step 6 to ensure that it has finished syncing. This could take several hours.

Next, make sure walletd is running, then open a new terminal and input:

pegnetd burn [address] [amount]

Where address is the FCT address in walletd and amount is the number of FCT you wish to burn. Remember that a small amount of FCT will have been burnt to create the EC in step 13. If you need to know how much FCT you have before running the above command, use:

factom-cli balance [fctAddress]

14. Convert pFCT to PEG.

Okay, final step, I promise!

Make sure the conversion from FCT to pFCT has completed. You can check it with:

pegnetd balance pFCT [fctAddress]

Once you see your pFCT balance there, you are ready to rock. Issue the conversion from pFCT to PEG like so:

pegnetd newcvt [ecAddress] [fctAddress] [srcAsset] [amount] [destAsset]

A little explainer on the above:

ecAddress is the EC address that you credited with EC in step 11.

fctAddress is the FCT address you are using - no mystery here!

srcAsset is the source asset (i.e. the asset you are converting from). In this intance, that is pFCT.

amount is the total amount of srcAsset that you are converting.

destAsset is the asset you are converting to. In this case, it is PEG.

So, an example command would be:

pegnetd newcvt EC... FA... pFCT 100 PEG

The conversion will be done in 2 blocks. You can check your PEG balance with: