How to interact with CPChain?¶
You can utilize
cpc_fusion to interact with CPChain in a python interpreter.
>>> from cpc_fusion import Web3 >>> cf = Web3(Web3.HTTPProvider('http://127.0.0.1:8501')) >>> cf.cpc.blockNumber 34341
Why does fusion return an error (Errno 111) indicating connection is refused?¶
The Errno 111 can be returned when you call
Web3(Web3.HTTPProvider('http://127.0.0.1:8501')) in fusion.
./cpchain run command cannot be executed successfully?¶
Several reasons can account for this problem. You may try the following means to solve the problem.
- Confirm that you are connecting to the network and the ports you nominated are available.
If you use the command in Quick Start in Detail as
$ ./cpchain run
, make sure the default port
30310 (or the port you specified using
has not be occupied yet.
If you add the flag
--rpcaddr 127.0.0.1:8501, you should also open port
You may also use other ports as you wish.
- Remove temporary user files.
The existence of some temporary files get
cpchain skip some initialization processes,
which may result in an unsuccessful execution.
Type in the following to remove temporary files.
$ ./cpchain chain cleandb
- Manually kill all
An incomplete abort of
cpchain can incur a failure in starting a new process.
If you receive an error message indicating your port or datadir being occupied,
it is highly possible that there are some
cpchain processes still running in background.
You can may either use
ps command paired with
kill to terminate
or choose to kill all cpchain processes by
$ killall -9 cpchain
The file "./cpchain" is not executable by this user pops when running
This problem is due to a wrong access permission of the binary file. You can fix this problem by using the command below:
$ chmod +x cpchain
Fatal: Failed to unlock account pops when running
One possible reason is that the account file is not in the right directory.
In the command
$ ./cpchain 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
--datadir ./datadir means the account file (keystore) in under
If you create an account without specify a directory,
like using the command
./cpchain account new account instead of
./cpchain account new account --datadir ./datadir,
the account file is created under a default directory,
which is not
In this case, you can either
- Specify YOUR_ACCOUNT_DIRECOTRY after
- Move your account file to
solc is not a compatible version¶
To check the version of solidity, you may utilize the following command:
$ solc --version
And by using
$ which solc command, you can locate the path for default
and replace it with a 0.4.25 version.
$ which solc /usr/bin/solc $ rm -f /usr/bin/solc // copy solc 0.4.25 to /user/bin $ cp solc /usr/bin
Control+C cannot abort the program¶
Ctrl+C cannot abort
cpchain if either of the following condition is satisfied:
- You are one of the proposers committee in the current term;
- You are elected to seal blocks in a future term.
To sustain the throughput of the chain,
we disable the functionality of aborting the program via
Ctrl+C for all current and future proposers.
cpchain, your node should meet neither of the conditions above.
The safest way is to stop mining and wait all elected terms end.
cpchain program and utilize the command below to stop mining.
$ ./cpchain campaign stop --keystore ./datadir/keystore/YOUR_ACCOUNT
You can also utilize the command below to check your status.
$ ./cpchain campaign status --keystore ./datadir/keystore/YOUR_ACCOUNT
You can use the flag
--password ./datadir/password to input the password,
similar to other
./cpchain campaign commands.
How can I address
system clock error?¶
For users finding error message
system clock need to be synchronized.there is more than 10 seconds gap between ntp and this server,
they need to adjust their servers’ local clock.
One of the prerequisites to run the node is that
the time gas between local time and NTP (network time protocol) must be less than 10 seconds.
To address the issue, please toggle automatic time & date in your server such that the local time keeps correct.
What could I handle a large amount of impeached blocks?¶
For proposer finding that it has a large amount of impeached blocks, please check if your version is the latest one. You can use the command
$ ./cpchain --version
to check the version number.
If your node still encounter a high frequency of getting impeached, please raise an issue on our GitHub Issue Page.
Why are the wallet addresses mixed case?¶
Some addresses (like ones in Explorer) are expressed in mixed cases, e.g., 0xC8d95F1b3179c30fB067243ce68F5eA20E750351.
These addresses with uppercase letters are checksummed, and the ones with only lowercase are non-checksummed.
- Non-checksummed version: 0xc8d95f1b3179c30fb067243ce68f5ea20e750351
- checksummed version: 0xC8d95F1b3179c30fB067243ce68F5eA20E750351
The checksum is a kind of validation. It can tell if the address is valid and do not contain typos.
What is checksum used for in Download Page?¶
We provide a checksum value for each release after version 0.4.7. It is used for validating if the downloaded file is correct. You can use the Checksum Page (SHA256) to obtain a checksum result for a file you download, and compare the value with the one on Download Page.
How to reduce the disk usage of
From version 0.4.8, two commands are provided to delete useless files in
Please type the following two commands in order.
./cpchain chain delete dpor- ./cpchain chain compact
i) You can use the flag
--datadir to indicate your
if your node is not stored in the default directory.
chain delete dpor- command does not shrink disk usage directly.
It traverses all cpchain files and labels redundant and obsolete files.
chain compact command then compacts files
following the labels done by
chain delete dpor- command.
iv) Both commands can be rather time consuming. The process time is estimated to around 20 minutes for each command.
v) Note that there is a hyphen following
chain delete dpor- command.
dpor- indicates the prefix of file names.
Other arguments rather than
dpor- may lead to unexpected results.
vi) Also note that both commands can only be executed when the chain is stopped. An error will be raised if you execute either command for a running node.
sudo needed to run
sudo (or administrator privileges) is not required to run
However, some users may encounter error message indicating a denied permission.
Here we list some possible reasons accounting for this problem:
1. The root user and normal user have different default folders of
Thus, if you run
cpchain as root for the first time (e.g., using
you have to use
--datadir to refer to the
cpchain folder as a normal user.
2. Write into a log file that requires root privilege.
Some users (e.g., ones using
> to redirect the output of
cpchain to a log file.
If the log file can only be written as root (e.g., in a root-privileged folder),
this redirection will lead to a failure in launching
You can either use the
chmod command to change the permissions of the log file,
or redirect the output to other log file that you can access.
Which version is compatible with the latest one?¶
We strongly encourage the users to adopt the latest version!
In principle version 0.a.b is compatible with version 0.a.c, where a, b, c, are natural numbers. For example 0.4.8 is compatible with 0.4.6.
The word “compatible” here means no conflicts in the level of consensus,
but older versions certainly contain more bugs and lack new features.
Thus, we highly recommend the user to keep the
cpchain file updated to the latest version.
Nevertheless, it is feasible to downgrade to a previous compatible version to
circumvent certain bugs in the newer ones.
Downgrading should be only considered as an expedient.
And please update
cpchain if the bug is solved.