# wallet-server

## 编译

make build

## 使用

```
./wallet-server -h                                             
NAME:
   wallet-server - eth and tron wallet service

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

COMMANDS:
   run      run wallet server process
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help

```

### 步骤

#### 1.配置

```
mysql:
  user: root
  password: 123456789
  host: 127.0.0.1:3306
  db: wallet-server

keymanageraddr: "127.0.0.1:5556"

ethrpcaddrs:
  - "https://mainnet.infura.io/v3/2eba501820ce490f8dd5117d9ddb374d"
tronrpcaddrs:
  - "grpc.trongrid.io:50051"
```

服务依赖于mysql

- 用来持久化发送的交易记录

区块链节点客户端rpc

- 用户构建/广播交易
- 支持多个，服务将自动扫描发现更优的节点使用。建议在实际运行时，配置多个rpc地址，多个rpc地址示例：

  ```
  ethrpcaddrs:
    - "https://mainnet.infura.io/v3/2eba501820ce490f8dd5117d9ddb374d"
    - "https://mainnet.infura.io/v3/2eba501820ce490f8dd5117d9ddb374d"
  tronrpcaddrs:
    - "grpc.trongrid.io:50051"
    - "grpc.trongrid.io:50051"
  ```

#### 2.启动

```
 ./wallet-server run -h                                         
NAME:
   wallet-server run - run wallet server process

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

OPTIONS:
   --listen value  The host address and port on which the key manager will listen (default: "127.0.0.1:6667")
   --config value  config file path
   --help, -h      show help

```

- --listen 可指定服务启动的端口

命令示例：

`wallet-server run --config ./conf/conf.yaml`


