Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Report a bug
about: Something with Xagon is not working as expected
about: Something with Xgon is not working as expected
title: ''
labels: 'type:bug'
assignees: ''
---

#### System information

Xagon Node version: `v0.0.X-RCXX`
Xgon Node version: `v0.0.X-RCXX`
OS & Version: `Windows/Linux/OSX`
Commit hash : (if `develop`)
Network: `Mainnet/Testnet`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-from-prover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: okx/xagon-node
repository: okx/xgon-node

- name: Install Go
uses: actions/setup-go@v3
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN cd /src && make build

# CONTAINER FOR RUNNING BINARY
FROM alpine:3.18.0
COPY --from=build /src/dist/xagon-node /app/xagon-node
COPY --from=build /src/dist/xgon-node /app/xgon-node
COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
RUN apk update && apk add postgresql15-client
EXPOSE 8123
CMD ["/bin/sh", "-c", "/app/xagon-node run"]
CMD ["/bin/sh", "-c", "/app/xgon-node run"]
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/dist
GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH)
GOBINARY := xagon-node
GOBINARY := xgon-node
GOCMD := $(GOBASE)/cmd

LDFLAGS += -X 'github.com/0xPolygonHermez/zkevm-node.Version=$(VERSION)'
Expand All @@ -35,21 +35,21 @@ build: ## Builds the binary locally into ./dist

.PHONY: build-docker
build-docker: ## Builds a docker image with the node binary
docker build -t xagon-node -f ./Dockerfile .
docker build -t xgon-node -f ./Dockerfile .

.PHONY: build-docker-nc
build-docker-nc: ## Builds a docker image with the node binary - but without build cache
docker build --no-cache=true -t xagon-node -f ./Dockerfile .
docker build --no-cache=true -t xgon-node -f ./Dockerfile .

.PHONY: run-rpc
run-rpc: ## Runs all the services need to run a local zkEMV RPC node
docker-compose up -d xagon-state-db xagon-pool-db
docker-compose up -d xgon-state-db xgon-pool-db
sleep 2
docker-compose up -d xagon-prover
docker-compose up -d xgon-prover
sleep 5
docker-compose up -d xagon-sync
docker-compose up -d xgon-sync
sleep 2
docker-compose up -d xagon-rpc
docker-compose up -d xgon-rpc

.PHONY: stop
stop: ## Stops all services
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Xagon Node
# Xgon Node

Xagon Node is a Go implementation of a node that operates the Xagon Network.
Xgon Node is a Go implementation of a node that operates the Xgon Network.

## About the Xagon network
## About the Xgon network

Since this is an implementation of a protocol it's fundamental to understand it, [here]() you can find the specification of the protocol.

Glossary:

- L1: Base blockchain where the rollup smart contracts are deployed. It's Ethereum or a testnet of Ethereum, but it could be any EVM compatible blockchain.
- L2: the rollup network aka the Xagon network.
- Batch: a group of transactions that are executed/proved, using the [Xagon prover]() and sent to / synchronized from L1
- L2: the rollup network aka the Xgon network.
- Batch: a group of transactions that are executed/proved, using the [Xgon prover]() and sent to / synchronized from L1
- Sequencer: the actor that is responsible for selecting transactions, putting them in a specific order, and sending them in batches to L1
- Trusted sequencer: sequencer that has special privileges, there can only be one trusted sequencer. The privileges granted to the trusted sequencer allow it to forecast the batches that will be applied to L1. This way it can commit to a specific sequence before interacting with L1. This is done to achieve fast finality and reduce costs associated with using the network (lower gas fees)
- Permissionless sequencer: sequencer role that can be performed by anyone. It has competitive disadvantages compared to the trusted sequencer (slow finality, MEV attacks). Its main purpose is to provide censorship resistance and unstoppability features to the network.
Expand All @@ -20,9 +20,9 @@ Glossary:
- Trusted state: state reached through processing transactions that have been shared by the trusted sequencer. This state is considered trusted as the trusted sequencer could commit to a certain sequence, and then send a different one to L1
- Virtual state: state reached through processing transactions that have already been submitted to L1. These transactions are sent in batches by either trusted or permissionless sequencers. Those batches are also called virtual batches. Note that this state is trustless as it relies on L1 security assumptions
- Consolidated state: state that is proven on-chain by submitting a ZKP (Zero Knowledge Proof) that proves the execution of a sequence of the last virtual batch.
- Invalid transaction: a transaction that can't be processed and doesn't affect the state. Note that such a transaction could be included in a virtual batch. The reason for a transaction to be invalid could be related to the Ethereum protocol (invalid nonce, not enough balance, ...) or due to limitations introduced by the Xagon (each batch can make use of a limited amount of resources such as the total amount of keccak hashes that can be computed)
- Invalid transaction: a transaction that can't be processed and doesn't affect the state. Note that such a transaction could be included in a virtual batch. The reason for a transaction to be invalid could be related to the Ethereum protocol (invalid nonce, not enough balance, ...) or due to limitations introduced by the Xgon (each batch can make use of a limited amount of resources such as the total amount of keccak hashes that can be computed)
- Reverted transaction: a transaction that is executed, but is reverted (because of smart contract logic). The main difference with *invalid transaction* is that this transaction modifies the state, at least to increment nonce of the sender.
- Proof of Efficiency (PoE): name of the protocol used by the network, it's enforced by the [smart contracts](https://github.com/okx/xagon-contracts)
- Proof of Efficiency (PoE): name of the protocol used by the network, it's enforced by the [smart contracts](https://github.com/okx/xgon-contracts)

## Architecture

