CX: the Solidity Killer

Ughhhh! 
Another programming language to learn!
When will enough be enough??
Can’t we just use the programming languages we already have…?

Sure we can, if you don’t mind losing all your money! *Stifles laugh*

Is it a given you’ll lose your money if the blockchain DAPP is built using C++, Python, Javascript, Golang, Solidity…? NO!

Yet unfortunately, you’re not putting your trust in the language; your putting your trust in every programmer! Do they all know what they’re doing? 
Are they aware of all the security flaws associated with that language… Would you trust 10 programmers to get it perfect? How about 10,000? 
I know I wouldn’t!

But there are some really good programming languages already! 
Why do you need to create a new one?

WOW, this guy asks the right questions!! 
It’s actually quite simple when you think about it logically.
Would you use a rally car to compete in Formula 1? or vice versa?

NO, That would be stupid!

They’re both cars at the end of the day, yet they were both built from the ground up to be good at specific things. Thinking logically would you suggest to use a legacy language such as C++ or even the excellent Golang to create a financial revolution (Cryptocurrency) and all these brilliant distributed ledger applications? Probably not!

“Blockchain programming has mathematical requirements, like the need for canonical serialization, determinism; that cannot be met by C, C++, Java, Python, Javascript, Golang. Hence the need for languages like Ethereums smart contract language and Skycoin’s CX blockchain development language. There are mathematical requirements, such as consistent handling of integer overflows and determinism across all execution platforms, that required that we write a new language”

Ahhh so we use Solidity then! Well no, and here’s why…

Soilidity was the first ‘functional’ blockchain programming language,
and I put that in quotes because although you can do more than previously possible. It gets nowhere close to harnessing the full power of computing and what’s needed to create a decentralized economy at scale.

Now part of that’s due to the scalability issues of Ethereum, but there are also many issues with Solidity that continue to be found and exploited, equating in billions stolen by hackers! These are just some of the main incidents:

  1. The DAO: 3.6 Million ETH stollen with a value of around $76,000,000 at the time.
  2. Parity Freeze: 150 thousand ETH take with a value of around $30,000,000 at the time. Another $150,000,000 was ‘accidentally’ frozen while trying to fix the issue.
  3. Insecure Nodes: In 2018 over $20,000,000 in ETH was slowly syphoned from poorly configured ETH nodes that could be compromised and re-configured to pay out rewards to a different wallet.

The list really is staggering and makes me wonder why anyone would consider using Ethereum! I guess a lot of people are ignorant to it all…
Today, researchers estimate that 45% of smart contracts written in Ethereum’s programming language Solidity are vulnerable to attacks. Reports coming at the end of 2018 also stated that Crypto theft or ‘Cryptojacking’ as it’s known was up 500% in 2018 from the all-time high.

Your funds are Safu with Solidity then… 
Let’s just keep doing what we’ve been doing! lol, NO!

To Skycoin was clear they needed a new Blockchain programming language that would usher in the decentralized economy and a secure option for their money.

Why Skycoin? Because when others aren’t stepping up, you do it yourself!

Enter CX:

CX is Skycoins answer to a blockchain programing language.
Originally based off Golang, CX was first conceptualized and worked on in 2014 by Synth (Skycoins Co-Founder). As CX develops it becomes less like Golang and more of its own unique language.

One of the main objectives of the language is to lower the software development costs by increasing the programmer’s productivity. 
CX achieves this by providing well-known programming tools, such as a 
Read-Eval-Print Loop (REPL) for interactive programming and interactive debugging mechanisms.

CX goes further by extending the common REPL’s capabilities. 
Another objective of CX is to provide the developer with many high-level tools that are part of the core language, i.e. the programmer will not need to install any external packages and the language will interact seamlessly with these features. Clear examples are CX’s interactivity with the Skycoin ecosystem for creating decentralized applications, and CX’s affordance system and genetic programming functions that help the programmer create applications in a more interactive manner.

“ CX is a general purpose, interpreted and compiled programming language, with a very strict type system and a syntax similar to Golang’s. CX provides a new programming paradigm based on the concept of affordances, where the user can ask the programming language at runtime what can be done with a CX object (functions, expressions, packages, etc.), and interactively or automatically choose one of the affordances to be applied. This paradigm has the main objective of providing an additional security layer for decentralized, blockchain-based applications, but can also be used for general purpose programming.”

Why you SHOULD learn CX!

Skycoin developed CX with the purpose of creating a secure, developer friendly programing language capable of moving beyond what Solidities Smart Contracts are capable of. Some of the key features include:

Your CX Programs Can Get Smarter

CX contains machine learning tools built in, opening the possibility for CX applications to solve problems it doesn’t currently know the answer to. Using genetic programming, CX can take a problem and attempt to solve it, adjusting its approach over time and come up with powerful predictions.

CX Can Clean Up After Itself

Using a powerful garbage collector, CX can optimize itself by reclaiming resources that aren’t being used, freeing up memory. This gives it advantages over languages that leave it up to the programmer to manually find these unused resources.

Your Eye in the Sky

A production-ready application can contain thousands of lines of code spread out across dozens or hundreds of different files written over the course of several months. Understandably, an object might get left behind in code because nobody remembers why it’s there and modifying or removing it could have unpredictable consequences. CX’s object explorer gives developers a birds-eye view of all objects and their memory allocation.

