2021-08-11 12:51:18 +00:00
<!--
order: 1
-->
# Running the Server
Learn how to run and setup the JSON-RPC server on Ethermint. {synopsis}
## Enable Server
To enable RPC server use the following flag (set to true by default).
```bash
2021-08-16 09:45:10 +00:00
ethermintd start --json-rpc.enable
2021-08-11 12:51:18 +00:00
```
## Defining Namespaces
2021-08-16 09:45:10 +00:00
`Eth` ,`Net` and `Web3` [namespaces ](./namespaces ) are enabled by default. In order to enable other namespaces use flag `--json-rpc.api` .
2021-08-11 12:51:18 +00:00
```bash
2021-08-16 09:45:10 +00:00
ethermintd start --json-rpc.api eth,txpool,personal,net,debug,web3,miner
2021-08-11 12:51:18 +00:00
```
2021-08-18 14:11:51 +00:00
## Set a Gas Cap
`eth_call` and `eth_estimateGas` define a global gas cap over rpc for DoS protection. You can override the default gas cap value of 25,000,000 by passing a custom value when starting the node:
```bash
# set gas cap to 85M
ethermintd start --json-rpc.gas-cap 85000000000
# set gas cap to infinite (=0)
ethermintd start --json-rpc.gas-cap 0
```
## CORS
2021-08-11 12:51:18 +00:00
2021-08-20 10:58:03 +00:00
If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail.
2021-08-11 12:51:18 +00:00
2021-08-20 10:58:03 +00:00
The CORS setting can be updated from the `app.toml`
```toml
###############################################################################
### API Configuration ###
###############################################################################
[api]
# ...
# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
enabled-unsafe-cors = true # default false
2021-08-11 12:51:18 +00:00
```