Skip to content

Commit e16dec6

Browse files
committed
Initial commit
1 parent 1bd0490 commit e16dec6

File tree

7 files changed

+1308
-0
lines changed

7 files changed

+1308
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea/

README.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# withdrawer
2+
3+
Golang utility for proving and finalizing withdrawals from op-stack chains.
4+
5+
### Usage
6+
7+
Install:
8+
```
9+
go install github.com/base-org/withdrawer@latest
10+
```
11+
12+
Initiate a withdrawal on L2 by sending to the `L2StandardBridge` contract at `0x4200000000000000000000000000000000000010`, and note the tx hash.
13+
Example on Base Goerli: [0xc4055dcb2e4647c37166caba8c7392625c2b62f9117a8bc4d96270da24b38f13](https://goerli.basescan.org/tx/0xc4055dcb2e4647c37166caba8c7392625c2b62f9117a8bc4d96270da24b38f13).
14+
15+
Prove your withdrawal:
16+
```
17+
withdrawer --network base-mainnet --withdrawal <withdrawal tx hash> --rpc <L1 RPC URL> --private-key <L1 private key>
18+
```
19+
or use a ledger:
20+
```
21+
withdrawer --network base-mainnet --withdrawal <withdrawal tx hash> --rpc <L1 RPC URL> --ledger
22+
```
23+
24+
Example output:
25+
```
26+
Proved withdrawal for 0xc4055dcb2e4647c37166caba8c7392625c2b62f9117a8bc4d96270da24b38f13: 0x6b6d1cc45b6601a30646847f638847feb629221ee71bbe6a3de7e6d0fbfe8fad
27+
waiting for tx confirmation
28+
0x6b6d1cc45b6601a30646847f638847feb629221ee71bbe6a3de7e6d0fbfe8fad confirmed
29+
```
30+
31+
After the finalization period, finalize your withdrawal (same command as above):
32+
```
33+
withdrawer --network base-mainnet --withdrawal <withdrawal tx hash> --rpc <L1 RPC URL> --private-key <L1 private key>
34+
```
35+
36+
Example output:
37+
```
38+
Completed withdrawal for 0xc4055dcb2e4647c37166caba8c7392625c2b62f9117a8bc4d96270da24b38f13: 0x1c457f1992f48f1f959ceaee5b3c7e699a26f6f05d93997d49dafe703fd66dea
39+
waiting for tx confirmation
40+
0x1c457f1992f48f1f959ceaee5b3c7e699a26f6f05d93997d49dafe703fd66dea confirmed
41+
```
42+
43+
### Flags
44+
45+
```
46+
Usage of withdrawer:
47+
-rpc string
48+
Ethereum L1 RPC url
49+
-network string
50+
op-stack network to withdraw.go from (one of: base-mainnet, base-goerli, op-mainnet, op-goerli) (default "base-mainnet")
51+
-withdrawal string
52+
TX hash of the L2 withdrawal transaction
53+
-private-key string
54+
Private key to use for signing transactions
55+
-mnemonic string
56+
Mnemonic to use for signing transactions
57+
-ledger
58+
Use ledger device for signing transactions
59+
-hd-path string
60+
Hierarchical deterministic derivation path for mnemonic or ledger (default "m/44'/60'/0'/0/0")
61+
-l2-rpc string
62+
Custom network L2 RPC url
63+
-l2oo-address string
64+
Custom network L2OutputOracle address
65+
-portal-address string
66+
Custom network OptimismPortal address
67+
```

go.mod

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
module github.com/base-org/withdrawer
2+
3+
go 1.20
4+
5+
require (
6+
github.com/decred/dcrd/hdkeychain/v3 v3.1.1
7+
github.com/ethereum-optimism/optimism v1.0.10-0.20230614200546-a541c8a859d9
8+
github.com/ethereum/go-ethereum v1.11.6
9+
github.com/tyler-smith/go-bip39 v1.1.0
10+
)
11+
12+
require (
13+
github.com/DataDog/zstd v1.5.2 // indirect
14+
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
15+
github.com/beorn7/perks v1.0.1 // indirect
16+
github.com/btcsuite/btcd v0.23.3 // indirect
17+
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
18+
github.com/btcsuite/btcd/btcutil v1.1.0 // indirect
19+
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
21+
github.com/cockroachdb/errors v1.9.1 // indirect
22+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
23+
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
24+
github.com/cockroachdb/redact v1.1.3 // indirect
25+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
26+
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
27+
github.com/decred/base58 v1.0.5 // indirect
28+
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
29+
github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect
30+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
31+
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 // indirect
32+
github.com/fsnotify/fsnotify v1.6.0 // indirect
33+
github.com/getsentry/sentry-go v0.18.0 // indirect
34+
github.com/go-ole/go-ole v1.2.6 // indirect
35+
github.com/go-stack/stack v1.8.1 // indirect
36+
github.com/gofrs/flock v0.8.1 // indirect
37+
github.com/gogo/protobuf v1.3.2 // indirect
38+
github.com/golang/protobuf v1.5.2 // indirect
39+
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
40+
github.com/google/uuid v1.3.0 // indirect
41+
github.com/gorilla/websocket v1.5.0 // indirect
42+
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
43+
github.com/huin/goupnp v1.1.0 // indirect
44+
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
45+
github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c // indirect
46+
github.com/klauspost/compress v1.15.15 // indirect
47+
github.com/kr/pretty v0.3.1 // indirect
48+
github.com/kr/text v0.2.0 // indirect
49+
github.com/mattn/go-runewidth v0.0.14 // indirect
50+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
51+
github.com/olekukonko/tablewriter v0.0.5 // indirect
52+
github.com/onsi/gomega v1.26.0 // indirect
53+
github.com/pkg/errors v0.9.1 // indirect
54+
github.com/prometheus/client_golang v1.14.0 // indirect
55+
github.com/prometheus/client_model v0.3.0 // indirect
56+
github.com/prometheus/common v0.39.0 // indirect
57+
github.com/prometheus/procfs v0.9.0 // indirect
58+
github.com/rivo/uniseg v0.4.3 // indirect
59+
github.com/rogpeppe/go-internal v1.9.0 // indirect
60+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
61+
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
62+
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
63+
github.com/tklauser/go-sysconf v0.3.10 // indirect
64+
github.com/tklauser/numcpus v0.5.0 // indirect
65+
github.com/urfave/cli v1.22.9 // indirect
66+
github.com/yusufpapurcu/wmi v1.2.2 // indirect
67+
golang.org/x/crypto v0.6.0 // indirect
68+
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect
69+
golang.org/x/sync v0.1.0 // indirect
70+
golang.org/x/sys v0.6.0 // indirect
71+
golang.org/x/text v0.8.0 // indirect
72+
google.golang.org/protobuf v1.28.1 // indirect
73+
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
74+
)
75+
76+
replace github.com/ethereum/go-ethereum v1.11.6 => github.com/ethereum-optimism/op-geth v1.101106.0-rc.3

0 commit comments

Comments
 (0)