Creating a ready-made application for microservices in production in 5 minutes

In this article we will make an API Rest with Golang ready to run in production and set to the microservices.

Image for post
Image for post

All content shown in this article is available as a Github template at the following link:

Prerequisites:

Before starting, you must have installed Golang in your development environment, so I leave here some links that explain how to install it:

Frameworks and Libraries used:


En este artículo vamos a realizar una API Rest con Golang preparada para ejecutar en producción y ambientada a los microservicios.

Image for post
Image for post

Todo el contenido mostrado en este artículo se encuentra disponible como plantilla de Github en el siguiente enlace:

Prerrequisitos:

Antes de comenzar, debes de tener instalado Golang en tu entorno de desarrollo, por lo que dejo aquí unos enlaces que explican como instalarlo:

Frameworks y Librerías utilizadas:


Image for post
Image for post

INDEX:

  1. Part 1: Introduction
  2. Part 2: Smart Contracts
  3. Part 3: Blockchain Types
  4. Part 4: Ethereum
  5. Part 5: Hyperledger
  6. Part 6: IOTA
  7. Part 7: Quorum
  8. Part 8: Extra 1; Hedera Hashgraph
  9. Part 8: Extra 2; Libra

Part 4: Ethereum:

In Ethereum, the state is made up of objects called accounts, with each account having a 20-byte address and state transitions being direct transfers of value and information between accounts. An Ethereum account contains four fields:

  • The nonce, a counter used to make sure each transaction can only be processed once
  • The account’s current ether balance
  • The account’s contract code, if present
  • The account’s storage (empty…


Image for post
Image for post

INDEX:

  1. Part 1: Introduction
  2. Part 2: Smart Contracts
  3. Part 3: Blockchain Types
  4. Part 4: Ethereum
  5. Part 5: Hyperledger
  6. Part 6: IOTA
  7. Part 7: Quorum
  8. Part 8: Extra 1; Hedera Hashgraph
  9. Part 8: Extra 2; Libra

Part 3: Blockchain Types:

The Blockchains that now exists can be divided into 3 types based on how is carried out the management of the network participants (peers), they are the following:

  • Public Blockchains: Opened to a wide range of individuals
  • Private Blockchains: Opened to a limited number of individuals
  • Hybrid Blockchains: Depends on the framework that implements the blockchain

Both public and private blockchains (and also hybrids ones) have…


Image for post
Image for post

INDEX:

  1. Part 1: Introduction
  2. Part 2: Smart Contracts
  3. Part 3: Blockchain Types
  4. Part 4: Ethereum
  5. Part 5: Hyperledger
  6. Part 6: IOTA
  7. Part 7: Quorum
  8. Part 8: Extra 1; Hedera Hashgraph
  9. Part 8: Extra 2; Libra

Part 2: Smart Contracts:

The initial use of the Blockchain technology was to make peer-to-peer monetary transactions without the need of a trusted third party.

Bitcoin is the best example.

Later, the Blockchain technology started growing and began to support the execution of smart contracts during transactions, adding much more functionality to Blockchain.

A Smart Contract is a program or a piece of code that runs in the Blockchain, and…


Image for post
Image for post

INDEX:

  1. Part 1: Introduction
  2. Part 2: Smart Contracts
  3. Part 3: Blockchain Types
  4. Part 4: Ethereum
  5. Part 5: Hyperledger
  6. Part 6: IOTA
  7. Part 7: Quorum
  8. Part 8: Extra 1; Hedera Hashgraph
  9. Part 8: Extra 2; Libra

Part 1: Introduction

A Blockchain is a distributed, timestamped, append-only ledger of data where each node of the distributed network simultaneously has the ledger information and is identified by an address.

Blockchains employ asymmetric cryptography (with public keys) to ensure that only the owner of an account (the owner of the public and private keys) can initiate transactions associated with that account.

Blockchain transactions are grouped in blocks (where…


Image for post
Image for post
Photo by the author.

In addition, a template of an API-Rest with the implemented security options is available at the following link:

Before starting to develop any kind of application, either in Node.js or any other programming environment, we must ensure that we have updated all the libraries and frameworks that we are going to use to their latest stable version (except for those where we need a specific version).

Periodically updating the environment in which we work is crucial since a chain is only as strong as its weakest link.

Managing Package Versions With NPM

To make sure that we are not using an unused version of Node.js…


Hyperledger Fabric

Image for post
Image for post

Hyperledger Fabric es el proyecto más conocido dentro de Hyperledger. Está orientado al mundo empresarial y es impulsado en su gran mayoría por IBM, siendo una plataforma multidisciplinar que aspira a facilitar la implementación de cualquier modelo de uso. Permite el despliegue de smart contracts, (en este caso se llaman chaincodes) tanto en Go, como en otros lenguajes como Node o Java. Es la blockchain de tipo privada mas famosa hasta la fecha.

En este tuturial veremos como crear una red Fabric con dos organizaciones y un canal privado entre ellas, además de una API Rest para poder comunicarnos con…

Antonio Payá González

R&D Software Engineer: http://antoniopg.tk/

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