

- #Ethereum wallet file how to
- #Ethereum wallet file install
- #Ethereum wallet file code
- #Ethereum wallet file download
if an error occurs, print it to the consoleĬonsole.error(" Error encountered", err)

create a new redis client and connect to the redis instanceĬonst client = redis.createClient(config.redis_port, config.redis_host) promisify the redis client using bluebirdīluebird.promisifyAll() īluebird.promisifyAll() Connect to Services RedisĬonnecting to Redis is easy, just define a redis.js file and write something similar to this code: // load configuration

Next, we use these packages to connect to the Redis, Ethereum and Kafka servers.
#Ethereum wallet file code
The last 2 are there to help us make the code easier to understand and take advantage of async/await when interacting with the Redis server.

#Ethereum wallet file install
For this, run `npm install -save web3 redis kafka-node ethereumjs-tx bluebird`. We add some of the packages we use in order to provide most of the functionality of our service. You get a lot more ready-to-use components out of the box, so for those reasons our manager will be a Node.js appplication. Personally, I am very fond of Elixir because you can build extremely reliable distributed applications that are very easy to understand and imply minimal effort, but when it comes to Ethereum the package ecosystem is not there yet.įor Ethereum development the best move would be using Node.js/Javascript. The Apache Kafka server can be scaled independently and provides a distributed cluster for handling messages between services. Kafka/ZookeeperĪpache Kafka will play a central role in our infrastructure as it will handle receiving messages from all services we build and then distribute them to other connected nodes.įor the Ethereum wallet manager service we will communicate through these topics: In this tutorial we will use the same Redis database to store the private keys that were generated for the addresses, but on a production server you should probably use something like Vault instead. Redis is a great in-memory key/value database for this use case. We need some sort of database for storing the addreses we create and watch and for keeping track of transactions that have been processed. On production you will want to use something like Geth instead, to connect to the main Ethereum network. This will allow us to work faster since the blocks are mined instantly by the service.
#Ethereum wallet file download
Since we don't want to download the entire blockchain and work with real Ether, we use Ganache (formally TestRpc). You can't have a wallet manager without a node connected to the Ethereum blockchain. Let's see what we are using here and what each component does. You can start these services by simply running docker-compose up -d, which will download the images from the Docker Registry and start each container with the environment variables defined in the compose file above. KAFKA_CREATE_TOPICS: "command:1:1,address.created:1:1,transaction:1:1,errors:1:1" The rest of the requirements come in the form of Docker images and we don't need to install anything else in order to use them, except write a simple Docker Compose configuration file like this one:
#Ethereum wallet file how to
In this series of tutorials I want to share with you how to build the components needed to create a complete crypto trading platform.
