{"id":4753,"date":"2023-01-17T20:13:03","date_gmt":"2023-01-17T20:13:03","guid":{"rendered":"https:\/\/metaschool.so\/articles\/?p=4753"},"modified":"2023-08-31T10:18:20","modified_gmt":"2023-08-31T10:18:20","slug":"which-programming-language-is-used-in-solana-blockchain","status":"publish","type":"post","link":"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/","title":{"rendered":"Which programming language is used in Solana Blockchain?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_56_1 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#What_is_Rust\" title=\"What is Rust? \">What is Rust? <\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#Important_features_of_Rust\" title=\"Important features of Rust\">Important features of Rust<\/a><ul class='ez-toc-list-level-4'><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#1_Memory_safety\" title=\"1. Memory safety\">1. Memory safety<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#2_Concurrency\" title=\"2. Concurrency\">2. Concurrency<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#3_Low-level_control\" title=\"3. Low-level control\">3. Low-level control<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#4_Strong_type_system\" title=\"4. Strong type system\">4. Strong type system<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#5_Community_and_tooling\" title=\"5. Community and tooling\">5. Community and tooling<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#6_Familiarity_and_ease_of_use\" title=\"6. Familiarity and ease of use\">6. Familiarity and ease of use<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#Can_programming_languages_other_than_Rust_be_used_on_Solana\" title=\"Can programming languages other than Rust be used on Solana?\">Can programming languages other than Rust be used on Solana?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#How_to_use_other_programming_languages_on_Solana_blockchain\" title=\"How to use other programming languages on Solana blockchain\">How to use other programming languages on Solana blockchain<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#1_APIs\" title=\"1. APIs\">1. APIs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#2_Wrappers_and_libraries\" title=\"2. Wrappers and libraries\">2. Wrappers and libraries<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/metaschool.so\/articles\/which-programming-language-is-used-in-solana-blockchain\/#3_Interpreters_and_transpilers\" title=\"3. Interpreters and transpilers\">3. Interpreters and transpilers<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p>The most common <a href=\"https:\/\/metaschool.so\/blockchains\/solana\" target=\"_blank\" rel=\"noreferrer noopener\">Solana Blockchain<\/a> programming language is Rust.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-rust\"><span class=\"ez-toc-section\" id=\"What_is_Rust\"><\/span>What is Rust? <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Rust is a systems programming language that is designed to be safe, concurrent, and fast. It is particularly well-suited for building <a href=\"https:\/\/metaschool.so\/articles\/what-is-blockchain-guide\/\">blockchain technology<\/a> because it provides the performance and low-level control required for the demanding requirements of a high-throughput blockchain, while also providing the memory safety guarantees that are essential for preventing security vulnerabilities. <\/p>\n\n\n\n<p>Additionally, the Solana team has built a set of libraries and tools specifically for building blockchain systems in Rust, making it a natural choice for development on the <a href=\"https:\/\/metaschool.so\/blockchains\/solana?ref=Articles&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">Solana Blockchain<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-1024x576.png\" alt=\"\" class=\"wp-image-4760\" srcset=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-1024x576.png 1024w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-300x169.png 300w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-768x432.png 768w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-1536x864.png 1536w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1-1320x743.png 1320w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/rust-1.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><strong>Rust programming language.<\/strong><em> If using image, please cite Metaschool as source.<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"important-features-of-rust\"><span class=\"ez-toc-section\" id=\"Important_features_of_Rust\"><\/span>Important features of Rust<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1-memory-safety\"><span class=\"ez-toc-section\" id=\"1_Memory_safety\"><\/span>1. Memory safety<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Rust has a strong focus on preventing common programming errors, such as null or dangling pointer references, that can lead to security vulnerabilities. This is particularly important in blockchain development, where a single vulnerability can have serious consequences.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2-concurrency\"><span class=\"ez-toc-section\" id=\"2_Concurrency\"><\/span>2. Concurrency<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Rust&#8217;s built-in support for concurrency, through the use of lightweight &#8220;threads&#8221; called &#8220;<a href=\"https:\/\/tokio.rs\/\" target=\"_blank\" rel=\"noreferrer noopener\">tokio<\/a>&#8221; and &#8220;actix&#8221; , allows developers to easily write parallel and asynchronous code. This is important in blockchain development, where high performance is essential.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"3-low-level-control\"><span class=\"ez-toc-section\" id=\"3_Low-level_control\"><\/span>3. Low-level control<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Rust provides a high degree of control over system resources, such as memory and CPU usage, which is necessary for building high-performance systems like blockchain.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"4-strong-type-system\"><span class=\"ez-toc-section\" id=\"4_Strong_type_system\"><\/span>4. Strong type system<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Rust has a robust type system that helps to prevent type errors and ensures that code is safe and predictable.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"5-community-and-tooling\"><span class=\"ez-toc-section\" id=\"5_Community_and_tooling\"><\/span>5. Community and tooling<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>The language has a large and active community, which means that developers can find help and resources when they need it, and also a large set of libraries and tools for building blockchain systems in Rust are available.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"6-familiarity-and-ease-of-use\"><span class=\"ez-toc-section\" id=\"6_Familiarity_and_ease_of_use\"><\/span>6. Familiarity and ease of use<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>It is a modern and intuitive language, most similar to C++. It has a simple and consistent syntax, which makes it easy for developers to learn and use.<\/p>\n\n\n\n<div class=\"wp-block-columns has-nv-site-bg-background-color has-background is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column has-nv-site-bg-background-color has-background is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"has-text-align-center\">\ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb <strong>Beginner web3 project<\/strong> \ud83d\udc49\ud83c\udffc <a href=\"https:\/\/metaschool.so\/courses\/create-your-own-solana-token-in-just-10-mins?ref=Articles&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">How to create your own Solana token<\/a><\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"can-programming-languages-other-than-rust-be-used-on-solana\"><span class=\"ez-toc-section\" id=\"Can_programming_languages_other_than_Rust_be_used_on_Solana\"><\/span>Can programming languages other than Rust be used on Solana?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It is possible to use other languages on the Solana Blockchain by using LLVM, short for Low Level Virtual Machine, which is a collection of modular and reusable compiler and toolchain technologies. It provides a set of libraries for building compilers, and it can be used to <a href=\"https:\/\/metaschool.so\/courses\/build-a-code-translator-using-nextjs-and-openai-api?ref=Article&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">convert code written<\/a> in other languages into machine code that can run on Solana.<\/p>\n\n\n\n<p>For example, you can use LLVM to convert code written in C++ or C to machine code that can run on Solana. However, it is important to note that this approach is not as simple as using a pre-existing library or API. It requires a good understanding of LLVM and the language you are trying to use, and it may be quite complex to implement.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-1024x576.png\" alt=\"llvm logo and definition\" class=\"wp-image-4761\" srcset=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-1024x576.png 1024w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-300x169.png 300w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-768x432.png 768w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-1536x864.png 1536w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm-1320x743.png 1320w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/01\/llvm.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><strong>What is LLVM?<\/strong> <em> If using image, please cite Metaschool as source.<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<p>Additionally, it&#8217;s not guaranteed that the performance and security of the code generated by LLVM will be optimal for the Solana Blockchain, since it&#8217;s not been specifically designed for it. Since the Solana team built the blockchain in Rust, which has been proven to be safe, concurrent and fast, it&#8217;s the recommended language for developing on it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-use-other-programming-languages-on-solana-blockchain\"><span class=\"ez-toc-section\" id=\"How_to_use_other_programming_languages_on_Solana_blockchain\"><\/span>How to use other programming languages on Solana blockchain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>While Solana is primarily written in Rust, it is possible to use other languages to program on the blockchain as well. There are several ways to accomplish this:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-apis\"><span class=\"ez-toc-section\" id=\"1_APIs\"><\/span>1. APIs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Solana provides APIs that allow developers to interact with the Solana from other languages. These APIs can be used to create, read, and update transactions on the blockchain, as well as to query the state of the blockchain. Developers can use these APIs to write <a href=\"https:\/\/metaschool.so\/courses\/writing-your-first-hello-world-contract-in-solidity?ref=Articles&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">smart contracts<\/a>, decentralized applications, and other blockchain-based systems in their preferred language.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-wrappers-and-libraries\"><span class=\"ez-toc-section\" id=\"2_Wrappers_and_libraries\"><\/span>2. Wrappers and libraries<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>There are third-party libraries and wrappers available for different languages that allow developers to interact with the Solana Blockchain. These libraries act as a bridge between the language and the blockchain, providing a convenient way to interact with the blockchain and perform common tasks such as creating transactions and querying the blockchain state.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-interpreters-and-transpilers\"><span class=\"ez-toc-section\" id=\"3_Interpreters_and_transpilers\"><\/span>3. Interpreters and transpilers<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It&#8217;s also possible to use an interpreter or transpiler to run code written in another language on the Solana Blockchain. Interpreters and transpilers can convert code written in a high-level language into a form that can be executed on Solana.<\/p>\n\n\n\n<p>As a parting note, it&#8217;s worth mentioning again that the most common Solana Blockchain programming language is Rust and other languages may not be as well supported by the Solana community. <\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":6,"featured_media":4757,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[292],"tags":[51],"class_list":["post-4753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-answers","tag-blockchain"],"_links":{"self":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/comments?post=4753"}],"version-history":[{"count":10,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4753\/revisions"}],"predecessor-version":[{"id":6800,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4753\/revisions\/6800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media\/4757"}],"wp:attachment":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media?parent=4753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/categories?post=4753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/tags?post=4753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}