Code Monkey home page Code Monkey logo

migration-server's Introduction

Migration-server

A server that is used to migrate a user from the old kin blockchain to the new one

Prerequisites

  • Docker
  • docker-compose
  • (optional) datadog-agent to report metrics to

Configuration

The server can be configured from the docker-compose.yml file

Variable Description
MAIN_SEED The seed of the account that will fund/create new accounts
PROXY_SALT A string that is used when checking if an account was already migrated
CHANNEL_COUNT Number of channels that will be used
KIN_ISSUER Issuer of the kin asset on the old blockchain
OLD_HORIZON URL of horizon for the old blockchain
NEW_HORIZON URL of horizon for the new blockchain
NEW_PASSPHRASE The network passphrase for the new blockchain
APP_ID The app id (used to identify transactions)
STATSD_HOST Host of the datadog-agent
STATSD_PORT The datadog-agent statsd port
DEBUG Should be 'FALSE'
If you wish to run the server in debug, you can just run the 'app.py' file (without the docker)

Running the server

$ docker-compose up -d

Logs can be accessed with

$ docker-compose logs

When running with 'DEBUG'='FALSE', the server is expecting to run on an amazon ec2 instance

External API

GET '/status'

{
  "app_id": "mgsr",
  "balance": 9754,
  "channels": {
    "free_channels": 7,
    "non_free_channels": 3,
    "total_channels": 10
  },
  "old_kin_issuer": "GBC3SG6NGTSZ2OMH3FFGB7UVRQWILW367U4GSOOF4TFSZONV42UJXUH7",
  "public_address": "GDT7ZKBIKREQNZ3KRJA2QFF3KC3IAEAKAAIOHIISDMCIYMNW3UKOCW6R"
}

POST '/migrate?address=<>'

{
  "code": 200,
  "message": "OK",
  "balance: <balance sent to migrated account>"
}

Errors:

HTTP 400 Account not burned:

{
  "code": 4001,
  "message": "Account GDMBQNC3JIAJKBCRFIFYNZVNYIBXBQ2CX2QP3KSDO72NZSAXT6PIGIVH was not burned"
}

Account already migrated:

{
  "code": 4002,
  "message": "Account GC46XF47MU4NUBBSQJ4KZWLZLN37UECP2TI2IQRYLRUBNGMADHKZBFGL was already migrated"
}

Invalid public address:

{
  "code": 4003,
  "message": "Address: blablabla is not a valid address"
}

HTTP 404 Account not found:

{
  "code": 4041,
  "message": "Account GB4AG5DILURF4O3NFCH5BF4M7PZ2ZF5WOAL6M7CQZX2DSRQ5OJ4224UQ was not found"
}

migration-server's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cloudance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.