How to deploy Smart Contracts on XINFIN’s XDC Hybrid Blockchain

    This blog post is a follow-through of a Live Webinar I am conducting on 22nd of May. I will be going through how you can deploy a smart contract on the XinFin Blockchain. If you are not familiar with Smart Contracts, I will do a brief introduction so you can grasp as we walkthrough.

    What is XINFIN?

    XinFin is a Hybrid Blockchain technology company focused on international trade and finance. They have developed a highly scalable, secure, permissioned and commercial grade Blockchain architecture. XinFin Blockchain is powered by XDC protocol, which is built over the first of its kind Hybrid Blockchain architecture to eliminate the inefficiencies in global trade and financing and to enable institutions to provide real-time settlement as well as enabling cross border smart contracts.

    I know this might have been too much jargon for a novice to understand but let’s get down to understand everything here. Quite often you will see people asking what XINFIN does and how it is different from the Ethereum Blockchain. To make you understand this, let’s look at the different types of blockchains that exist.

    Types of Blockchains

    1. Public Blockchain

    As the name suggests, public blockchain is public in nature. I am sure you now know what Bitcoin is or at least you have heard about. Bitcoin uses what is called a public ledger/blockchain that makes everything transparent. This means that any transaction that you perform through bitcoin is open to the public. Any individual can trace your transaction if they have the right information. Therefore if ever you have heard anyone saying Bitcoin is anonymous, they probably didn’t understand what they were talking about.

    In a public blockchain, any individual can participate in the network in every way they can, depending on the resources that they have to their disposal. One can participate through mining or hosting a node, and you don’t need any type of approval from anyone. It is of paramount importance to note that public blockchains like bitcoin or ethereum are immutable which is very important for consistency sake. Other examples of public blockchains include Ethereum & NEO

    2. Private Blockchain

    Now that you understand what a public blockchain is, let’s move on to private blockchains. As you might have guessed also, private blockchains are private. In private blockchains, access is limited to its users. Users will need to get that access from an authority who is managing the private blockchain. As it is a private blockchain, changes are always made as it suits the owner. An example is the administrators limiting the transactions based on their nature, speed or intent. The control aspect here gives private blockchains a great use-case for companies or organizations that want to take benefit of the blockchain but in a close environment.

    So basically private blockchains are closed off from the public and you cannot just participate in their activities unless you have been granted the permission to do so hence the name Permissioned Blockchain. Example of a private blockchain is Quorum which is however powered by Ethereum network. J.P Morgan is the creator of Quorum.

    3. Hybrid Blockchain

    A hybrid blockchain in simple terms is the best of both worlds of private and public blockchains. A hybrid blockchain will mean control of access but also there is freedom at the same time. It is different from private blockchains in that, it is not open to everyone but still has public blockchain features such as integrity, transparency and security.

    The other important point to note is that Hybrid Blockchains are entirely customizable. The members of the hybrid blockchain can decide who can take part in the blockchain or which transactions are made public. This type of blockchain is perfect for companies who aim to work with their stakeholders and at the same time not compromising their private information.

    XDC blockchain is the perfect example of a hybrid blockchain. Well now that you understand what we mean by XDC Hybrid Blockchain, now its time to look at Smart Contracts

    What is a Smart Contract?

    By now you must be wondering what other use cases blockchain might have. Well, have you ever imagined having an application that has no downtime? If you have a service that has an application that is used by your customers, and that application is hosted on a central server with limited resources, there are high chances you application can face downtime if the server experiences some problems. If your application runs on the blockchain, your application has access to unlimited resources from computers that support the network and therefore your application has fewer chances of getting a downtime from server problems. This is because if one computer that supports the network is down, the blockchain can still operate since there is still more computers on the network.

    Smart contracts are just like usual contracts that will let you exchange property, money, shares or anything valuable securely and with transparency. With the use of smart contracts, you won’t be needing any middleman to do your deed. That’s why they are called smart contracts because they do all the work for you. With smart contracts, it’s not only about defining the rules but its also a matter of enforcing them.

    More on smart contracts in another blog.

    Deploying a Smart Contract on XDC

    Follow these steps on how you can deploy your first smart contract.

    1. Download XinPay

    The first step is downloading the XinPay meta task wallet. You will need a Chrome Browser. Here you will load up funds(Don’t worry you will get them for free) to use for deploying our smart contract. You can find the download here:

    Make sure you set a password that you can remember.

    XinPay on Google Chrome. Click on Add to Chrome

    After the extension has been added to your browser, click on it and create a password that you will remember.

    2. Now lets add some free XDC to your wallet.

    Like I mentioned there is no need to worry about where to your XDC because XinFin does provide it for you. Now that you have a wallet, access your wallet once again and copy the wallet address. Your wallet address is just under Account 1, just go ahead and click on the COPY button.

    XDC Wallet

    Now that have your wallet address lets go and get some XDC here:

    XDC Faucet

    It will take about 20 seconds for the funds to get to your wallet. By the way, 1000 XDC is more than enough. There is no need to fill your wallet with 1 Million XDC, you will never be able to spend it.

    3. Create your smart contract on XinFin’s Remix IDE

    Smart Contracts are written using a programming language called Solidity. If you have never used Solidity don’t worry you can still follow along with this tutorial.

    Open the Remix IDE here:

    It will bring up a window that looks like below

    Remix IDE

    Click the add button that is to the right of browser. We will name our file mycontract.sol. The .sol as you might have guessed is for solidity, so click on Solidity under Environments.

    You can now go ahead and PULL 2 source files I uploaded on my GitHub account:

    Now lets copy the code in mycontract.sol into your own mycontract.sol.

    Go ahead and compile mycontract.sol then deploy it.

    After deploying, you can check if your contract was successfully deployed by taking the transaction id and pasting it on the test net explorer.

    You can access it here:


    Well, that has been a very long blog, and if you read through it all then I salute you! I hope you will begin your journey in smart contracts with pleasure to have learnt the first steps from this blog. Don’t forget to support us. Your support will be greatly appreciated.

    You can register for the live webinar here:

    If you found this Blog helpful, follow our social media pages and share it with your friends. If you feel like buying us a coffee please do so below! Till next time!





    Recent Articles


    Related Stories

    Stay on op - Get the daily news in your inbox

    [tdn_block_newsletter_subscribe input_placeholder="Email address" btn_text="Subscribe" tds_newsletter2-image="730" tds_newsletter2-image_bg_color="#c3ecff" tds_newsletter3-input_bar_display="" tds_newsletter4-image="731" tds_newsletter4-image_bg_color="#fffbcf" tds_newsletter4-btn_bg_color="#f3b700" tds_newsletter4-check_accent="#f3b700" tds_newsletter5-tdicon="tdc-font-fa tdc-font-fa-envelope-o" tds_newsletter5-btn_bg_color="#000000" tds_newsletter5-btn_bg_color_hover="#4db2ec" tds_newsletter5-check_accent="#000000" tds_newsletter6-input_bar_display="row" tds_newsletter6-btn_bg_color="#da1414" tds_newsletter6-check_accent="#da1414" tds_newsletter7-image="732" tds_newsletter7-btn_bg_color="#1c69ad" tds_newsletter7-check_accent="#1c69ad" tds_newsletter7-f_title_font_size="20" tds_newsletter7-f_title_font_line_height="28px" tds_newsletter8-input_bar_display="row" tds_newsletter8-btn_bg_color="#00649e" tds_newsletter8-btn_bg_color_hover="#21709e" tds_newsletter8-check_accent="#00649e" embedded_form_code="YWN0aW9uJTNEJTIybGlzdC1tYW5hZ2UuY29tJTJGc3Vic2NyaWJlJTIy" tds_newsletter="tds_newsletter1" tds_newsletter3-all_border_width="2" tds_newsletter3-all_border_color="#e6e6e6" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjAiLCJib3JkZXItY29sb3IiOiIjZTZlNmU2IiwiZGlzcGxheSI6IiJ9fQ==" tds_newsletter1-btn_bg_color="#0d42a2" tds_newsletter1-f_btn_font_family="406" tds_newsletter1-f_btn_font_transform="uppercase" tds_newsletter1-f_btn_font_weight="800" tds_newsletter1-f_btn_font_spacing="1" tds_newsletter1-f_input_font_line_height="eyJhbGwiOiIzIiwicG9ydHJhaXQiOiIyLjYiLCJsYW5kc2NhcGUiOiIyLjgifQ==" tds_newsletter1-f_input_font_family="406" tds_newsletter1-f_input_font_size="eyJhbGwiOiIxMyIsImxhbmRzY2FwZSI6IjEyIiwicG9ydHJhaXQiOiIxMSIsInBob25lIjoiMTMifQ==" tds_newsletter1-input_bg_color="#fcfcfc" tds_newsletter1-input_border_size="0" tds_newsletter1-f_btn_font_size="eyJsYW5kc2NhcGUiOiIxMiIsInBvcnRyYWl0IjoiMTEiLCJhbGwiOiIxMyJ9" content_align_horizontal="content-horiz-center"]