Green technologies and Raspberry Pi: how C code made blockchain more accessible (and more eco-friendly)

C is a popular development environment for drivers or graphics libraries. At the same time, there are almost no cryptocurrency projects in C. Let’s figure out why it happened and what advantages a procedural language can bring to the Cellframe blockchain.

Benefits of C

C is traditionally respected for its well-structured code and responsiveness of applications. Indeed, only assembler inserts work faster than C code. And what are the pluses of this language for blockchain?

High performance

Since C does not have automatic processes and the code accesses memory directly, programs and applications respond more quickly to user input. Blockchain has never been fast. For example, the Bitcoin network spends about 4 seconds verifying one BTC transaction. More productive code will help you reduce this time.

Low system requirements

The process of processing transactions in the blockchain heavily loads the computer. Without special optimization, it threatens to overload the CPU. The system requirements for most blockchains are far from democratic: for example, the optimal set for Ripple will be 4 CPU cores, 32 Gb of RAM, and a good SSD.

Improving code performance allows you to run a node on weak hardware. The Cellframe node can even run on a Raspberry Pi, and it will be enough for normal running. This will help to scale the project easier.

The C ++ language, in which Bitcoin is written, has problems similar to C: the complexity of development and the need to manually write what Go or JS do automatically. However, Ethereum’s blockchain, which is written in Go, has been hacked more than once, unlike Bitcoin. This does not make Go “less secure” than C ++, but it is suggestive.

Economical node maintenance

A low entry threshold affects not only the scaling of the project, and reduces the cost of maintaining the node. In particular, modernization: the Raspberry Pi is much cheaper than the fresh Risen, so the inevitable obsolescence of the hardware will stop hitting the budget.

Another plus of weak hardware is saving on electricity. Utility costs are still a headache for miners who prefer to earn outside the pool. They are critical for staking, too, if the system requirements of the blockchain are designed for top-end hardware. Unlike a gaming computer, a node does not go into sleep mode and consumes electricity around the clock. Using a weak “office” computer can cut costs by half.

Eco-friendly blockchain

Economical equipment is also a contribution to the environment. This factor is not always crucial for the user, but every kiloWatt saved works against climate change on a global scale. Despite the enormous electricity consumption by miners, blockchain has a chance to become a green technology.

You can run a node on a home computer with 4 cores and 4 GB of RAM, or buy a Raspberry Pi for ~ $160. This power will be enough for the full-fledged operation of the blockchain, and the electricity bills will remain within the usual framework. The maintenance of such a node will not hit the budget, and it will not affect the climate.

Why C blockchains are rare

In 2021, C is still a rare language in the blockchain source code. Most projects use C ++, Go, Python, Java, or Solidity. These are all object-oriented languages. So what’s wrong with procedural C?

Contras

It’s simple: C does not insure the developer against mistakes. For example, an OOP language suggests referring to a variable in an object, while a procedural one refers directly to memory. It does not warn about array out-of-bounds, allocate, or an automatically clear memory. All these peculiarities greatly complicate the development process and increase the likelihood of error.

Statistically, the C code contains more bugs and vulnerabilities, and there is fundamental research about this. The statistics do not lie: there are more errors because there is more code in C than in any other modern language. However, it is not the language that makes the code safe, but the programmer.

Pros

The advantages of C stem from its disadvantages: the lack of automatic actions speeds up the response of applications, the absence of restrictions gives you more freedom of action. Figuratively, C allows you to shoot backhand, while Python or Java forces the shooter to line up in position. If the shooter is not prepared, C will not insure him against a shot in his leg.

What changed

The testing methods have changed while the language has remained the same. The error probability is still high, so the C code is checked extra-scrupulously. Static and dynamic analysis is used to make it more secure.

Static analysis and neural networks

Dynamic analysis remains the most popular way to check code: a tester launches the program and fixes problems in its work.

In static analysis, a neural network looks for vulnerabilities. It scans the text without running the code: this method helps find non-obvious errors and fix them long before the alpha test.

Static analysis helps in development and saves the tester’s time: after all, the developer finds most of the errors by himself.

A conclusion: why C is the main language of the Cellframe

The developers of Cellframe deliberately agreed to complicate the development process the speed up the final product. Neither Go nor Solidity can provide this responsiveness. At the same time, the development of neural networks and static analysis helps to test the code much more efficiently and minimize errors in the code even before the first tests.

Blockchain has always been a slow and non-green application. C helps to speed it up without external add-ons and harm to the environment.

Follow us:

Website

Cellframe Network Twitter

Cellframe Network Telegram

Cellframe Network Dev: EN

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store