Coder Social home page Coder Social logo

cmingxu / wallet-keeper Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 13.0 206 KB

Simplified access to BTC/OmniProtocol/ETH backend with unified APIs.

License: Apache License 2.0

Makefile 0.79% Go 93.39% Dockerfile 0.50% Shell 3.55% Python 1.76%
bitcoind btc usdt wallet ominilayer

wallet-keeper's Introduction

Wallet Keeper


simplified access to BTC/OmniProtocol/ETH backends with unified APIs, help cryptocurrency developers focus their bussiness logic instead of RPC details of different backend.

Notice: currently under heavy development.

version

Run

$ make
$ ./bin/wallet-keeper --log-level debug --log-dir=/tmp/  \
run --http-listen-addr=http://0.0.0.0:8080

Docker Run

$ ./scripts/build.sh
$ ./scripts/run_wallet_keeper_docker.sh

How to config

$ ./bin/wallet-keeper 
use stdout as default log output
NAME:
   Universal BTC/USDT wallet gateway - A new cli application

USAGE:
   wallet-keeper [global options] command [command options] [arguments...]

VERSION:
   0.2.0

COMMANDS:
     run, r   serve api gateway
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --log-level value  default log level (default: "info") [$LOG_LEVEL]
   --log-dir value     [$LOG_DIR]
   --env value        (default: "production") [$ENV]
   --help, -h         show help
   --version, -v      print the version

$ ./bin/wallet-keeper run --help
use stdout as default log output
NAME:
   wallet-keeper run - serve api gateway

USAGE:
   wallet-keeper run [command options] [arguments...]

OPTIONS:
   --http-listen-addr value  http address of web application (default: "0.0.0.0:8000") [$HTTP_LISTEN_ADDR]
   --btc-rpc-addr value      [NOTICE] testnet and mainnet have different default port (default: "192.168.0.101:8332") [$BTC_RPCADDR]
   --btc-rpc-user value      (default: "foo") [$BTC_RPCUSER]
   --btc-rpc-pass value      password can be generate through scripts/rcpauth.py (default: "qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0=") [$BTC_PRCPASS]
   --usdt-rpc-addr value     [NOTICE] testnet and mainnet have different default port (default: "localhost:18332") [$USDT_RPCADDR]
   --usdt-rpc-user value     (default: "foo") [$USDT_RPCUSER]
   --usdt-rpc-pass value     password can be generate through scripts/rcpauth.py (default: "usdtpass") [$USDT_PRCPASS]
   --usdt-property-id value  property id of usdt, default is 2 (default: 2) [$USDT_PROPERTY_ID]
   --eth-rpc-addr value      (default: "http://192.168.0.101:8545") [$ETH_RPCADDR]
   --eth-wallet-dir value    (default: "/data/eth-wallet") [$ETH_WALLET_DIR]
   --eth-account-path value  (default: "/data/eth-accounts.json") [$ETH_ACCOUNT_PATH]
   --backends value          (default: "btc,usdt,eth") [$BACKENDS]

BTC - bitcored

getblockcount

$ curl -sSL -H "CoinType:btc" localhost:8000/getblockcount |  jq .
{
  "message": "603443"
}

getaddress

$ curl -sSL -H "CoinType:btc" localhost:8000/getaddress?account=barfoox |  jq .
{
  "message": [
    "2MwFt5ZbGfK2yqCWHb1hyGKkm8K6DUByPj8",
    "2N3Mqnjq9KUnLqUNjRdgkqh1VY4DJBjPoie",
    "2N4MbjrKuBD9KYFitz6nmSZFBJxdSWguC7Y",
    "2NDuD1sWwsuZeVdBCv8pusjSQUCNTbJTR7x"
  ]
}

getnewaddress

$ curl -sSL -H "CoinType:btc" localhost:8000/getnewaddress?accounts=barfoox |  jq .
{
  "message": "2MwTYicqDegSuR2MsTeRVFLwkhMYSZKHPiP"
}

listaccounts

$ curl -sSL -H "CoinType:btc" localhost:8000/listaccounts |  jq .
{
  "message": {
    "barfoo": 0,
    "barfoox": 0,
    "duckduck": 0,
    "foobar": 0
  }
}

sendtoaddress

$ curl -sSL -H "CoinType:btc" 'localhost:8000/sendtoaddress?address=2N2VJhke2sWspswJKWTFjqfibRY1wfZPbEQ&amount=0.1' |  jq .
{
  "message": "-6: Insufficient funds"
}

getaddressesbyaccount

$ curl -sSL -H "CoinType:btc" 'localhost:8000/getaddressesbyaccount?account=foobar' |  jq .
{
  "message": [
    "2MziFYWKdptgkDn9esKhQnQXt86H6taGM3f",
    "2MziSR87om6fZyknsTMF447Yftt5afQB9GN",
    "2NBEYgwGWTiTaPvCKp64hDeP5xnwckdrYNK",
    "2NGTBdRezf7TNtF3X1ptmWzVr4XWc8MHnnP"
  ]
}

getaccountinfo

$ curl -sSL -H "CoinType:btc" 'localhost:8000/getaccountinfo?account=barfoo' |  jq .
{
  "message": {
    "account": "barfoo",
    "balance": 0.0015,
    "addresses": [
      "2Mtb1opq1JvzfdLdGRPFSWwbEmvRGBXYdos",
      "2MxK75vSZLABDgqZRmUPMt6kfyabXZD81SJ",
      "2N5ETGDkhFFZqKQWhcbfYMihv9rSorMQLP9",
      "2ND1nUpT3in3HeMjssd7XkPa3j6nHXQgs1G"
    ]
  }
}

createaccount

$ curl -sSL -H "CoinType:btc" 'localhost:8000/createaccount?account=barfoo1' |  jq .
{
  "message": {
    "account": "barfoo1",
    "balance": 0,
    "addresses": [
      "2N7y28aMq3xfxEZBFDvfvVzQ6aZLXr7np64"
    ]
  }
}

USDT - omnicore

getblockcount

$ curl -sSL -H "CoinType:usdt" localhost:8000/getblockcount |  jq .
{
  "message": "1488490"
}

getaddress

$ curl -sSL -H "CoinType:usdt" localhost:8000/getaddress??account=test |  jq .
{
  "message": "mqyY2dscucMNBHAiUid88mEgkvZ3ADJLeZ"
}

getaddressesbyaccount

$ curl -sSL -H "CoinType:usdt" 'localhost:8000/getaddressesbyaccount?account=test' |  jq .
{
  "message": [
    "mkVW5QARPvvAY328y9LMHep5ZhuiTrgdd4",
    "mvePubvtfpAo18ykLeZ1hD6BMYDismUqxf"
  ]
}

getaccountinfo

$ curl -sSL -H "CoinType:usdt" 'localhost:8000/getaccountinfo?account=test' |  jq .
{
  "message": {
    "account": "test",
    "balance": 10,
    "addresses": [
      "mkVW5QARPvvAY328y9LMHep5ZhuiTrgdd4",
      "mvePubvtfpAo18ykLeZ1hD6BMYDismUqxf"
    ]
  }
}

move

$ curl -sSL -H "CoinType:usdt" 'localhost:8000/move?from=mvePubvtfpAo18ykLeZ1hD6BMYDismUqxf&to=mkVW5QARPvvAY328y9LMHep5ZhuiTrgdd4&amount=3' |  jq .
{
  "message": "success"
}

sendfrom

$ curl -sSL -H "CoinType:usdt" 'localhost:8000/sendfrom?from=test&address=mkVW5QARPvvAY328y9LMHep5ZhuiTrgdd4&amount=3' |  jq .
{
  "message": "success"
}

wallet-keeper's People

Contributors

cmingxu avatar xiaods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wallet-keeper's Issues

came across build error on scripts/build.sh

go: finding github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: finding github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89
go: finding github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd
go: finding github.com/onsi/gomega v1.4.3
go: finding github.com/golang/protobuf v1.3.1
go: finding github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
go: finding github.com/kr/pty v1.1.1
go: finding github.com/onsi/ginkgo v1.7.0
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: error loading module requirements
make: *** [Makefile:13: build] Error 1
unable to locate binary file './bin/wallet-keeper-0.1.2', stop

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.