docs: fixes (#449)

* docs: fixes

* link fixes

* fix

* space
This commit is contained in:
Federico Kunze Küllmer 2021-08-17 13:29:37 -04:00 committed by GitHub
parent 6f5f15fc6d
commit b8fc58a75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 18 deletions

View File

@ -102,7 +102,7 @@ module.exports = {
{
title: 'JSON-RPC',
directory: true,
path: '/api/JSON-RPC'
path: '/api/json-rpc'
},
{
title: 'Protobuf Reference',
@ -141,7 +141,7 @@ module.exports = {
},
{
title: 'JSON-RPC API Reference',
path: '/api/JSON-RPC/endpoints'
path: '/api/json-rpc/endpoints'
}
]
}

View File

@ -1,12 +1,12 @@
<!--
order: false
parent:
order: 5
order: 1
-->
# API
This section contains different client and API reference document.
1. [JSON-RPC](./JSON-RPC)
1. [JSON-RPC](./json-rpc)
1. [Protobuf Docs](./proto-docs)

View File

@ -74,7 +74,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],
{"jsonrpc":"2.0","id":1,"result":"0x3503de5f0c766c68f78a03a3b05036a5"}
```
Then you can check if the state chages with the [`eth_getFilterChanges`](https://eth.wiki/json-rpc/API#eth_getfilterchanges) call:
Then you can check if the state changes with the [`eth_getFilterChanges`](https://eth.wiki/json-rpc/API#eth_getfilterchanges) call:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3503de5f0c766c68f78a03a3b05036a5"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
@ -109,7 +109,7 @@ Since Ethermint runs uses Tendermint Core as it's consensus Engine and it's buil
SDK framework, it inherits the event format from them. However, in order to support the native Web3
compatibility for websockets of the [Ethereum's
PubSubAPI](https://geth.ethereum.org/docs/rpc/pubsub), Ethermint needs to cast the Tendermint
responses retreived into the Ethereum types.
responses retrieved into the Ethereum types.
You can start a connection with the Ethereum websocket using the `--json-rpc.ws-address` flag when starting
the node (default `"0.0.0.0:8546"`):

View File

@ -4,23 +4,31 @@ order: 2
# Metamask
Connect your Metamask wallet with Ethermint on a localnet mode. {synopsis}
Connect your Metamask wallet with Ethermint. {synopsis}
## Adding a custom Network for Ethermint
One of the main limitations of using the default `Localhost 8545` network is that the tokens will be represented as `ETH`.
Open the Metamask extension on your browser, you may have to log in to your Metamask account if you
are not already. Then click the top right circle and go to `Settings` > `Networks`. Press the `Add
Network` button and fill the form as shown below with your application `ChainID`.
are not already. Then click the top right circle and go to `Settings` > `Networks` > `Add
Network` and fill the form as shown below.
::: tip
To find your full `ChainID`, got your genesis.json file. To get the [EIP155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) chain ID from the Cosmos chain ID, you need to consider only the second number in the string value. For example
if your chain id on ethermint is `"chain_id": "ethermint_9000-1"`, then you will have to use the value `9000` on Metamask.
You can also find the full `ChainID` form the `genesis.json` file. To get the
[EIP155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) chain ID from the Cosmos
chain ID, check the [Chain ID](./../../basics/chain_id) documentation page.
:::
![metamask networks settings](./../img/metamask_network_settings.png)
Here is the list of fields that you can use to paste on Metamask:
- **Network Name**: Ethermint
<!-- TODO: add RPC URL -->
- **New RPC URL**: http://localhost:8545
- **Chain ID**: 9000
- **Currency Symbol (optional)**: PHOTON
- **Block Explorer URL (optional)**:
## Import Account to Metamask
Then close the settings, and go to `My Accounts` (top right circle) and select `Import Account`. You should see and image like the following one:
@ -28,10 +36,10 @@ Then close the settings, and go to `My Accounts` (top right circle) and select `
![metamask import account page](./../img/metamask_import.png)
Now you can export your private key from the terminal using the following command. Again, make sure
to replace `mykey` with the name of the key that you want to export:
to replace `mykey` with the name of the key that you want to export and use the correct `keyring-backend`:
```bash
ethermintd keys unsafe-export-eth-key mykey
ethermintd keys unsafe-export-eth-key mykey --keyring-backend test
```
Go back to the browser and select the `Private Key` option. Then paste the private key exported from
@ -46,4 +54,5 @@ Network` (or any other than `Localhost 8545` or `Ethermint`) and then switch bac
## Downloading State
to see metamask logs, go to top right circle -> settings -> advanced -> download state logs. if you search through the json file for the account address you'll find the tx history
To see your Metamask logs, click the top right circle and go to `Settings` > `Advanced` > `Download State Logs`.
If you search through the JSON file for the account address you'll find the transaction history.

View File

@ -11,6 +11,29 @@ order: 1
## Automated Localnet (script)
You can customize the localtestnet script by changing values for convinience for example:
```bash
# customize the name of your key, the chain-id, moniker of the node, keyring backend, and log level
KEY="mykey"
CHAINID="ethermint_9000-1"
MONIKER="localtestnet"
KEYRING="test"
LOGLEVEL="info"
# Allocate genesis accounts (cosmos formatted addresses)
ethermintd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING
# Sign genesis transaction
ethermintd gentx $KEY 1000000000000000000000aphoton --keyring-backend $KEYRING --chain-id $CHAINID
```
The default configuration will generate a single validator localnet with the chain-id
`ethermint_9000-1` and one predefined account (`mykey`) with some allocated funds at the genesis.
You can start the local chain using:
```bash
init.sh
```

View File

@ -18,10 +18,10 @@ wallets and block explorers to interact with the proof-of-stake logic and native
### Ethereum JSON-RPC server
Ethermint also supports most of the standard web3 [JSON-RPC
APIs](./../api/JSON-RPC/running_server) to connect with existing web3 tooling.
APIs](./../api/json-rpc/running_server) to connect with existing web3 tooling.
::: tip
See the list of supported JSON-RPC API [endpoints](./../api/JSON-RPC/endpoints) and [namespaces](./../api/JSON-RPC/namespaces).
See the list of supported JSON-RPC API [endpoints](./../api/json-rpc/endpoints) and [namespaces](./../api/json-rpc/namespaces).
:::
To connect to the JSON-PRC server, start the node with the `--json-rpc.enable=true` flag and define the namespaces that you would like to run using the `--evm.rpc.api` flag (e.g. `"txpool,eth,web3,net,personal"`. Then, you can point any Ethereum development tooling to `http://localhost:8545` or whatever port you choose with the listen address flag (`--json-rpc.address`).