[Golang + Parity] Atlant.io test task
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app - small fixes Aug 27, 2018
dockerfiles table name for migrations and seeds Aug 22, 2018
migrations initialize Aug 22, 2018
seeds
vendor
.gitignore
LICENSE Initial commit Aug 20, 2018
Makefile
README.md
config.yml
dockerignore
go.mod - small fixes Aug 27, 2018
go.sum
main.go
miga.yml initialize Aug 22, 2018

README.md

Atlant.io test task

Run application:

→ make dev_env_up
dev_service   | 2018-08-22T01:44:15.136Z        debug   orm/orm.go:72   Connect to PostgreSQL   {"app_name": "atlant", "app_version": "dev", "address": "postgres:5432", "user": "postgres", "password": "postgres", "database": "atlant", "pool_size": 10}
dev_service   | 2018-08-22T01:44:15.167Z        info    web/servers.go:73       Create api http server, bind address: :8080     {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.167Z        info    web/servers.go:73       Create metrics http server, bind address: :8090 {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.167Z        info    web/servers.go:73       Create pprof http server, bind address: :6060   {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.167Z        info    app/app.go:38   running workers {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.167Z        info    app/app.go:40   running servers {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.167Z        info    app/app.go:43   app successfully runned {"app_name": "atlant", "app_version": "dev"}
dev_service   | 2018-08-22T01:44:15.180Z        info    indexer/indexer.go:132  store block number      {"app_name": "atlant", "app_version": "dev", "block": 1}
dev_service   | 2018-08-22T01:44:15.180Z        info    indexer/task.go:201     scan job result {"app_name": "atlant", "app_version": "dev", "new_blocks": 1, "store_block": 0, "eth_block": 0, "last_block": 1, "cause": "block not found", "causeVerbose": "block not found\ngithub.com/im-kulikov/atlantio-task/app/eth.init\n\t/go/src/github.com/im-kulikov/atlantio-task/app/eth/eth.go:38\ngithub.com/im-kulikov/atlantio-task/app/indexer.init\n\t<autogenerated>:1\ngithub.com/im-kulikov/atlantio-task/app.init\n\t<autogenerated>:1\nmain.init\n\t<autogenerated>:1\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:186\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:2361"}
dev_service   | 2018-08-22T01:44:45.208Z        info    indexer/task.go:201     scan job result {"app_name": "atlant", "app_version": "dev", "new_blocks": 3, "store_block": 1, "eth_block": 4, "last_block": 4, "cause": "block not found", "causeVerbose": "block not found\ngithub.com/im-kulikov/atlantio-task/app/eth.init\n\t/go/src/github.com/im-kulikov/atlantio-task/app/eth/eth.go:38\ngithub.com/im-kulikov/atlantio-task/app/indexer.init\n\t<autogenerated>:1\ngithub.com/im-kulikov/atlantio-task/app.init\n\t<autogenerated>:1\nmain.init\n\t<autogenerated>:1\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:186\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:2361"}
dev_service   | 2018-08-22T01:44:45.275Z        info    indexer/indexer.go:132  store block number      {"app_name": "atlant", "app_version": "dev", "block": 4}

API Requests

Make transaction:

→ curl --data $'{
   "from": "0x00fc9af07fb2fcfc560672630b19bb8f72732164",
   "to": "0x006Db1ebe1D7da13Aa4B7523F7A4Ff123Cf98E58",
   "amount": 1.5
}' -H "Content-Type: application/json" -X POST localhost:21080/api/send

{"hash":"0x1565770c0cc1279de67c7d8adc87ec33508bc1fb7cf199ea35b097ad2dfad502"}

Get last:

curl -s localhost:21080/api/last
[
  {
    "date": "2018-08-22T01:38:50Z",
    "address": "0x006db1ebe1d7da13aa4b7523f7a4ff123cf98e58",
  },
  {
    "date": "2018-08-22T01:38:51Z",
    "address": "0x006db1ebe1d7da13aa4b7523f7a4ff123cf98e58",
  },
  {
    "date": "2018-08-22T01:38:52Z",
    "address": "0x006db1ebe1d7da13aa4b7523f7a4ff123cf98e58",
  }
]