Ethereum is a public, decentralized blockchain that also acts as an open-source platform to develop decentralized applications. It is one of the most popular blockchains in existence, second only to Bitcoin (BTC) with a market share of USD 19,556,818,393. Setting up an Ethereum testnet can be a daunting task and resource exhaustive. However, we can set up our own Ethereum private testnet without a genesis file, which is easy to do and also less resource-intensive.
Also, to know more about app development with Ethereum, visit our Ethereum blockchain development services.
Then, we can test our DApps on this Ethereum private testnet without having to use real ETH.
OS:- Ubuntu 16.04 or later
Memory:- C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available.
Setting up Ethereum Private Testnet
By following the below steps, you can set up a private testnet node on your local machine.
$ sudo add-apt-repository ppa:ethereum/ethereum $ sudo apt-get update
$ geth --datadir <path to your dataDir here> --dev
Exit the console
$ geth --dev --port 3000 --networkid 58343 --nodiscover --datadir=<path to data Directory> --maxpeers=0 --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --ws --wsport 8546 --wsaddr 127.0.0.1 --allow-insecure-unlock
Significance of different flags used
$ geth attach http://127.0.0.1:8543
> personal.newAccount(password)
Remember this password. The address generated by the above command will be the coinbase address where all the fake ETH for testing will be deposited.
> eth.mining
You might not see mining as the private testnet is running in the development mode which means there will be mining only when there is a transaction on the private testnet.
> web3.fromWei(eth.getBalance(eth.coinbase),"ether")
By following the above steps, you can set up an Ethereum private testnet without a genesis file. It should be done in the development mode so that there is mining only when there is a transaction on a given private testnet. This saves a user’s resources as if you don’t use the development mode, many blocks will be mined very quickly because of low mining difficulty initially.