# Running a node

#### Hardware Requirements <a href="#hardware-requirements" id="hardware-requirements"></a>

The following are the minimum hardware requirements:

* CPU with 2+ cores
* 4GB RAM
* 200GB free storage space
* 8 MBit/sec download Internet service

#### 1. Building Gmeme Binary <a href="#id-1.-building-gmeme-binary" id="id-1.-building-gmeme-binary"></a>

**Build the source**

Get memecore-gmeme source.Running a node

```
https://github.com/memecore-foundation/Go-MemeCore
```

Building `gmeme` requires both a Go (version 1.19 or later) and a C compiler. Feel free to install them with the package manager of your choice.

Once the dependencies are installed, run

```
make gmeme
```

or, build the full suite of utilities:

```
make all
```

#### 2. Starting a MEME Node: <a href="#id-2.-starting-a-meme-node" id="id-2.-starting-a-meme-node"></a>

**Mainnet:**

```
./build/bin/gmeme --datadir ./nodes/node1
```

**Formicarium Testnet:**

```
./build/bin/gmeme --formicarium --datadir ./nodes/node1
```

**Common Additional Parameters:**

* `--http` - Enable the HTTP-RPC server
* `--http.api` - APIs offered over the HTTP-RPC interface (e.g., eth,net,web3)
* `--http.addr` - HTTP-RPC server listening interface (default: "localhost")
* `--http.port` - HTTP-RPC server listening port (default: 8545)
* `--ws` - Enable the WS-RPC server
* `--ws.port` - WS-RPC server listening port (default: 8546)

#### 3. Initializing Node Account <a href="#id-3.-initializing-node-account" id="id-3.-initializing-node-account"></a>

You can create a new account or import an existing account for your node operation, if you need. **RPC nodes don't need node account.**

**Create a new account**

Create your node account with the following command. A password is required to be entered during the process. The resulting account is placed in the specified `--datadir` under the `keystore` path.

```
./gmeme --datadir ./nodes/node1 account new
```

**Import your existing account**

Import your existing account with the private key and remember to replace the `./your/privateKey.txt` parameter.

```
./gmeme account import --datadir ./nodes/node1 ./your/privateKey.txt
```

#### 4. Running RPC Node <a href="#id-4.-running-rpc-node" id="id-4.-running-rpc-node"></a>

A RPC node is a network member that does not participate in the consensus process. This node can be used to interact with the MemeCore Network, including: creating accounts, transferring funds, deploying and interacting with contracts, and querying node APIs.

You may need to change the `P2P/HTTP/RPC/WS` ports to avoid conflicts. Please note that the port configuration for the JSON-RPC interface should be set to httpport, not rpcport. You can refer to <https://geth.ethereum.org/docs/fundamentals/command-line-options> for more details about start options.

***Note: gmeme is backwards compatible with geth. For any information not covered in gmeme documentation, you can refer to geth documentation.***

This script expects node DB directory to be `./node/node1`.

**Mainnet:**

```
./build/bin/gmeme \
	--syncmode=full \
	--gcmode archive \
	--datadir ./nodes/node1 \
	--port 30303 \
	--http.api eth,net,web3 \
	--http \
	--http.port 8545 \
	--http.addr 0.0.0.0 \
	--http.vhosts "*" \
	--ws \
	--ws.port 8546 \
	--ws.addr 0.0.0.0 \
	--ws.api eth,net,web3
```

**Formicarium Testnet:**

```
./build/bin/gmeme \
	--formicarium \
	--syncmode=full \
	--gcmode archive \
	--datadir ./nodes/node1 \
	--port 30303 \
	--http.api eth,net,web3 \
	--http \
	--http.port 8545 \
	--http.addr 0.0.0.0 \
	--http.vhosts "*" \
	--ws \
	--ws.port 8546 \
	--ws.addr 0.0.0.0 \
	--ws.api eth,net,web3
```

***Note: To run on the Formicarium Testnet, simply add the --formicarium flag when executing gmeme. For mainnet, run it without this flag.***

#### 5. Running Validator Node <a href="#id-5.-running-validator-node" id="id-5.-running-validator-node"></a>

A validator node participates in the PoSA consensus. If you want to register as a candidate for PoSA validators, you need to run a miner node.

You may need to change the `P2P/HTTP/RPC/WS` ports to avoid conflicts. Please note that the port configuration for the JSON-RPC interface should be set to httpport, not rpcport. You can refer to <https://geth.ethereum.org/docs/fundamentals/command-line-options> for more details about start options.

This script expects node DB directory to be `./node/node1`.

**Mainnet:**

Copy

```
./build/bin/gmeme \
	--syncmode=full \
	--gcmode archive \
	--datadir ./nodes/node1 \
	--port 30303 \
	--http.api eth,net,web3 \
	--http \
	--http.port 8545 \
	--http.addr 127.0.0.1 \
	--http.vhosts "*" \
	--ws \
	--ws.port 8546 \
	--ws.addr 127.0.0.1 \
	--ws.api eth,net,web3 \
	--mine \
	--miner.etherbase=<Your Validator Account Address> \
	--unlock <Your Validator Account Address> \
	--password <Your Validator Account Password File>
```

**Formicarium Testnet:**

Copy

```
./build/bin/gmeme \
	--formicarium \
	--syncmode=full \
	--gcmode archive \
	--datadir ./nodes/node1 \
	--port 30303 \
	--http.api eth,net,web3 \
	--http \
	--http.port 8545 \
	--http.addr 127.0.0.1 \
	--http.vhosts "*" \
	--ws \
	--ws.port 8546 \
	--ws.addr 127.0.0.1 \
	--ws.api eth,net,web3 \
	--mine \
	--miner.etherbase=<Your Validator Account Address> \
	--unlock <Your Validator Account Address> \
	--password <Your Validator Account Password File>
```

After launch geth client, you need to register your validator account to our system contract (`0x1234000000000000000000000000000000000002`) with 7,000,000 M. (**Validator registering is locked yet**.)

*<mark style="color:red;">**NOTE: The description of the password file is only an example, and you should use other technical methods to manage it securely.**</mark>*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.memecore.com/guides/consensus/running-a-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
