We’re Giving out 10 BTC in Rewards until the Bitcoin Halving

Learn More

CPChain Code Review - IoT Sidechains

CPCHain Code Review - IoT Blockchain Sidechains

Share this article

CPChain (for Cyber Physical Chain) is a blockchain for the Internet of Things. Since IoT transactions are expected to be a key use-case for blockchain tech, there are understandably quite a few companies doing interesting things in this space, from IOTA to the upcoming Atonomi. So let’s get into the code review.

CPChain is specifically looking at localized side chains to collect data and then publish blocks to the main chain. Nice implementation, so we expect to see some inherent side chain logic as well as an interchain transfer mechanism.

Pre-alpha and Private keys in this repo are for testing purpose(s). 1 commit, 1 branch, 1 contributor. Seems like a checkbox commit to me, but let’s ignore that for now and judge this based on the merits of its code.

Nothing exciting in

In storage you can do either S3 (AWS) upload, or you can do IPFS upload. Nothing overly fancy in the CPChain code here, very straightforward.

So, general idea here currently is having a local wallet, using it to store data in IPFS/S3, and being able trade it. I’m guessing as part of an IOT data marketplace? So not the side chain or inter chain implementation. Let’s keep looking:

Nice wrappers for quite a few ciphers, RSA, AES, EC, ECPEM, and SHA256, good cryptographic utility functions, but again, nothing of real substance here.

Heh, good choice 😉

Let’s look at the wallet.

Using Qt, haven’t seen that in awhile. Rest of wallet code was the UI components, lots of work done, but nothing interesting.

To login, we send a json payload with the public key to login/ as a second step, then we send a nonce signed by our private key to confirm/, this then gives us a token. Seems a bit redundant, but nothing wrong here.

Publishing products sends our key and token (received earlier) and some basic meta details to product/publish, fairly straight forward JSON-RPC implementation.\

send_request in SellerchainClient, puts the secured data onto IPFS and adds a signed message to the proxy chain (shares the data between parties).

BuyerChain, will need to have a look at start_client, for now just getting a buyer payload and signing the message. update_buyer_db updates local storage.

SQLite being used for local storage.

Moving over to Proxy.

Default SSL communication, good to see. Just validating and passing messages between buyer and seller and keeping local storage. Nothing overly fancy.

Let’s look at market.

Using Django (Python framework), mostly just Django wrappers for basic API functions.

For now the blockchain is just using Ethereum.

CPChain Code Review Conclusion

Nothing impressive, but nothing bad. Very neutral about this. It is definitely a pre-alpha, basically a PoC, something I feel they should have had before they started raising funds. This isn’t a lot of work to accomplish so it would largely depend on how long they have been busy with this. I can’t think they have been busy with this for more than 1–2 months.

The other problem here is that this is just an IPFS marketplace backed in Ethereum, I’m not seeing any of their core system features? Where are they addressing scalability, or the real-time problems of blockchain? Where is the two layer hybrid consensus or lightweight side chain protocol?

No red flags, but nothing interesting.

Share this article