Expand All @@ -41,10 +41,10 @@ The diagram represents the main components of the software and how they interact
- State: Responsible for managing the state data (batches, blocks, transactions, ...) that is stored on the `state SB`. It also handles the integration with the `executor` and the `Merkletree` service
- State DB: persistence layer for the state data (except the Merkletree that is handled by the `Merkletree` service)
- Aggregator: consolidates batches by generating ZKPs (Zero Knowledge proofs). To do so it gathers the necessary data that the `prover` needs as input through the `state` and sends a request to it. Once the proof is generated it's sent to Ethereum through the `etherman`
- Prover/Executor: service that generates ZK proofs. Note that this component is not implemented in this repository, and it's treated as a "black box" from the perspective of the node. The prover/executor has two implementations: [JS reference implementation](https://github.com/0xPolygonHermez/zkevm-proverjs) and [C production-ready implementation](https://github.com/okx/xagon-prover). Although it's the same software/service, it has two very different purposes:
- Prover/Executor: service that generates ZK proofs. Note that this component is not implemented in this repository, and it's treated as a "black box" from the perspective of the node. The prover/executor has two implementations: [JS reference implementation](https://github.com/0xPolygonHermez/zkevm-proverjs) and [C production-ready implementation](https://github.com/okx/xgon-prover). Although it's the same software/service, it has two very different purposes:
- Provide an EVM implementation that allows processing transactions and getting all needed results metadata (state root, receipts, logs, ...)
- Generate ZKPs
- Merkletree: service that stores the Merkletree, containing all the account information (balances, nonces, smart contract code, and smart contract storage). This component is also not implemented in this repo and is consumed as an external service by the node. The implementation can be found [here](https://github.com/okx/xagon-prover)
- Merkletree: service that stores the Merkletree, containing all the account information (balances, nonces, smart contract code, and smart contract storage). This component is also not implemented in this repo and is consumed as an external service by the node. The implementation can be found [here](https://github.com/okx/xgon-prover)

## Roles of the network

Expand All @@ -63,8 +63,8 @@ Required services and components:

There must be only one synchronizer, and it's recommended that it has exclusive access to an executor instance, although it's not necessary. This role can perfectly be run in a single instance, however, the JSON RPC and executor services can benefit from running in multiple instances, if the performance decreases due to the number of requests received

- [`Xagon RPC endpoints`](./docs/json-rpc-endpoints.md)
- [`Xagon RPC Custom endpoints documentation`](./docs/zkEVM-custom-endpoints.md)
- [`Xgon RPC endpoints`](./docs/json-rpc-endpoints.md)
- [`Xgon RPC Custom endpoints documentation`](./docs/zkEVM-custom-endpoints.md)

### Trusted sequencer

Expand Down
10 changes: 5 additions & 5 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -36,7 +36,7 @@ FreeGasAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "xagon-pool-db"
Host = "xgon-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down Expand Up @@ -141,10 +141,10 @@ CleanHistoryPeriod = "1h"
CleanHistoryTimeRetention = "5m"

[MTClient]
URI = "xagon-prover:50061"
URI = "xgon-prover:50061"

[Executor]
URI = "xagon-prover:50071"
URI = "xgon-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -158,7 +158,7 @@ Enabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down
12 changes: 6 additions & 6 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -29,7 +29,7 @@ FreeGasAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "xagon-pool-db"
Host = "xgon-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -47,7 +47,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://internal.xagon-test.net:2083/"
SequencerNodeURI = "https://internal.xgon-test.net:2083/"
EnableL2SuggestedGasPricePolling = true
[RPC.WebSockets]
Enabled = true
Expand Down Expand Up @@ -142,10 +142,10 @@ MaxGasPriceWei = 0
#L2CoinId = 7184

[MTClient]
URI = "xagon-prover:50061"
URI = "xgon-prover:50061"

[Executor]
URI = "xagon-prover:50071"
URI = "xgon-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -162,7 +162,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
12 changes: 6 additions & 6 deletions config/environments/mainnet/node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -24,7 +24,7 @@ FreeGasAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "xagon-pool-db"
Host = "xgon-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -42,7 +42,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://xagon-rpc.com"
SequencerNodeURI = "https://xgon-rpc.com"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Enabled = true
Expand All @@ -54,10 +54,10 @@ SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc

[MTClient]
URI = "xagon-prover:50061"
URI = "xgon-prover:50061"

[Executor]
URI = "xagon-prover:50071"
URI = "xgon-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -74,7 +74,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
12 changes: 6 additions & 6 deletions config/environments/testnet/node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Outputs = ["stderr"]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -26,7 +26,7 @@ FreeGasAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
User = "pool_user"
Password = "pool_password"
Name = "pool_db"
Host = "xagon-pool-db"
Host = "xgon-pool-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand All @@ -44,7 +44,7 @@ Port = 8545
ReadTimeout = "60s"
WriteTimeout = "60s"
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://rpc.public.xagon-test.net/"
SequencerNodeURI = "https://rpc.public.xgon-test.net/"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Enabled = true
Expand All @@ -55,10 +55,10 @@ SyncInterval = "2s"
SyncChunkSize = 100

[MTClient]
URI = "xagon-prover:50061"
URI = "xgon-prover:50061"

[Executor]
URI = "xagon-prover:50071"
URI = "xgon-prover:50071"
MaxResourceExhaustedAttempts = 3
WaitOnResourceExhaustion = "1s"
MaxGRPCMessageSize = 100000000
Expand All @@ -75,7 +75,7 @@ ProfilingEnabled = false
User = "prover_user"
Password = "prover_pass"
Name = "prover_db"
Host = "xagon-state-db"
Host = "xgon-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Loading