Skip to content

cronnoss/blockchain-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github CI/CD Repository Top Language GitHub Open Issues GitHub last commit GitHub contributors License

Gopher

Back-end developer tech assignment

In this tech assignment your task is to create an API-server for blockchain indexes.

Base item is Group (Solidity smart contract code):

struct Group {
    string name;
    uint256[] indexes;
}

Group contains a list of ids. Each id represents index:

struct Index {
    uint256 id;
    string name;
    uint256 ethPriceInWei;
    uint256 usdPriceInCents;
    uint256 usdCapitalization;
    uint256 percentageChange;
}

You should deploy a smart contract on Sepolia (ETH test network) and create an API-server that will allow you to interact with the smart contract.

Contract ABI’s serve as an interface to the smart contract: https://github.com/HvrlK/abi-contract

You contract address should be like: 0xA655555555555555555555555555555555555555

You should implement next methods:

  • GET groups/ (getGroupIds method in smart contract)
  • GET groups/{groupId} (getGroup(groupId) method in smart contract)
  • GET indexes/{indexId} (getIndex(indexId) method in smart contract)
  • GET blocks/{BlockNumber | BlockHash | “latest“} (get block info from Sepolia)

Use fiber or any other golang framework. Create Swagger documentation.

The task was completed:

1. Deploy Smart Contract on Sepolia Testnet using Alchemy

See README.md in index_manager directory.

2. Blockchain API

API-server for blockchain indexes

Solution notes

  • 🔱 clean architecture (handler->service->repository)
  • 📖 standard Go project layout (well, more or less 😊)
  • 💿 github CI/CD + docker compose + Makefile included
  • ✅ handler tests with mocks included
  • ❤️ Swagger auto-generated on make generate included

HOWTO

  • 🏃‍♂️ run app in docker-compose with make dc
  • 🧪 run tests with make test
  • 🪙 generate contract from abi file with make abigen
  • 🌻 run linter with make lint

A picture is worth a thousand words

About

Blockchain-api home assignment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published