Code powers the world. But save for a few technical geniuses, learning to write code is not the easiest thing to do. So, learners and programmers have always been open to tools that streamline the process. This is why the rapid growth and development of generative Artificial Intelligence (AI) models is such a huge deal for the space.
Generative AI models like Github Copilot, and more recently, ChatGPT and Google Bard, have become unofficial assistants to developers. These tools make coding suggestions, generate snippets of code on demand, and can even be prompted to build a small program, smoothening the development and learning experience to a good extent.
Thus, it is no surprise that AI code assistants are seen as a potential game changer in Web3, a field with one of the steepest learning curves and most demanding development experiences. But do ChatGPT, Bard, or even Copilot have what it takes to truly revolutionalize the blockchain developer experience?
The challenges and complexities of Web3 development
Web3 has been, perhaps, the most innovative tech space since the launch of Ethereum. Visionaries consistently explore, develop, and launch transformative ideas and decentralized solutions. But in the years since, it has also become apparent that developing for crypto/blockchain is quite unlike Web2.
This is primarily due to smart contracts. Smart contracts are the self-executing lines of code at the heart of decentralized applications (dApps). Writing a smart contract is the most challenging aspect of building a dApp but also the most crucial.
Depending on the specific blockchain, smart contracts are typically written in Solidity, Plutus, Rust, and other programming languages. These have their own unique syntax that is much more complex than popular Web2 options like Python and JavaScript, which is what gives them a very steep learning curve.
“We’ve realized that Solidity, Plutus, and other niche Web3 languages can be very difficult to learn,” says Nii Osae, one of the minds behind the AI smart contract startup MazzumaGPT. “There is a very steep learning curve for new entrants as well as existing developers coming in from Web3.”
And things don’t get any easier for those that manage to scale the learning curve. Given that smart contracts run on immutable blockchain protocols, once deployed, editing options can be limited and even nonexistent. This means that writing smart contracts demands a high level of accuracy. There is no room for bad code or bugs as the code cannot just be edited after the fact.
Furthermore, many smart contracts manage millions of dollars worth of crypto coins and tokens on a daily basis. This places added pressure on the developer to design stable and secure code. In fact, $2.7 billion was lost from exploited smart contracts in 2022 alone. Therefore, developers often spend a lot of time and resources auditing their code to ensure it is free of bugs and security vulnerabilities.
All these factors combined make Web3 development very demanding. This has, of course, left a lot of great ideas on the table. There aren’t enough developers out there, and the ones that might otherwise be willing to make the jump from Web2 are chased away by the low tolerance for error.
And this is where artificial intelligence comes in.
“With the proliferation of large language models, we thought there could be a way to help developers to build smart contracts using artificial intelligence. This is why we built MazzumaGPT,” says Nii Osae.
How can AI code assistants help?
Nobody disputes that having a tool to generate code snippets on demand and suggest ideas/edits will greatly simplify the development experience. A recent Github study even showed that developers were able to complete tasks up to 55% faster with Github CoPilot.
However, existing code assistants and their equivalents are not the best AI can do for Web3 programming. Their biggest setback is the fact that they are not optimized for smart contract code generation. ChatGPT and Bard are, in fact, not specialized for any kind of code generation at all, while Github CoPilot is largely tuned for Web2 programming languages.
So when these tools are used in a Web3 context, they tend to have their fair share of inaccuracies and inconsistencies in the code. This, as mentioned earlier, is highly undesirable with smart contracts.
“Tools like ChatGPT are generalized AI tools and hence are not optimized for code generation,” says Nii Osae. “Even most of the more specialized code completion AI models have been trained on a lot of Github data with little fine-tuning, which means they tend to hallucinate and generate erroneous smart contract code.
He argues that while solutions to the complexities of blockchain developments can certainly be found in AI coding assistants, they need to be more optimized for Web3 development languages. This is the idea behind the creation of their own AI code platform, MazzumaGPT.
“MazzumaGPT is a 175 billion parameter model fine-tuned on only smart contract code. We used instruction fine-tuning to train our custom models because it enables the model to align with the user’s intent and generate code which is functionally correct and accurate.”
AI is a good answer but first, optimization
Generative AI will transform blockchain development. But for that to happen effectively, it will need AI tools specifically tuned for Web3. Artificial intelligence is undoubtedly one of the most profound developments in technology, and will expedite the growth of technology. But, there won’t be a one-size-fits-all solution– at least not in the near future.
Developing AI solutions comes down to the training of machine learning models, and this takes time and expertise. Smart contracts are still a very new technology tasked with managing and protecting billions of dollars every day. So there is little room for error, and the code must be more functionally correct and accurate, with little to no inconsistencies and vulnerabilities.
Unfortunately, human error is just a part of the development process. But perhaps with the continued development of new tools such as Github CoPilot and MazzumaGPT, the future of blockchain and smart contracts can become more safe and secure.