# venus-gateway

The venus-gateway is used for registering wallets, keeping track of miner-related information, and as a liaison between wallets and other components. It could be also used for proxy requests from chain services (shared modules/components) to independent modules/components.

# Start venus-gateway

Download source code.

git clone https://github.com/ipfs-force-community/venus-gateway.git

Compile.

make

Start service.

./venus-gateway run --auth-url=<autl-url>

TIP

After succussful start, a token file will be generated in the working directory, which contains your jwt token for CLI commands.

# CLI Commands

Check help information.

./venus-gateway -h

NAME:
   venus-gateway - venus-gateway for proxy incoming wallet and proof

USAGE:
   venus-gateway [global options] command [command options] [arguments...]

VERSION:
   0.0.1'+gitc2048fb'

COMMANDS:
   run      start venus-gateway daemon
   miner    miner cmds
   wallet   wallet cmds
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --listen value  host address and port the worker api will listen on (default: "/ip4/127.0.0.1/tcp/45132")
   --help, -h      show help (default: false)
   --version, -v   print the version (default: false)

# Notable commands

List all miners.

$ ./venus-gateway miner list

# output
t01561
t02608
t02082

Check miner status.

$ ./venus-gateway miner <MINER_ID>

# output
{
        "Connections": [
                {
                        "Channel": "ddbbd646-f3a2-474b-8457-ea7195cf5765",
                        "Ip": "127.0.0.1:36586",
                        "RequestCount": 0,
                        "CreateTime": "2021-07-20T17:34:33.767108581+08:00"
                }
        ],
        "ConnectionCount": 1
 }

List all wallets.

$ ./venus-gateway wallet list

# output
[
        {
                "Account": "wallet_test1",
                "SupportAccounts": [
                        "testminer"
                ],
                "ConnectStates": [
                        {
                                "Addrs": [
                                        "t3wbwannykivspagunexwwky7eiqg4qa25eoqmgolpkzdz3fidocbjeflbyxqqguyypsekyhqbkj33f657ulla",
                                        "t1zkh45ooidf5zt3yv5o26uugjn5ao4fttsxfgdaq",
                                ],
                                "ChannelId": "016c1010-c56a-4849-89d1-e2b28aecc95a",
                                "Ip": "192.168.5.64:50448",
                                "RequestCount": 0,
                                "CreateTime": "2021-07-19T14:06:50.209609054+08:00"
                        }
                ]
        },
        {
                "Account": "wallet_test2",
                "SupportAccounts": [
                        "wallet_test2"
                ],
                "ConnectStates": [
                        {
                                "Addrs": [
                                        "t3vwbowhnkripgyxdawgwepcwcsqmai5exxetord362wudwr24a3kvgndnpsn6i3md2i23cmjx3rfflvbu7gna",
                                ],
                                "ChannelId": "57971a25-b760-4744-b6c2-af470ab456a9",
                                "Ip": "127.0.0.1:36598",
                                "RequestCount": 0,
                                "CreateTime": "2021-07-20T17:34:33.809502589+08:00"
                        }
                ]
        }
 ]

Check individual wallet.

$ ./venus-gateway wallet <wallet-account>

# Check if wallet address exists

Everytime gateway starts up, it will generate a random string (gateway_string). When a wallet tries to connect to gateway, it will carry a randomly generated string by itself (wallet_string). Gateway will then check each wallet address by calling sign interface with hash of gateway_string + wallet_string as payload. Through MsgMeta.Extra, gateway_string will also be transferred to wallet. And finally the result of wallet's sign will be validatated by gateway.

Last Updated: 10/11/2021, 10:48:25 AM