Repository navigation
Expand file tree
/
Copy pathinstall-ubuntu.sh
More file actions
executable file
·149 lines (122 loc) · 7.38 KB
/
Copy pathinstall-ubuntu.sh
File metadata and controls
executable file
·149 lines (122 loc) · 7.38 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh
# # Set the SHELL to bash with pipefail option
# SHELL ["/bin/bash", "-o", "pipefail", "-c"]
### Installation
# nodejs
sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
# updating system
sudo apt-get update && sudo apt-get install nodejs -y
# insatlling sudo git, curl, jq, make
sudo apt install sudo
sudo apt install -y git curl make jq wget bash direnv docker.io
sudo apt install docker-compose-v2 docker-buildx -y
sudo gpasswd -a $USER docker
# installing Go
GOVERSION=1.21.3
wget -L https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz -O - | tar xz
sudo rm -rf /usr/local/go /usr/local/bin/go
sudo mv go /usr/local/
sudo ln -s /usr/local/go/bin/go /usr/local/bin/
echo export GOROOT=/usr/local/go >> ~/.bashrc
sudo su - -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
#installing docker-compose
wget -L https://github.com/docker/compose/archive/refs/tags/v2.23.0.tar.gz -O -| tar xz
cd compose-2.* && make && make build && sudo make install
# RUN source ~/.bashrc
# installing foundry
echo export PATH=${PATH}:/home/$USER/.foundry/bin >> ~/.bashrc
export PATH="${PATH}:${HOME}/.foundry/bin"
cd && bash -c "curl -L https://foundry.paradigm.xyz | bash"
foundryup
# installing yarn and pnpm
# ### Build the Optimism Monorepo
cd && git clone --recurse-submodules https://github.com/ethereum-optimism/optimism.git
cd optimism
sudo npx npm i -g npm@10.2.1
sudo npx npm i -g pnpm yarn
npx pnpm install && npx pnpm build
make op-node op-batcher op-proposer
make build
# Once finished, run `docker run -ti --rm softsky/op-l2:latest`, then from inside the container run `make devnet-up`
cd
# ### Build op-geth
git clone https://github.com/ethereum-optimism/op-geth.git
cd op-geth
npx pnpm install geth
make geth
# ### Generate some keys
# # You’ll need four accounts and their private keys when setting up the chain:
# ############################################################################################
# # The Admin account which has the ability to upgrade contracts. #
# # The Batcher account which publishes Sequencer transaction data to L1. #
# # The Proposer account which publishes L2 transaction results to L1. #
# # The Sequencer account which signs blocks on the p2p network. #
# # You can generate all of these keys with the rekey tool in the contracts-bedrock package. #
# ############################################################################################
cd && cd optimism/packages/contracts-bedrock && echo "Admin:" \
cast wallet new \
echo "Proposer:" \
cast wallet new \
echo "Batcher:" \
cast wallet new \
echo "Sequencer:" \
cast wallet new
# ###################################################################################
# # Admin: #
# # Successfully created new keypair. #
# # Address: 0x9f92bdF0db69264462FC305913960Edfcc7a7c7F #
# # Private key: 0x30e66956e1a12b81f0f2cfb982286b2f566eb73649833831d9f80b12f8fa183c #
# # Proposer: #
# # Successfully created new keypair. #
# # Address: 0x31dE9B6473fc47af36ec23878bA34824B9F4AB30 #
# # Private key: 0x8bd1c8dfffef880f8f9ab8162f97ccd119c1aac28fe00dacf919459f88e0f37d #
# # Batcher: #
# # Successfully created new keypair. #
# # Address: 0x6A3DC843843139f17Fcf04C057bb536A421DC9c6 #
# # Private key: 0x3ce44144b7fde797a28f4e47b210a4d42c3a3b642e538b54458cba2740db5ac2 #
# # Sequencer: #
# # Successfully created new keypair. #
# # Address: 0x98C6cadB1fe77aBB7bD968fC3E9b206111e72848 #
# # Private key: 0x3f4241229bb6f155140d98e0f5dd2aad7ae983f5af5d61555d05eb8e5d9514db #
# ###################################################################################
# ### Configure your network
# # Once you’ve built both repositories, you’ll need to head back to the Optimism Monorepo to set up the configuration for your chain. Currently, chain configuration lives inside of the contracts-bedrock (opens new window)package.
# # Enter the Optimism Monorepo:
cd $HOME/optimism/packages/contracts-bedrock && cp .envrc.example .envrc && direnv allow .
# Fill out the environment variables inside of that file:
# ETH_RPC_URL — URL for your L1 node.
# PRIVATE_KEY — Private key of the Admin account.
# DEPLOYMENT_CONTEXT - Name of the network, should be "getting-started"
# Pull the environment variables into context using direnv
# If you need to install direnv, make sure you also modify the shell configuration (opens new window).
# Before we can create our configuration file, we’ll need to pick an L1 block to serve as the starting point for our Rollup. It’s best to use a finalized L1 block as our starting block. You can use the cast command provided by Foundry to grab all of the necessary information:
export ETH_RPC_URL="${ETH_RPC_URL}"
export DEPLOYMENT_CONTEXT="${DEPLOYMENT_CONTEXT}"
export TENDERLY_PROJECT="${TENDERLY_PROJECT}"
export TENDERLY_USERNAME="${TENDERLY_USERNAME}"
export ETHERSCAN_API_KEY="${ETHERSCAN_API_KEY}"
export ETHERSCAN_API_KEY="${ETHERSCAN_API_KEY}"
cast block finalized --rpc-url $ETH_RPC_URL | grep -E "(timestamp|hash|number)"
# You’ll get back something that looks like the following:
# hash 0x784d8e7f0e90969e375c7d12dac7a3df6879450d41b4cb04d4f8f209ff0c4cd9
# number 8482289
# timestamp 1676253324
# Fill out the remainder of the pre-populated config file found at deploy-config/getting-started.json (opens new window). Use the default values in the config file and make following modifications:
# Replace "ADMIN" with the address of the Admin account you generated earlier.
# Replace "PROPOSER" with the address of the Proposer account you generated earlier.
# Replace "BATCHER" with the address of the Batcher account you generated earlier.
# Replace "SEQUENCER" with the address of the Sequencer account you generated earlier.
# Replace "BLOCKHASH" with the blockhash you got from the cast command.
# Replace TIMESTAMP with the timestamp you got from the cast command. Note that although all the other fields are strings, this field is a number! Don’t include the quotation marks
cd ~/optimism
wget -c https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.13.4-3f907d6a.tar.gz -O - | tar xz
sudo mv geth-linux-amd64-1.13.4-3f907d6a/geth /usr/local/bin
rm -rf geth-linux-amd64-1.13.4-3f907d6a
npx nx reset
make build
echo "################################################################################"
echo "# You should log off your shell and login again to apply environmental changes #"
echo "################################################################################"