---
title: How I built my first Blockchain application
description: Blockchain is the technology at the core of digital currencies. It’s a digital ledger of transactions spread across a network of computers. Each node in the network can securely change the ledger without the need for a central authority. This is how this independent system is able to operate without relying on banks or any other middlemen.
image: https://blog.e-zest.com/hubfs/blog-files/How%20I%20built%20my%20first%20Blockchain%20application.png
---

[![e-Zest logo\_An accion lab company\_Colour](https://blog.e-zest.com/hubfs/images/Logos%20with%20Tagline/Corporate/SVG/e-Zest%20logo_An%20accion%20lab%20company_Colour.svg "e-Zest logo_An accion lab company_Colour")](https://www.e-zest.com/)

- [WORK](https://www.e-zest.com/our-work)
- [SERVICES](https://www.e-zest.com/our-services) 
    - [Product Engineering](https://www.e-zest.com/digital-product-engineering-services)
    - [Enterprise Data Services](https://www.e-zest.com/enterprise-data-services)
    - [Digital Commerce](https://www.e-zest.com/digital-commerce-services)
    - [Digital Operations](https://www.e-zest.com/digital-operations)
    - [Digital Consulting](https://www.e-zest.com/digital-transformation-consulting-services)
    - [Digital Experience Design](https://www.e-zest.com/digital-experience-design)
- [INSIGHTS](https://blog.e-zest.com/)
- [CAREERS](https://www.e-zest.com/careers)
- [ENTERPRISE DATA SERVICES](https://www.e-zest.com/enterprise-data-services)
- [GENERATIVE AI](https://www.e-zest.com/generative-ai)
- [Healthcare](https://healthcare.e-zest.com)
- [Contact Us](https://www.e-zest.com/contact-us)

- ![Elevating Product Engineering with AI and ML](https://blog.e-zest.com/hubfs/Elevating%20Product%20Engineering%20with%20AI%20and%20ML.jpg)

  [BLOGS](https://blog.e-zest.com)
  
  #### Elevating Product Engineering with AI and ML

  As technology evolves and customer choices broaden, there is an increasing ...

  [Read more](https://blog.e-zest.com/elevating-product-engineering-with-ai-and-ml)
- ![e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024](https://blog.e-zest.com/hubfs/e-Zest%20%E2%80%93%20An%20Accion%20Labs%20Company%20-%20Gets%20Recognition%20as%20a%20Contender%20in%20the%20ISG%20Provider%20LensTM%20Study%20on%20Digital%20Engineering%20Services%202024.jpg)

  [NEWS](https://blog.e-zest.com/news)
  
  #### e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024

  We are delighted to announce that e-Zest – An Accion Labs Company has been ...

  [Read more](https://blog.e-zest.com/news/e-zest-an-accion-labs-company-gets-recognition-as-a-contender-in-the-isg-provider-lens-study-on-digital-engineering-services-2024)
- ![e-Zest Solutions supports Digital Pune Mission](https://blog.e-zest.com/hubfs/blog-files/Digital%20Literacy%20Bus%20e-Zest.png)

  [CSR](https://blog.e-zest.com/csr)
  
  #### e-Zest Solutions supports Digital Pune Mission

  **Pune, India:** e-Zest Solutions, a leading digital technology innovation ...

  [Read more](https://blog.e-zest.com/csr/e-zest-solutions-supports-digital-pune-mission)

- [Work](https://www.e-zest.com/our-work)
- [Services](https://www.e-zest.com/our-services)
- [Insights](https://blog.e-zest.com)
- [Careers](https://www.e-zest.com/careers)
- [Enterprise Data](https://www.e-zest.com/enterprise-data-services)
- [Generative AI](https://www.e-zest.com/generative-ai)
- [Innovations](https://www.e-zest.com/innovations)
- [Healthcare](https://healthcare.e-zest.com)
- [About](https://www.e-zest.com/about-us)
- [Contact](https://www.e-zest.com/contact-us)

- [Blog](https://blog.e-zest.com/)
- [News](https://blog.e-zest.com/news)
- [CSR](https://blog.e-zest.com/csr)

- [![Linkedin Icon](https://blog.e-zest.com/hubfs/icons/linkedin_icon_white.svg)](https://www.linkedin.com/company/e-zest-solutions/)
- [![Twitter Icon](https://blog.e-zest.com/hubfs/twitter-logo-silhouette%20(5).svg)](https://twitter.com/ezest)
- [![Facebook Icon](https://blog.e-zest.com/hubfs/facebook-app-logo%20(4).svg)](https://www.facebook.com/61259256638)
- [![Instagram Icon](https://blog.e-zest.com/hubfs/instagram-logo%20(4).svg)](https://www.instagram.com/ezestsolutions/)
- [![Youtube Icon](https://blog.e-zest.com/hubfs/icons/youtube_icon_white.svg)](https://www.youtube.com/user/ezestcorporate)

[![Go to top icon](https://blog.e-zest.com/hubfs/AA%20Assets/top%20button.svg)](https://blog.e-zest.com/how-i-built-my-first-blockchain-application#top)

Hit enter to search or ESC to close

Insights

e-Zest members share technology ideas to foster digital transformation.

- [Blog](https://blog.e-zest.com)
- [Whitepaper](https://blog.e-zest.com/whitepaper)
- [Playbook](https://blog.e-zest.com/playbook)
- [News](https://blog.e-zest.com/news)
- [Innovation](https://blog.e-zest.com/innovation)
- [Media Kit](https://www.e-zest.com/media-kit)

# How I built my first Blockchain application

[Mohammad Ansari](https://blog.e-zest.com/author/mohammad-ansari)  Dec 10, 2018

[PHP](https://blog.e-zest.com/topic/php-2) [Blockchain](https://blog.e-zest.com/topic/blockchain) [Catena](https://blog.e-zest.com/topic/catena) [Cryptocurrency](https://blog.e-zest.com/topic/cryptocurrency) [Digital Ledger](https://blog.e-zest.com/topic/digital-ledger)

- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/how-i-built-my-first-blockchain-application&title=&summary=&source=>
- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/how-i-built-my-first-blockchain-application&text=How%20I%20built%20my%20first%20Blockchain%20application>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/how-i-built-my-first-blockchain-application>
- <https://www.instagram.com/ezestsolutions/?u=https://blog.e-zest.com/how-i-built-my-first-blockchain-application>

In this blog, I will share with you how you can build a simple blockchain application. But before that let’s get an idea about what is blockchain and one of its major applications.

**What is Blockchain?**

Blockchain is the technology at the core of digital currencies. It’s a digital ledger of transactions spread across a network of computers. Each node in the network can securely change the ledger without the need for a central authority. This is how this independent system is able to operate without relying on banks or any other middlemen.

The blockchain is receiving a lot of recognition as the technology poised to disrupt many industries especially the Financial Services. But its potential is far-reaching and has implications for many industries.

Building the application Catena – SQL on a blockchain can act as the database for front-end of the application for which we can use simple HTML and CSS and for the backend we can use PHP. To build the application you can follow the below-mentioned steps.

- **Building Catena**

 First, we shall install Catena on the local machine and then set up the server to run the application locally. I have used Ubuntu and for Windows, users can use Docker. All the commands should be executed by a superuser.

**apt install clang build-essential libicu-dev libcurl4-openssl-dev openssl libssl-dev**

This command ensures required libraries are present, now clone the catena to the local machine.

**git clone https://github.com/pixelspark/catena.git catena**

After this go inside the catena folder

**cd catena**

Now check if Swift is installed in the system and the path is given. To check whether Swift 4 is present or not type swift build.

**Swift build**

If swift build gives an error, then it means Swift is not installed. You can then download Swift 4 and install it in the Catena folder. After installing the Swift again run the swift build command.

**Building the web client**

Catena comprises of a web client, resources from the resources folder where a built-in version of the web client is included. To build from the scratch, first, install the required build tools, then use gulp to compile and bundle files.

**cd Resources/**

Install gulp if it is not installed already

**npm install gulp**

After installation run the gulp to compile and bundle files.

**Running gulp natively**

To run the Catena natively, open the terminal in the Catena folder. The following command starts Catena and initializes a new chain (replace 'debug' with 'release' after building a release version):

**./.build/debug/Catena -p 8338 -m -i -s 'my seed string'**

![catena](https://blog.e-zest.com/hs-fs/hubfs/blog-files/catena.png?width=600&name=catena.png)  
As seen above, we can connect Catena to the PQ interface i.e. we can use PostgreSQL command line to execute query directly to the Catena. We will see now how to use Catena.

- **Using Catena**

**Web client**

The web client of Catena runs on 127.0.0.1:8338 here the port number is the same as you have mentioned in the command to build Catena. When you run the Catena, the below screen is shown.

![web-client-catena](https://blog.e-zest.com/hs-fs/hubfs/blog-files/web-client-catena.png?width=600&name=web-client-catena.png)  
In this case, an identity is already created if no identity is present, you can go to the identity tab and create an identity.

![identify](https://blog.e-zest.com/hs-fs/hubfs/blog-files/identify.png?width=600&name=identify.png)  
When you create an identity, it is advisable to copy the public key and the secret key, as mentioned in the start Catena is SQL on blockchain so the **public key** is the **username** and the **secret key** **(private key)** is the **password**. You can also grant permission to the user of the database using grants as blockchain is a distributed system but for this demo, we will be using a single node application.

Now create a database (you can do this step using PostgresSQL CLI also)

![welcome](https://blog.e-zest.com/hs-fs/hubfs/blog-files/welcome.png?width=600&name=welcome.png)  
When the database is created, the information is stored in the blockchain.

**SQL interface**

The (private) SQL interface is available on port 8339 (by default). If you set a different HTTP port (using the '-p' command line switch), the SQL interface will assume that port+1. You can connect to the SQL interface using the PostgreSQL (if PostgreSQL is not installed, first install PostgreSQL) command line client:

**psql -h localhost -p 8339 -U \<publicKey\> \<databaseName\>**

When this command is running, it will prompt for the password. Use the secret key as a password.  
  
**Statements**

The following statement types are supported in Catena.

**Create Database**

Creates a database and makes the invoker of the statement the owner of the database. If the database already exists, the transaction is rolled back. Note: the 'current database' for the transaction must be the database that is about to be created.

**Drop Database**

Removes the indicated database, but only if there are no tables left in the database. Only the owner of the database can execute this statement.

**Select**  
**Insert**  
**Update**  
**Delete**  
**Create Table**  
**Drop Table**Now that web client is running and the queries are executed using the PostgresSQL CLI it is now the time to connect Catena with PHP.

**Connecting Catena with PHP**

First to run PHP we need to install Apache. When the Apache is installed go to /var/www/html/ and create a new PHP file connection.php this will be used to connect to Catena for connection PostgreSQL wire-protocol will be used. The code for connection.php is

**$host = "host = 127.0.0.1";**  
**$port = "port = 8339";**  
**$dbname = "dbname = blockchain";**  
**$credentials = "user = 3xaeMnTqbKw5J5513yun5kBYSoofHuEiHtgUqxU477jygHTMxuc**  
**password=7MSfWr6QMrdk9HFntkskf5MFrmcNaJbHY8u4VCbiSE3ETeuNxz7muChaCN2YwkJBFTQkh**  
**2ohH1yVnXLJZKbNbuZEfaJnm";**

Here the user is the public key of the identity and the password is the secret key. Now that the database is connected, you can connect it to the frontend and take input from the frontend and store it in the blockchain. You can now easily implement any of the use cases of the blockchain technology.  
You can list your suggestions and idea in the comment section.

- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/how-i-built-my-first-blockchain-application&text=How%20I%20built%20my%20first%20Blockchain%20application>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/how-i-built-my-first-blockchain-application>
- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/how-i-built-my-first-blockchain-application&title=&summary=&source=>

### Similar Blog

[![Just-in-Time Cloud Resources](https://blog.e-zest.com/hubfs/blog-files/just-in-time-cloud-resources.png) Just-in-Time Cloud Resources To date, there exists many methods to schedule the start and stop of cloud resources for an application. If it can be known when ... By Sneha Sajjan Nov 22, 2018](https://blog.e-zest.com/just-in-time-cloud-resources)

[![Magento 2 Static Code Analysis](https://blog.e-zest.com/hubfs/blog-files/Magento%202%20Static%20Code%20Analysis.png) Magento 2 Static Code Analysis Quality of code plays an important role in application’s security, stability, and maintainability. There are different tools ... By Pravin Patil Oct 22, 2018](https://blog.e-zest.com/magento-2-static-code-analysis)

[![How to test PHP code quality using SonarQube?](https://blog.e-zest.com/hubfs/sonar-qube.png) How to test PHP code quality using SonarQube? **Introduction:**We all know that the success of the project strictly depends on the quality of code. With the growth of the ... By Pravin Patil Dec 19, 2017](https://blog.e-zest.com/how-to-test-php-code-quality-using-sonarqube)

[Integration of Jasper Report – PHP CodeIgniter Web Framework If you are dealing with billing or management projects where reporting is required with simple pdf formatted files, you need a ... By Archana Mulye Feb 18, 2016](https://blog.e-zest.com/integration-of-jaspersoft-report-php-codeigniter-web-framework)

## Helping Organizations Thrive in the Digital Age

[Contact Us](https://www.e-zest.com/contact-us)

- [About](https://www.e-zest.com/about-us)
- [Services](https://www.e-zest.com/our-services)
- [Work](https://www.e-zest.com/our-work)
- [Insights](https://blog.e-zest.com/)
- [Healthcare](https://healthcare.e-zest.com/)
- [Accion Labs](https://www.accionlabs.com/)

- <https://www.linkedin.com/company/e-zest-solutions/>
- <https://twitter.com/ezest>
- <https://www.facebook.com/eZest/>
- <https://www.instagram.com/ezestsolutions/>
- <https://www.youtube.com/user/ezestcorporate>

- Dallas
- Detroit
- Hannover
- Vienna
- London
- Pune

 © 2025 e-Zest Solutions

- [Privacy Policy](https://www.e-zest.com/privacypolicy)
- [Cookie Policy](https://www.e-zest.com/cookie-policy)

 Contact us

 Contact us

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.