Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.

Enable RPC Server #75

Merged
merged 9 commits into from
Jul 15, 2019
Merged

Enable RPC Server #75

merged 9 commits into from
Jul 15, 2019

Conversation

ansermino
Copy link

@ansermino ansermino commented Jul 14, 2019

  • Introduces rpc command to cli (rest-server)
  • Moves server/rpc to rpc/
  • Enables module selection (eg. "web3" or "eth" or "web3,eth"), however there is no CLI flag to configure these (See Allow Configuration of RPC Modules #74)
    • Defaults to {"web3", "eth"}
  • Adds CLI context to eth API
    • CliContext.GetNode() can be used to retrieve SDK client to query for API calls

Note: Port (and listening address) can configured using --laddr, provided by the default REST server command.

Testing

  1. You can start the daemon with a command such as:
    make install && rm -rf ~/.emint* && emintd init moniker --chain-id testchain && emintcli config chain-id testchain && emintcli config output json && emintcli config indent true && emintcli config trust-node true && emintcli keys add austin && emintd add-genesis-account $(emintcli keys show austin -a) 1000photon,100000000stake && emintd gentx --name austin && emintd collect-gentxs && emintd validate-genesis && emintd start

  2. Start the server in another terminal:
    emintcli rest-server --laddr "tcp://localhost:8545

  3. In another terminal:
    curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' -H "Content-Type: application/json" http://localhost:8545/rpc

Expected response (id, result will differ):
{"jsonrpc":"2.0","id":67,"result":"Ethermint/0.0.0+08c5e36/linux/go1.12.6"}

@ansermino ansermino changed the title David/rpc refactor Enable RPC Server Jul 14, 2019
@ansermino ansermino marked this pull request as ready for review July 14, 2019 00:30
@ansermino ansermino requested a review from austinabell July 14, 2019 00:30
Copy link

@austinabell austinabell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D as discussed in person we should look into integrating these routes into the evm SDK module in the future

@ansermino ansermino merged commit 284c2a0 into development Jul 15, 2019
@ansermino ansermino deleted the david/rpc-refactor branch July 15, 2019 14:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants