diff --git a/action.yml b/action.yml index a6e1c53..6464ca6 100644 --- a/action.yml +++ b/action.yml @@ -4,15 +4,27 @@ outputs: rpc_url: description: "url of JSON RPC" value: http://localhost:8546 + address: + description: "account of address" + value: "0x622fbe99b3a378fac736bf29d7e23b85e18816eb" + private_key: + description: "account of private key" + value: "0xde665c1c4bb8a5b74386dd8fb17dd2ba9a59db6cc11aea4d27ebdc5ecf46c13c" + password: + description: "account of passowrd" + value: "password" network_id: description: "network id" - value: "10412" + value: "12345" chain_id: description: "chain id" - value: "10412" + value: "12345" runs: using: "composite" steps: + - id: init + run: cd ${{ github.action_path }}; docker-compose run --rm geth ./scripts/init.sh + shell: bash - id: run run: cd ${{ github.action_path }}; docker-compose up -d shell: bash diff --git a/docker-compose.yml b/docker-compose.yml index 4b55e22..da2c2ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,16 +15,17 @@ version: '3' services: - geth-ethereum-mainnet: + geth: image: ethereum/client-go:v1.10.23 environment: - DEVMODE=true - command: [ "--dev", "--dev.period", "0", - "--http", "--http.api", - "personal,eth,net,web3,debug", - "--http.addr", "0.0.0.0", - "--datadir", "./data", "--http.vhosts=*"] volumes: - - ".docker/geth:/root" + - "./.ethereum:/root/.ethereum" + - "./geth/config:/root/config" + - "./geth/scripts:/root/scripts" + working_dir: /root + entrypoint: sh ports: - "8546:8545" + command: ./scripts/run.sh + diff --git a/geth/config/genesis.json b/geth/config/genesis.json new file mode 100644 index 0000000..34456fc --- /dev/null +++ b/geth/config/genesis.json @@ -0,0 +1,26 @@ +{ + "config": { + "chainId": 12345, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "clique": { + "period": 0, + "epoch": 30000 + } + }, + "difficulty": "1", + "gasLimit": "8000000", + "extradata": "0x00000000000000000000000000000000000000000000000000000000000000004cdbd835fe18bd93cca39a262cff72dbac99e24f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "alloc": { + "622fbe99b3a378fac736bf29d7e23b85e18816eb": { "balance": "888888888888888888888888" }, + "4cdbd835fe18bd93cca39a262cff72dbac99e24f": { "balance": "888888888888888888888888" } + } +} + \ No newline at end of file diff --git a/geth/config/password.txt b/geth/config/password.txt new file mode 100644 index 0000000..7aa311a --- /dev/null +++ b/geth/config/password.txt @@ -0,0 +1 @@ +password \ No newline at end of file diff --git a/geth/config/private-key1.txt b/geth/config/private-key1.txt new file mode 100644 index 0000000..4ea7297 --- /dev/null +++ b/geth/config/private-key1.txt @@ -0,0 +1 @@ +f78955a540221936a4eba0edd96547fc400d44f7f2107be4c7e72f6076a649d1 \ No newline at end of file diff --git a/geth/config/private-key2.txt b/geth/config/private-key2.txt new file mode 100644 index 0000000..05733a1 --- /dev/null +++ b/geth/config/private-key2.txt @@ -0,0 +1 @@ +de665c1c4bb8a5b74386dd8fb17dd2ba9a59db6cc11aea4d27ebdc5ecf46c13c \ No newline at end of file diff --git a/geth/scripts/init.sh b/geth/scripts/init.sh new file mode 100644 index 0000000..1d4dd6b --- /dev/null +++ b/geth/scripts/init.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eu + +geth init /root/config/genesis.json +geth --password /root/config/password.txt account import /root/config/private-key1.txt +geth --password /root/config/password.txt account import /root/config/private-key2.txt + diff --git a/geth/scripts/run.sh b/geth/scripts/run.sh new file mode 100644 index 0000000..b429b03 --- /dev/null +++ b/geth/scripts/run.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -eu + +geth \ + --verbosity 5 \ + --nodiscover \ + --syncmode 'full' \ + --nat none \ + --port 30310 \ + --http \ + --http.addr '0.0.0.0' \ + --http.port 8545 \ + --http.vhosts '*' \ + --http.api 'personal,eth,net,web3,txpool,miner,debug' \ + --networkid '12345' \ + --mine \ + --miner.etherbase '0x4cdBd835fE18BD93ccA39A262Cff72dbAC99E24F' \ + --miner.gasprice 0 \ + --unlock "0,1" \ + --password /root/config/password.txt \ + --allow-insecure-unlock