Categorygithub.com/n42blockchain/N42
modulepackage
0.0.0-20250119000602-809120120630
Repository: https://github.com/n42blockchain/n42.git
Documentation: pkg.go.dev

# README

N42

N42 (N) is an implementation of a public blockchain on the efficiency frontier, written in Go.

Disclaimer: This software is currently a tech preview. We will do our best to keep it stable and avoid breaking changes, but we make no guarantees. Things can and will break.

System Requirements

  • For an Full node : ≥ 200 GB of storage space (SSD or NVMe recommended; HDD is not recommended).

RAM: >=16GB, 64-bit architecture, Golang version >= 1.19

Build from source code

For building the latest alpha release (this will be suitable for most users just wanting to run a node):

Most Linux systems and macOS

Since n42 is written in Go, you'll need the latest version of Go installed to build it from source code. Instructions for installing Go are available at the Go installation page and necessary bundles can be downloaded from the Go download page. The repository should be cloned to a local environment. Once cloned, running the command make n42 configures everything for a temporary build and then cleans up afterward. Please note that this build method is only compatible with UNIX-like operating systems.

git clone https://github.com/N42world/n42.git
cd n42
make n42
./build/bin/n42

Windows

Windows users may run n42 in 3 possible ways:

  • Build executable binaries natively for Windows using Chocolatey package manager
  • Use Docker : see docker-compose.yml
  • Use WSL (Windows Subsystem for Linux) strictly on version 2. Under this option you can build n42 just as you would on a regular Linux distribution. You can point your data also to any of the mounted Windows partitions (eg. /mnt/c/[...], /mnt/d/[...] etc) but in such case be advised performance is impacted: this is due to the fact those mount points use DrvFS which is a network file system and, additionally, MDBX locks the db for exclusive access which implies only one process at a time can access data. This has consequences on the running of rpcdaemon which has to be configured as Remote DB Even if it runs on the same computer, limitations may still apply. However, if your data is stored on the native Linux filesystem, these limitations do not apply. **Please be aware that the default WSL2 environment operates with a distinct IP address, separate from the Windows host's network interface. This distinction is crucial when setting up NAT for port 30303 on your router. **

Docker container

Docker allows for building and running n42 via containers. This alleviates the need for installing build dependencies onto the host OS. see docker-compose.yml dockerfile. For convenience we provide the following commands:

make images # build docker images than contain executable n42 binaries
make up # alias for docker-compose up -d && docker-compose logs -f 
make down # alias for docker-compose down && clean docker data
make start #  alias for docker-compose start && docker-compose logs -f 
make stop # alias for docker-compose stop

Executables

The N42 project comes with one wrappers/executables found in the cmd directory.

CommandDescription
N42Our main N42 CLI client. It can be used by other processes as a gateway into the N42 network via JSON RPC endpoints exposed on top of HTTP transports. N42 --help for command line options.

n42 ports

PortProtocolPurposeExpose
61015UDPThe port used by discv5.Public
61016TCPThe port used by libp2p.Public
20012TCPJson rpc/HTTPPublic
20013TCPJson rpc/WebsocketPublic
20014TCPJson rpc/HTTP/WebsocketJWT Authentication
4000TCPBlockChain ExplorerPublic
6060TCPMetricsPrivate
6060TCPPprofPrivate

License

The N42 library is licensed under the GNU General Public License v3.0.

# Packages

Package accounts implements high level Ethereum account management.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

NotFound is returned by API methods if the requested item does not exist.

# Structs

CallMsg contains parameters for contract calls.
FeeHistory provides recent fee market data that consumers can use to determine a reasonable maxPriorityFeePerGas value.
FilterQuery contains options for contract log filtering.
SyncProgress gives progress indications when the node is synchronising with the Ethereum network.

# Interfaces

ChainReader provides access to the blockchain.
ChainStateReader wraps access to the state trie of the canonical blockchain.
ChainSyncReader wraps access to the node's current sync status.
A ContractCaller provides contract calls, essentially transactions that are executed by the EVM but not mined into the blockchain.
GasEstimator wraps EstimateGas, which tries to estimate the gas needed to execute a specific transaction based on the pending state.
GasPricer wraps the gas price oracle, which monitors the blockchain to determine the optimal gas price given current fee market conditions.
LogFilterer provides access to contract log events using a one-off query or continuous event subscription.
PendingContractCaller can be used to perform calls against the pending state.
A PendingStateEventer provides access to real time notifications about changes to the pending state.
A PendingStateReader provides access to the pending state, which is the result of all known executable transactions which have not yet been included in the blockchain.
Subscription represents an event subscription where events are delivered on a data channel.
TransactionReader provides access to past transactions and their receipts.
TransactionSender wraps transaction sending.