Ethereum blockchain application development

Модератори: ekrem, Moderators

Ethereum blockchain application development

Мнениеот oodlesblockchain » 06 Яну 2020, 14:59

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.

Pre Requisites
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.

Installing geth


$ sudo add-apt-repository ppa:ethereum/ethereum

$ sudo apt-get update
Initiating the blockchain


$ geth --datadir <path to your dataDir here> --dev
Exit the console

Starting the private blockchain


$ 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

–dev:- It means the eth node runs in development mode and there will be mining only when there will be transactions on the given node.
–data-dir:- The path to the datadirectory to be used.
–max peers:- It is 0 since we want to set up private testnet. Noone from outside our machine will be able to connect to the node.
–rpc:- It allows us to use RPC methods.
–rpcport:- Port to be used to connect to our node with RPC requests.
–rpcaddr:-Address of the machine trying to connect to this instance of the node. Since we are setting it up on a local machine, it will be 127.0.0.1.
–rpcapi:-You can mention modules that you can use for RPC requests to the node.
–ws:-It allows our node to be connected with a WebSocket.
–wsport:-Port to be used to connect to our node using web sockets.
–wsddr:- Address of the machine trying to connect to our node through a web socket. Here it is 127.0.0.1
–alow-insecure-unlock:-It allows account creation request to be fulfilled by our node by an HTTP connection.
Attach process and start geth console in a new tab


$ geth attach http://127.0.0.1:8543
Create a new account


> 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.

Check if there is any mining using


> 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.

Check the balance of coinbase address


> web3.fromWei(eth.getBalance(eth.coinbase),"ether")
oodlesblockchain
 
Мнения: 7
Регистриран на: 28 Ное 2019, 09:20

Назад към ETH - Ethereum (Етериум)

Кой е на линия

Регистрирани потребители: Google [Bot], Shmitkata, shulio, Spenchoni