# Quick Start for Beginner¶

For ease of reading, we use cpchain to represent all available cpchain versions. The instructions below are demonstrated on Linux.

If you are using Windows platform, all commands below are also viable. Just replace cpchain with cpchain-windows-4.0-386.exe or cpchain-windows-4.0-amd64.exe.

Note

All code starting with a $is meant to run in your terminal or cmd. Do not copy$, as it is not a part of a command.

## Apply for a Wallet¶

Use the cd command to enter the directory containing cpchain binary file.

For Windows users, use the commands below in cmd.

$mkdir datadir$ cpchain-windows-4.0-amd64.exe account new --datadir ./datadir

Note

Change cpchain-windows-4.0-amd64.exe to cpchain-windows-4.0-386.exe if you are using on 32 bit operation system.

For Linux and Mac users, use the commands below in terminal:

$mkdir datadir$ ./cpchain account new --datadir ./datadir

Note

If you discard --datadir option, the account file is created under default user directory.

The first command is to generate a keystore file located in datadir/keystore, in which you can find the wallet address. The second command create a new account, and return the wallet address.

## Connect to Mainnet¶

Note

Refer to FAQ if you encounter any problem.

### Get Block Mined¶

This section is for users that are willing to propose new blocks.

Note

Before mining a block, make sure that you the balance in your account is large enough (at least 200,000 cpc).

Windows user the command below. (Here we use amd64 version as demonstration.)

$cpchain-windows-4.0-amd64.exe run --datadir ./datadir ^ --unlock WALLET_ADDRESS ^ --rpcaddr 127.0.0.1:8501 --port 30311 --mine ^ --rpcapi personal,eth,cpc,admission,net,web3,db,txpool,miner --linenumber Linux and Mac users please use the following command:$ ./cpchain run --datadir ./datadir \
--rpcaddr 127.0.0.1:8501 --port 30311 --mine \

Note

The port 30311 should be opened. Otherwise, other nodes cannot connect you in the P2P network.

Note

Note

A flag --account WALLET_ADDRESS is required in case your ./datadir directory contains more than one account file.

Note

Flags --rpcaddr and --rpcapi make APIs available in your node. You may discard them if you do not need any API. And make sure the port 8501 is open if you are willing to use APIs.

Note

^ and \ are splitters for long command for Windows and Linux (Mac), respectively. You do not need to type them if you put the command in a single line.

### Get Chain Synced¶

This section is for users that only want to sync with the Mainnet, review or sending transactions.

Windows users can utilize the command below:

$cpchain-windows-4.0-amd64.exe run --rpcaddr 127.0.0.1:8501 --port 30311 Linux and Mac users please try this command:$ ./cpchain run --rpcaddr 127.0.0.1:8501 --port 30311

After you use ./cpchain run command, you have connected to Mainnet. Use the commands below to check your status.

For Linux and Mac users:

$echo YOUR_PASSWORD > datadir/password$ ./cpchain campaign status \

For Windows users:

$echo|set /p="YOUR_PASSWORD"> datadir/password$ cpchain.exe campaign status ^

The first command generates a file containing your password, which are located in datadir/password. The second command is to check your account status given the keystore file as well as the password file you just generate.

$./cpchain --version Windows users use the following command.$ cpchain.exe --version