# Contributing to the KZG Ceremony using an air-gapped machine
__🚨🚨Steps 0 and 1 should be done well ahead of your contribution slot🚨🚨__
This document will guide you through the process of contributing to the KZG Ceremony using Ignacio Hagopian's [go-kzg-ceremony-client](https://github.com/jsign/go-kzg-ceremony-client) on an air-gapped computer.
## Step 0: Check your slot has been scheduled correctly for your address:
Verify that your Ethereum address that you will use to contribute is included in the scheduled slots and that the date (in UTC - convert to your timezone [here](https://savvytime.com/converter/utc)) is correct:
```json
[{"address":"0xcab81f14a3fc98034a05bab30f8d0e53e978c833","nonce":"0x4000","start_time":"2023-04-14T12:00:00Z","end_time":"2023-04-14T16:00:00Z"},
{"address":"0x32262672c6d1b814019f4ca4e2fc53285a919704","nonce":"0x4000","start_time":"2023-04-14T12:00:00Z","end_time":"2023-04-14T16:00:00Z"},
{"address":"0x051f77131b0ea6d149608021E06c7206317782CC","nonce":"0x4000","start_time":"2023-04-09T08:00:00Z","end_time":"2023-04-09T12:00:00Z"},
{"address":"0xea7c60bA79508855DC3C869DAE5b407e6F9fc307","nonce":"0x4000","start_time":"2023-04-09T08:00:00Z","end_time":"2023-04-09T12:00:00Z"},
{"address":"0xFF141bFc450c57Ad84eBaFbD09ffa94A268a7aaE","nonce":"0x4000","start_time":"2023-04-06T16:00:00Z","end_time":"2023-04-06T20:00:00Z"},
{"address":"0x3C68Fdf52b957ce66B61d242cEAaBdE501b924A3","nonce":"0x4000","start_time":"2023-04-06T16:00:00Z","end_time":"2023-04-06T20:00:00Z"},
{"address":"0xDF369Cde73CE4d75DEBA0d9A6F67873Ea9350B9B","nonce":"0x4000","start_time":"2023-04-16T20:00:00Z","end_time":"2023-04-17T00:00:00Z"},
{"address":"0x3D1A26c2a4805EC90C0839e82FEa4aB48F6ABEe9","nonce":"0x4000","start_time":"2023-04-16T20:00:00Z","end_time":"2023-04-17T00:00:00Z"},
{"address":"0x8dD4e78567201d1d9F8459a265F4d0ae81ae3C83","nonce":"0x4000","start_time":"2023-04-14T16:00:00Z","end_time":"2023-04-14T20:00:00Z"},
{"address":"0x67db07616AFabA04BBe74742cc14285D9B32cBA5","nonce":"0x4000","start_time":"2023-04-14T16:00:00Z","end_time":"2023-04-14T20:00:00Z"},
{"address":"0x084Bd02D4dfb5Af7F9D487a60682378B057d36Bb","nonce":"0x4000","start_time":"2023-04-12T16:00:00Z","end_time":"2023-04-12T20:00:00Z"},
{"address":"0x2aFcceCB86504de8023DeF0Cac5A7fBc240830bB","nonce":"0x4000","start_time":"2023-04-12T16:00:00Z","end_time":"2023-04-12T20:00:00Z"},
{"address":"0x543cbBD2bf6f6eC71254E75b7FEAbb222B143343","nonce":"0x4000","start_time":"2023-04-15T08:00:00Z","end_time":"2023-04-15T12:00:00Z"},
{"address":"0xDB08c59302e8449fb5f2F6CCf7DDE974E678A31f","nonce":"0x4000","start_time":"2023-04-15T08:00:00Z","end_time":"2023-04-15T12:00:00Z"},
{"address":"0xb70aa3d2b6DfcaA804C45ED0bFeb785562dB42Dc","nonce":"0x4000","start_time":"2023-04-11T20:00:00Z","end_time":"2023-04-12T00:00:00Z"},
{"address":"0x2E96E4015f8aba81A103E1bC7384eD30657abB8a","nonce":"0x4000","start_time":"2023-04-11T20:00:00Z","end_time":"2023-04-12T00:00:00Z"},
{"address":"0x212BAf65228fe03674Da0EFb88cAc7EADB276DB5","nonce":"0x4000","start_time":"2023-04-16T00:00:00Z","end_time":"2023-04-16T04:00:00Z"},
{"address":"0x23bbd7810E30A19a069e01dB4cA363c901206A6e","nonce":"0x4000","start_time":"2023-04-16T00:00:00Z","end_time":"2023-04-16T04:00:00Z"},
{"address":"0x147D740AaF617B46E85304d2590ACc20A90cEe7c","nonce":"0x4000","start_time":"2023-04-13T20:00:00Z","end_time":"2023-04-14T00:00:00Z"},
{"address":"0x3DFaCd79E9A4dE85B1b8Fb16A0C62dC6971424Fd","nonce":"0x4000","start_time":"2023-04-13T20:00:00Z","end_time":"2023-04-14T00:00:00Z"},
{"address":"0x192cc2d5C4dc2fAe10E7310c15f819Ad7aBb6E99","nonce":"0x4000","start_time":"2023-04-12T20:00:00Z","end_time":"2023-04-13T00:00:00Z"},
{"address":"0x192ccacDD6dA99463e1e8a76223eA07A6CdE3479","nonce":"0x4000","start_time":"2023-04-12T20:00:00Z","end_time":"2023-04-13T00:00:00Z"},
{"address":"0xa455150c6b91D08fAa57DC664b916e1dDd1c4030","nonce":"0x4000","start_time":"2023-04-11T08:00:00Z","end_time":"2023-04-11T12:00:00Z"},
{"address":"0x22fAfBe7F860E908036460e98d04573180b0CcBB","nonce":"0x4000","start_time":"2023-04-11T08:00:00Z","end_time":"2023-04-11T12:00:00Z"},
{"address":"0xd334741D0766B257B18f2d058E844E17E346A0C1","nonce":"0x4000","start_time":"2023-04-01T00:00:00Z","end_time":"2023-04-04T00:00:00Z"},
{"address":"0x2E84785dC5bdCf5E6a7E4459C7387dC76E73EF44","nonce":"0x4000","start_time":"2023-04-01T00:00:00Z","end_time":"2023-04-04T00:00:00Z"},
{"address":"0x15bE596F2245AB321d8a357f827006520330a98c","nonce":"0x4000","start_time":"2023-04-04T04:00:00Z","end_time":"2023-04-06T16:00:00Z"},
{"address":"0xB64850FE701fB64667B6CC762AA2c12f2E02193c","nonce":"0x4000","start_time":"2023-04-04T04:00:00Z","end_time":"2023-04-06T16:00:00Z"},
{"address":"0xF51D203536Ea8b5BFBc06b3a1c21514766b22BB1","nonce":"0x4000","start_time":"2023-04-15T00:00:00Z","end_time":"2023-04-15T04:00:00Z"},
{"address":"0x78ac9c2545850bEDbC076EB30ce7A6f0D74b395E","nonce":"0x4000","start_time":"2023-04-15T00:00:00Z","end_time":"2023-04-15T04:00:00Z"},
{"address":"0xf4BA33f683aCA91128A8915de6664cB662e59af2","nonce":"0x4000","start_time":"2023-04-13T04:00:00Z","end_time":"2023-04-13T08:00:00Z"},
{"address":"0xF84f294cFda95A7EbfFb022d328396038bfBc39b","nonce":"0x4000","start_time":"2023-04-13T04:00:00Z","end_time":"2023-04-13T08:00:00Z"},
{"address":"0x68108902De3A5031197a6eB3b74b3b033e8E8e4d","nonce":"0x4000","start_time":"2023-04-08T20:00:00Z","end_time":"2023-04-09T04:00:00Z"},
{"address":"0x4cdC4f412355F296C2cf261210Cc9274404E442b","nonce":"0x4000","start_time":"2023-04-08T20:00:00Z","end_time":"2023-04-09T04:00:00Z"},
{"address":"0x3795a5115626D4ada732EfBfd51D70d4B30832FF","nonce":"0x4000","start_time":"2023-04-08T20:00:00Z","end_time":"2023-04-09T04:00:00Z"},
{"address":"0x3a953298098CADCb621a40c1efCfb7DD73B727aF","nonce":"0x4000","start_time":"2023-04-08T20:00:00Z","end_time":"2023-04-09T04:00:00Z"}]
```
_Last updated 2023-04-08 15:02 UTC._
**If your address is not on this list or if your time is incorrect/needs to change, reach out to `@CarlBeek` on Telegram urgently.**
## Step 1: Setup
You will need two computers, one connected to the internet and the other not (both assumed to be running Linux or MacOS or similar 'nix-like OS). Ideally the offline computer would be running off of a HDD/SSD/SD card that you can install a fresh operating system on and wipe it afterwards, but this is not required.
### Step 1.1: Download the client software
This guide is designed around [Ignacio Hagopian's
go-kzg-ceremony-client](https://github.com/jsign/go-kzg-ceremony-client) which uses the [gnark crypto](https://github.com/ConsenSys/gnark-crypto) library under the hood.
**You will need to install this on both your online and offline (air-gapped) computers.**
You have a few options for running it:
#### Option 1: Build from source
This option allows you to better control how the code is handled and built.
- Download and install the latest version of Go-lang
- Clone `https://github.com/jsign/go-kzg-ceremony-client.git`
- Build the binary with `make build`
#### Option 2: Download a binary
The easiest option, just [download the binary directly from the releases page](https://github.com/jsign/go-kzg-ceremony-client/releases). At the time of writing, the latest release is [v1.1.0](https://github.com/jsign/go-kzg-ceremony-client/releases/tag/v1.1.0).
## Step 2: Download the current state (Only once your slot starts)
***Wait until your slot starts (and not a second before else your contribution may be thrown away.)***
On the machine connected to the internet, wait until your slot starts and then run the following command:
```bash
$ kzgcli offline download-state current-transcript.json
```
This will download the current state and save it as `current-transcript.json`.
## Step 3: Transfer the current state to an airgapped machine
Copy `current-transcript.json` onto a flash drive, SD card, or another removable storage medium. Transfer the file to a new, air-gapped (offline) computer. Once the file has been copied to the airgapped machine, wipe the storage medium to remove any traces of the data.
## Step 4: Collect your entropy
Now for the fun bit, do your thang, collect your entropy! 💃 Don't forget to record what you're doing for posterity.
How you do this is up to you as long as it results in a file on the air-gapped computer.
#### Converting a file to a hexadecimal string
Once you have generated your entropy file, you can use the following command to convert it into a hexadecimal string of a reasonable length:
```bash
$ shasum -a 512 <input-entropy-file>
```
Replace `<input-entropy-file>` with the name of your entropy file.
## Step 5: Run the contribution command
On the airgapped computer, run the following command:
```bash
$ kzgcli offline contribute --hex-entropy <your-hexidecimal-entropy-here> current-transcript.json new-transcript.json
```
Replace `<your-hexidecimal-entropy-here>` with the hexadecimal string generated in Step 4. This will calculate your contribution and save it as `new-transcript.json`.
### Alternate: supplying the entropy via web server
_You probably don't want to do this unless you were planning on it for before-hand._
If your entropy source supplies the entropy via an http GET interface, you can do it via:
```bash
$ kzgcli offline contribute --urlrand <your-entropy-url-here> current-transcript.json new-transcript.json
```
## Step 6: Transfer the new transcript to the online machine
Copy `new-transcript.json` onto the same storage medium you used in Step 3, and transfer the file back to the online computer.
## Step 7: Log in to the sequencer
On the online computer, visit the [request_link](https://seq.ceremony.ethereum.org/auth/request_link) endpoint. Go to the `eth_auth_url` specified (it should look something like `https://oidc.signinwithethereum.org/authorize.....`). Sign in with the white-listed Ethereum account that you previously supplied.
After logging in, you will receive a JSON that contains a `session_id` field with a value similar to `504d898c-e975-4e13-9a48-4f8b95d754fb`. Copy this session-id to your clipboard.
## Step 8: Upload your contribution
Run the following command to upload your contribution to the sequencer:
```bash
$ kzgcli offline send-contribution --session-id <your-session-id-here> new-transcript.json
```
Replace `<your-session-id-here>` with the session ID you copied in Step 7.
## Step 9: Clean-up
Clean up after yourself:
Secure wiping can be done by unmounting and overwriting a disk as follows (assuming disk `X` and partition `N`)
```bash
$ sudo umount /dev/sdXN
$ sudo shred -v /dev/sdX
```
- Securely wipe (or even destroy) the removeable storage drive you used earlier, especially if it touched your entropy.
- Delete any other files related to capturing the entropy, especially the `<input-entropy-file>`
- If possible/practical wipe the disk of the airgapped computer
- If you want to be extra sure the entropy has been destroyed, consider physically destroying the storage mediums (eg. microSD, USB)
Congratulations! You have successfully contributed to the KZG Ceremony. Take a break to appreciate what you just did and tell the world about it when you're ready.
## Debugging
Below are some error messages you might see. If you get more stuck than this or you have any questions, reach out to `@carlbeek` & `@trent_vanepps` on telegram ASAP. The sooner, you reach out, the better.
- `AuthErrorPayload::UserCreatedAfterDeadline` --> It is not your turn to contribute or you are using the wrong ETH address
- `You already tried contributing with this account.` --> Try your backup address.
- `A contribution was attempted but another participant is currently contributing.` --> It either isn't your turn (Double check your time slot.) or you've signed in with your other account