Putting It All Together Step-By-Step

CX’s stepping feature lets you stop a running program, troubleshoot, add some steps, then continue running. At this point you can do many things, for example, get a rundown of the current state with the object explorer or use genetic programming to improve your debugging. CX’s serialization feature means that every object can be serialized, so you can save your state and send it across the blockchain.

A comprehensive article on CX features can be found here:

Ethereum and the other platforms do not have a powerful enough programming language semantics to actually implement a real DEX. 
While CX can implement anything that can be implemented in a real programming language like C, C++, C# or Golang.

“ One of the major innovations added to CX is the affordances paradigm. We looked at major blockchain scandals and the hacks behind them, and built features into CX to prevent these types of hacks from occurring.”

Synth on CX:

John McAfee and Synth at Johns house in Dec 2018

I do not think people understand how advanced CX is, compared to the other languages… CX can have the binary of the CX compiler, compile its own source code and return a bit identical binary output to the compiler executable itself.

Why is Determinism Important?

We cannot allow 10,000 people to write code on blockchain and just pray that all 10,000 of them “code it right” and do not trigger hard fork bug. We are not Bitcoin/Ethereum!

We put the conditions needed for determinism into the language. So that the blockchain is safe for developers. CX guarantees deterministic builds for all programs that can be written in CX.

CX has built-in determinism as a mathematical constraint and also has deterministic builds (which cannot even be done completely with java, C, Golang right now).

What other Features have been added to CX?

CX also has affordances and meta-syntactic operators, which are simpler and more powerful than templates in C++. They allow any syntax or semantics to be implemented and the language extended within the language itself.

CX works very well with source independent networking and the new types of network transport and immutable data on Skywire and blockchain.

CX programming language can have its semantics expanded for DNA and quantum computers. And also boolean circuits and GPUs.

CX does not assume a Von Neumann Architecture. Only a state and operators that act upon the state.

Other blockchains don’t have programs at all, they have smart contracts. 
CX programs are much more powerful than smart contracts, a smart contract only has a state and it has some functions you can invoke on the state; whereas the CX program is much more powerful than a smart contract because it can do anything, and it has its own array of bytes.

It has an array of bytes for the program and an array of bytes for the execution.
Any program that could be run on a normal computer can now be executed on the blockchain.

CX Development Roadmap:

CX began serious development in June 2017 with over 900 commits to the master repo since then (as of 30/01/18) and 132 of those in the last 30 days… Skycoin is serious about completing CX fast!

At the time of writing this article, CX working towards Beta and integration with Fiber. (Skycoins blockchain) This process is moving swiftly with more and more people volunteering to help out! Check out the commit list.

With integrating CX into the blockchain there are two or three different competing models that we could use for implementation. And I don’t know which one people are actually going to use, so we’re just going to create a transaction type that executes CX programs.

The transactions on the new transaction type will eventually be validated by CX itself. So users, when they create their blockchain will choose the transaction validation rules. They’ll just be able to embed whatever virtual machine they want into the blockchain and whatever execution semantics they want.

I think there’s gonna be two or three different methods of programming or embedding CX programs on the blockchain… Depending on what you’re doing. for example, if I’m embedding video streaming on blockchain I’m just storing data I don’t really need coins. But if I have coins like a gambling DAPP there’s a whole nother set of restrictions to stop people from stealing money.

There are multiple different methods of doing blockchain programming and CX supports all the methods and every hybrid method also. We’ll let the development community try whatever they want and see which methods work. Different applications are going to be using different types of virtual machine architectures, there’s not going to be a uniform standard.

How to get started with CX?

We have a well-written textbook on how to start programming with CX.
The most recent version of this can be found here:

I’d recommend you join the General CX Development Room or the CX Game Development Room in Telegram, these are where most of the developers (including creators) hang out and discuss the language.

If you’re serious about looking into the language and even helping out with its creation… Head over to the CX Repo, check out some of the issues and offer suggestions or just start commenting with Ideas. How cool is it that you have the chance of contributing to the creation of a programming language!

There’s also a CX playground for mucking around with the language and a website in development for interactive learning of the language.

You can tell that Skycoin is serious about CX because they’re making it developer friendly! On this subject Youtuber Hashoshi said the following:

what do you need to do to make them want to use that native language? 
you have to give them tools, you have to give them documentation!
 you guys must know this by now I’m a documentation fiend; love to see documentation, and this is really where I’m excited about CX within the Skycoin ecosystem.

They’ve released a book! Yes a book that teaches you what you need to know about using CX. I did have a chance to read through that book, and went to the GitHub page and read through the issue tracker to see what things are tracking and how things are looking. So far based on my limited research the book looks super comprehensive, I read through some of it; makes sense to me, I like it!
I’m gonna definitely do some more reading.

Blockchain Language Options!

To my knowledge, very few blockchain projects are actually putting in the effort to create a dedicated blockchain programming language.
These are the projects known to me:

  • Skycoin has CX
  • Etherum has Solidity
  • Waves has Ride
  • Rchain has Rhode
  • Zillquilla has Scilla

I’m interested to know if any other projects are actually undertaking this crucial task, so please add a comment if you know of any others!

Thanks for taking the time to read this article!
Please leave a clap or 3…

Sources: