mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
add localnet genesis
This commit is contained in:
parent
3c478d770d
commit
eadb768025
4 changed files with 40 additions and 5 deletions
|
|
@ -1229,9 +1229,9 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setGRCP creates the gRPC RPC listener interface string from the set command
|
// setGRPC creates the gRPC RPC listener interface string from the set command
|
||||||
// line flags, returning empty if the gRPC endpoint is disabled.
|
// line flags, returning empty if the gRPC endpoint is disabled.
|
||||||
func setGRCP(ctx *cli.Context, cfg *node.Config) {
|
func setGRPC(ctx *cli.Context, cfg *node.Config) {
|
||||||
if ctx.Bool(GRPCEnabledFlag.Name) {
|
if ctx.Bool(GRPCEnabledFlag.Name) {
|
||||||
if ctx.IsSet(GRPCHostFlag.Name) {
|
if ctx.IsSet(GRPCHostFlag.Name) {
|
||||||
cfg.GRPCHost = ctx.String(GRPCHostFlag.Name)
|
cfg.GRPCHost = ctx.String(GRPCHostFlag.Name)
|
||||||
|
|
@ -1491,7 +1491,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
||||||
SetP2PConfig(ctx, &cfg.P2P)
|
SetP2PConfig(ctx, &cfg.P2P)
|
||||||
setIPC(ctx, cfg)
|
setIPC(ctx, cfg)
|
||||||
setHTTP(ctx, cfg)
|
setHTTP(ctx, cfg)
|
||||||
setGRCP(ctx, cfg)
|
setGRPC(ctx, cfg)
|
||||||
setGraphQL(ctx, cfg)
|
setGraphQL(ctx, cfg)
|
||||||
setWS(ctx, cfg)
|
setWS(ctx, cfg)
|
||||||
setNodeUserIdent(ctx, cfg)
|
setNodeUserIdent(ctx, cfg)
|
||||||
|
|
|
||||||
21
genesis.json
Normal file
21
genesis.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"chainId": 1337,
|
||||||
|
"homesteadBlock": 0,
|
||||||
|
"eip150Block": 0,
|
||||||
|
"eip155Block": 0,
|
||||||
|
"eip158Block": 0,
|
||||||
|
"byzantiumBlock": 0,
|
||||||
|
"constantinopleBlock": 0,
|
||||||
|
"petersburgBlock": 0,
|
||||||
|
"istanbulBlock": 0,
|
||||||
|
"berlinBlock": 0,
|
||||||
|
"londonBlock": 0,
|
||||||
|
"ethash": {}
|
||||||
|
},
|
||||||
|
"difficulty": "10000",
|
||||||
|
"gasLimit": "8000000",
|
||||||
|
"alloc": {
|
||||||
|
"0x46B77EFDFB20979E1C29ec98DcE73e3eCbF64102": { "balance": "300000000000000000000" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -533,7 +533,7 @@ func (n *Node) stopRPC() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) startGRPC() error {
|
func (n *Node) startGRPC() error {
|
||||||
if n.config.GRPCHost != "" {
|
if n.grpcServerHandler != nil {
|
||||||
// start the server
|
// start the server
|
||||||
if err := n.grpcServerHandler.Start(); err != nil {
|
if err := n.grpcServerHandler.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -544,7 +544,9 @@ func (n *Node) startGRPC() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) stopGRPC() {
|
func (n *Node) stopGRPC() {
|
||||||
n.grpcServerHandler.Stop()
|
if n.grpcServerHandler != nil {
|
||||||
|
n.grpcServerHandler.Stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// startInProc registers all RPC APIs on the inproc server.
|
// startInProc registers all RPC APIs on the inproc server.
|
||||||
|
|
|
||||||
12
private_network.md
Normal file
12
private_network.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# private network
|
||||||
|
|
||||||
|
1. Make a new account in Metamask (or whichever method you prefer). Copy paste the address into `genesis.json`'s `alloc` field. This account will be allocated 300 ETH at startup.
|
||||||
|
|
||||||
|
2. Replace the etherbase in the following with your account (it doesn't really matter though, since mining doesn't require signing). Then, run:
|
||||||
|
```bash
|
||||||
|
make geth
|
||||||
|
./build/bin/geth --datadir ~/.astriageth/ init genesis.json
|
||||||
|
./build/bin/geth --datadir ~/.astriageth/ --http --http.port=8545 --ws --ws.port=8545 --networkid=1337 --http.corsdomain='*' --ws.origins='*' --mine --miner.threads 1 --miner.etherbase=0xDB8c0F738639Da247bC67251548a186b2107bf4d
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Open up Metamask and go to the Localhost 8545 network. You should see your account has 300 ETH. You can now transfer this to other accounts.
|
||||||
Loading…
Reference in a new issue