Ethereum Blockchain: testnet environment setup - blockchain

In way to skip the need of trusting a third party and to skip the full download of the blockchain on my PC, I would like to setup a full node syncing an ethereum testnet blockchain on a local server and then connect my PC to this server, using a geth instance.
Is that possible in some way?
How can I do that?

You can just connect to your local geth server via rpc
geth attach http://host:port
There you can read about geth's rpc apis
You can start rpc listener with this command on your geth server after or during syncing
admin.startRPC(host, port, cors, apis)
As an alternative you can just use light sync on your main pc so you won't need to download full blockchain
geth --light
But it depends on what you gonna do with it

For others having problem with syncing. I think it's a good idea [ for development and testing ] to setup the ethereum blockchain locally instead of connecting with any testnet or the mainnet.
Reference:
https://nodejsera.com/blockchain/how-to-start-a-private-ethereum-blockchain-network.html

Related

Where to get rpc server ethereum

I am new to cryptocurrency development.Today I learned that the ETH transaction requires an RPC server. I found a list of RPC servers like Binance. But is there any official RPC server? Or do you need to create it yourself? What is the difference? Where to get the official exchange rate eth to USD? Many thanks.
There is no official centralised server, because peer-to-peer cryptocurrencies are about decentralisation. Creating single points of failure is bad.
Ethereum software-as-a-service node alternatives can found on:
https://ethereumnodes.com
I also recommend you to try to host the node yourself.

Difference of Geth or Ganache

Hi I am new to blockchain topic and I am trying to make an Ethereum smart contract. First step I installed truffle and when I try to migrate it throws an error because I have no ethereum client.
For solving this problem truffle develop, ganache, geth are recommended but I couldnt decide to which one is more suitable and I dont understand the difference of ganache and geth. Basically are they serving same thing or not? Here is error:
Could not connect to your Ethereum client with the following parameters:
- host > 127.0.0.1
- port > 7545
- network_id > *
Please check that your Ethereum client:
- is running
- is accepting RPC connections (i.e., "--rpc" option is used in geth)
- is accessible over the network
- is properly configured in your Truffle configuration file (truffle-config.js)
Truffle
As you already did, you migrated a contract. So Truffle can be used for contract compilation and migration. It aims for easy and fast migration.
Geth
Is an Ethereum-client, which means that you can run your own private blockchain with it. You can adjust your needs by defining for example the amount of threads you offer for mining.
Geth itself is a command line tool, which can run a full Ethereum node implemented in Go. It provides the command lines, a Json-rpc server and an interactive console, where you can run your own scripts written in javascript.
Ganache
If you want a GUI, where you can track all deployments and transactions on your blockchain, you can choose Ganache.
It allows you to create your own private blockchain mainly for testing purposes.
It is used for deployment-testing for example, because there are no real miners on a "ganache-blockchain", so you can test if your contracts work.
I would suggest you to use Geth and Truffle if you want to set up your own blockchain on your local node and then deploy some contracts on it.
There are plenty of manuals online on how to set up your own local node.
For example:
Create your own local node with geth
Setting up Ethereum development environment
After you created your node, you can deploy some contracts with truffle to it. I hope I could help you.
TLDR : start with Ganache and learn Geth along the way.
Truffle is a compiler and out of question.
But between Geth and Ganache :
Why Ganache ? Because it is easy !
Geth is a real deal , for a small local chain you have to run it's service first then create genesis block then you need to bring some miner to mine the transaction to the blockchain and generate some eath! then you can migrate smart contract to it but Ganache will do all of that for you!
Why use Geth? from here :
1- Geth is the official client software provided by the Ethereum
foundation.
2- Comes with a JavaScript console (run it with geth console).
3- Has an interoperable JavaScript client (web3js).
4- Built-in access to the Rinkeby test net (or build your own private
Ethereum network).
5- It is generally considered to be the reference implementation for
other Ethereum nodes.
From my experience at this time/date, Ganache cloud be buggy and will give you some errors irrelevant to your code , but if you need to migrate your code to a test nest like Rinkeby Testnet, eventually you need to learn Geth.

Run a ethereum wallet software locally

I'm using geth and mist to deploy a ethereum private network which is compeletely separated from internet.
But mist is trying to connect online wallet website all the time. Can I have an offline wallet software to manage my private network account? Or can I construct a alternative local web site? If you know about it ,please tell me , thank you!
I've downloaded the MyEtherWallet offline version, it satify my requirment very well , and the Ganache is also very good.thanks you ,brad mcallister.

Data on Private Ethereum blockchain lost/disappears after couple of days

I am deploying a private ethereum blockchain (geth) on a virtual machine on Azure. Upon deploying my Solidity contracts on the blockchain and launching my NodeJS application to it, I am able to add data normally through web apis of the nodejs Loopback App and everything is working fine and I can see the added data using the GET apis.
However, after 1-2-3 days (random) I am not able to retrieve the data I added through my GET apis, while am still able to add new data which confirms that Geth is running fine and wasn't interrupted.
I am running geth using:
geth --datadir ./myDataDir --rpc --networkid 1441 console 2>> myEth.log
myEth.log isn't showing anything wrong, nodejs logs are clean as well.
eth.syncing shows false which means the network is synced.
size of myDataDir folder is still increasing so logically data should be somewhere there but it's not showing.
This is not a private blockchain!
--networkid 1441
This only says that you communicate with clients that also run a network with ID 1441. It might be unlikely, but if someone else runs a network with ID 1441, this node will connect to your node just fine. And in case, the other network with the same ID has a longer (more "heavier") chain, this overwrites your local chain.
To avoid this, try a more random network ID, maybe 7-9 digits, and disable discovery with
--nodiscovery
Or just use the --dev preset.

Accessing Ethereum Dapp

Is their a way to access ethereum Dapps other than the mist browser. I was thinking along the lines of a normal browser like chrome. Also, as a sub question how are some Android and IOS apps connecting to the blockchain?
You can do that through Ethereum JSON-RPC: https://github.com/ethereum/wiki/wiki/JSON-RPC
You have to use
eth_call - read from contract
eth_sendTransaction - send transaction to a contract
You must understand that you'll also need to have an Ethereum node started, most probably with unlocked account to execute transactions from it. Which means you don't want to run it on public networks, but rather in local network. That's what Mist do for you essentially.
Also, take a look at MetaMask, it provides same API for browser based app, but requires an additional plugin to be installed into a browser