Running a Local GOAT Node
This guide will help you set up and run a local GOAT node for development and testing purposes. Running a local node provides a controlled environment for smart contract development and testing without incurring network costs.
Running a local node is recommended for development and testing before deploying to the GOAT Testnet or Mainnet.
Prerequisites
Before starting, ensure you have the following installed:
- Go (version 1.22 or later)
- Git
- Make (for Unix-based systems) or equivalent build tools
- Docker Desktop (optional, for containerized deployment)
System Requirements
Minimum Requirements
- CPU with 2+ cores
- 8GB RAM
- 100GB free disk space
- 8 MBit/sec internet connection
Recommended Requirements
- CPU with 4+ cores
- 16GB+ RAM
- High-performance SSD with at least 1TB free space
- 25+ MBit/sec internet connection
Installation Steps
- Clone the GOAT-GETH repository:
git clone https://github.com/goat-network/go-ethereum.git
cd go-ethereum
- Build the GOAT node:
make geth
For all utilities:
make all
Running a Local Development Node
Method 1: Direct Execution
Start a local node with development settings:
geth --dev --http --http.api eth,net,web3,debug --http.corsdomain "*" --http.addr 0.0.0.0 --http.port 8545
Method 2: Docker Deployment
docker run -d --name goat-node \
-v ${HOME}/goat-node:/root \
-p 8545:8545 -p 30303:30303 \
goat-network/client-go \
--dev --http --http.api eth,net,web3,debug \
--http.corsdomain "*" --http.addr 0.0.0.0
The above configuration enables all HTTP-RPC APIs and CORS for development. Adjust security settings appropriately for production environments.
Configuring Your Development Environment
Network Configuration
Your local node will use these default development settings:
const localNetwork = {
name: 'GOAT Local',
chainId: 1337,
network: 'development',
rpc: 'http://localhost:8545'
}
Connecting with MetaMask
- Open MetaMask
- Add a new network with these parameters:
{
"chainId": "0x539", // 1337 in hexadecimal
"chainName": "GOAT Local",
"nativeCurrency": {
"name": "Bitcoin",
"symbol": "BTC",
"decimals": 18
},
"rpcUrls": ["http://localhost:8545"]
}
Testing Smart Contracts
Using ethers.js
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('http://localhost:8545');
const signer = await provider.getSigner();
// Deploy a contract
const Contract = await ethers.getContractFactory("YourContract");
const contract = await Contract.deploy();
await contract.deployed();
console.log("Contract deployed to:", contract.address);
Using Hardhat
- Configure hardhat.config.js:
module.exports = {
networks: {
local: {
url: "http://localhost:8545",
chainId: 1337
}
}
};
- Deploy and test:
npx hardhat run scripts/deploy.js --network local
Moving to Testnet
Once you've tested your contracts locally, you can deploy to the GOAT Testnet:
Parameter | Value |
---|---|
Chain ID | 48815 |
RPC URL | https://rpc.testnet.goat.network |
Explorer | https://explorer.testnet.goat.network |
Remember to acquire testnet BTC from the faucet before deploying to the testnet network.
Common Operations
Check Node Status
geth attach http://localhost:8545
> eth.blockNumber
> eth.syncing
Create New Account
geth account new
Start Mining (Local Development)
geth --dev --mine --miner.threads=1
For additional configuration options and advanced usage, refer to our full documentation (opens in a new tab).