-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheth-node
executable file
·121 lines (104 loc) · 4.56 KB
/
eth-node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
GETH_PORT=8545
GETH_NATIVE_TRACER_PORT=8888
NETWORK_ID=1337
TRANSEPTOR_ENTRYPOINT_ADDRESS_V7=""
TRANSEPTOR_BENEFICIARY="0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
DEV_MNEMONIC="test test test test test test test test test test test junk"
start_geth() {
# first 3 accounts default hardhat accounts
DEFAULT_ADDRESS_1="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" # bundler signer
DEFAULT_ADDRESS_2="0x70997970C51812dc3A010C7d01b50e0d17dc79C8" # local e2e runner
DEFAULT_ADDRESS_3="0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" # bundler beneficiary
if docker ps -a | grep -q geth-transeptor; then
echo -e "Removing existing geth container\n"
docker rm -f geth-transeptor
fi
echo -e "Starting local geth node at http://localhost:$GETH_PORT on network $NETWORK_ID\n"
geth_container_id=$(docker run -d --name geth-transeptor -p $GETH_PORT:$GETH_PORT ethereum/client-go:v1.14.5 \
--verbosity 1 \
--http.vhosts '*,localhost,host.docker.internal'\
--http \
--http.port $GETH_PORT \
--http.api eth,net,web3,debug \
--http.corsdomain '*' \
--http.addr "0.0.0.0" \
--networkid $NETWORK_ID \
--dev \
--dev.period 0 \
--maxpeers 0 \
--nodiscover \
--allow-insecure-unlock \
--rpc.allow-unprotected-txs \
--dev.gaslimit 12000000 )
sleep 4
echo -e "Account balances(Defaults):"
for ACCOUNT in $DEFAULT_ADDRESS_1 $DEFAULT_ADDRESS_2 $DEFAULT_ADDRESS_3; do
isSigner=" (Default account)"
if [ "$ACCOUNT" == "$DEFAULT_ADDRESS_1" ]; then
isSigner=" (Bundler signer account)"
fi
docker exec $geth_container_id geth \
--exec "eth.sendTransaction({from: eth.accounts[0], to: \"$ACCOUNT\", value: web3.toWei(4337, \"ether\")})" \
attach http://localhost:$GETH_PORT/ > /dev/null
balance=$(docker exec $geth_container_id geth --exec "eth.getBalance(\"$ACCOUNT\")" attach http://localhost:$GETH_PORT/)
echo -e " - $ACCOUNT$isSigner: $balance wei"
done
echo -e "\n"
echo -e "ERC 4337 contracts:"
cd ./contracts
forge build
OUTPUT=$(forge script ./scripts/DeployBundlerDev.s.sol --rpc-url http://localhost:$GETH_PORT --broadcast)
TRANSEPTOR_ENTRYPOINT_ADDRESS_V7=$(echo "$OUTPUT" | grep -o "EntryPoint: 0x[0-9a-fA-F]*" | cut -d' ' -f2)
TRANSEPTOR_E2E_SIMPLE_ACCOUNT_FACTORY=$(echo "$OUTPUT" | grep -o "SimpleAccountFactory: 0x[0-9a-fA-F]*" | cut -d' ' -f2)
TRANSEPTOR_E2E_GLOBAL_COUNTER=$(echo "$OUTPUT" | grep -o "GlobalCounter: 0x[0-9a-fA-F]*" | cut -d' ' -f2)
echo -e "$(tput setaf 4)▼▼▼ $(tput setaf 7)Please add to local .env$(tput setaf 4) ▼▼▼$(tput sgr0)\n
TRANSEPTOR_MNEMONIC=$DEV_MNEMONIC
TRANSEPTOR_ENTRYPOINT_ADDRESS=$TRANSEPTOR_ENTRYPOINT_ADDRESS_V7
TRANSEPTOR_BENEFICIARY=$TRANSEPTOR_BENEFICIARY\n
TRANSEPTOR_E2E_SIMPLE_ACCOUNT_FACTORY=$TRANSEPTOR_E2E_SIMPLE_ACCOUNT_FACTORY
TRANSEPTOR_E2E_GLOBAL_COUNTER=$TRANSEPTOR_E2E_GLOBAL_COUNTER
TRANSEPTOR_E2E_TRANSEPTOR_MNEMONIC=$DEV_MNEMONIC
TRANSEPTOR_E2E_CHAIN_ID=$NETWORK_ID
TRANSEPTOR_E2E_NETWORK_PROVIDER_URL=http://localhost:$GETH_PORT
TRANSEPTOR_E2E_BUNDLER_URL=http://localhost:4337/rpc
TRANSEPTOR_E2E_MIN_SENDER_DEPOSIT=2
$(tput setaf 6)────────────────────────────────────────────────────────$(tput sgr0)"
}
start_geth_native_tracer() {
if docker ps -a | grep -q geth-native-tracer; then
echo -e "Removing existing geth-native-tracer container\n"
docker rm -f geth-native-tracer
fi
echo -e "Starting local geth-native-tracer node at http://localhost:$GETH_NATIVE_TRACER_PORT on network $NETWORK_ID\n"
geth_native_tracer_container_id=$(docker run -d --name geth-native-tracer -p $GETH_NATIVE_TRACER_PORT:$GETH_NATIVE_TRACER_PORT accountabstraction/geth-native-tracer \
--verbosity 1 \
--http.vhosts '*,localhost,host.docker.internal' \
--http \
--http.port $GETH_NATIVE_TRACER_PORT \
--http.api eth,net,web3,debug \
--http.corsdomain '*' \
--http.addr "0.0.0.0" \
--networkid $NETWORK_ID \
--dev \
--dev.period 0 \
--allow-insecure-unlock \
--rpc.allow-unprotected-txs \
--dev.gaslimit 20000000)
sleep 3
}
stop_all() {
docker stop $geth_container_id > /dev/null
docker rm $geth_container_id > /dev/null
docker stop $geth_native_tracer_container_id > /dev/null
docker rm $geth_native_tracer_container_id > /dev/null
exit 0
}
# Start geth and geth-native-tracer
start_geth_native_tracer
start_geth
trap stop_all SIGINT
echo -e "Press Ctrl+C to stop the local geth node and geth-native-tracer."
while true; do
sleep 1
done