<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>December</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Method of Cryptocurrency Wallets Managing</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Gabit Omarov</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>National Aviation University</institution>
          ,
          <addr-line>1 Liubomyr Huzar ave., Kyiv, 03058</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Satbayev Kazakh National Technical University</institution>
          ,
          <addr-line>22 Satbaev St, Almaty, 050013</addr-line>
          ,
          <country country="KZ">Kazakhstan</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Taras Shevchenko National University of Kyiv</institution>
          ,
          <addr-line>24 Bohdan Havrylyshyn St, Kyiv, 04116</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <volume>0</volume>
      <fpage>1</fpage>
      <lpage>03</lpage>
      <abstract>
        <p>With the rise of cryptocurrencies in the market, the convenience and safety of using cryptocurrency wallets became a top priority for people. Although cold cryptocurrency wallets are safe to use, they cannot be compared with hot cryptocurrency wallets and telegram bots at their convenience. In this research paper, hot crypto-wallets and telegrams bots for making and receiving transactions of cryptocurrencies with the least amount of investments will be discussed. Also, the possible methods and their implementations will be considered. Blockchain, blockchain wallets, cryptocurrency, telegram messenger, mobile applications, Blockchain - is neither just an object, a product, a trend nor an opportunity for people to make easy money. It consists of several parts, some of which work together, while others - separately and independently. Thanks to this modularity, the blockchain has an infinite number of use cases including financial services, tax regulation, Internet of Things (IoT), and so on. In the long run, most users will not know or understand that there is a blockchain in the software or service they use [1].</p>
      </abstract>
      <kwd-group>
        <kwd>bitcoin (btc)</kwd>
        <kwd>litecoin (ltc)</kwd>
        <kwd>KZCash (kzc)</kwd>
        <kwd>Qiwi</kwd>
        <kwd>API</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Problem statement</title>
      <p>Due to the trend in the development of the cryptocurrency industry, it is necessary to develop hot
wallets for any cryptocurrency. This is usually an online wallet that works through a specific website
or mobile application developed for frequently used operating systems.</p>
      <p>Recently, fraudulent actions have become more frequent when exchanging online cryptocurrencies.
Hence, those who do not know the intricacies of the blockchain often come across such cases. In this
regard, for this research paper designed telegram wallet must also provide a secure and guaranteed
exchange of fiat money for cryptocurrency.</p>
      <p>The purpose of this work is to select and implement a relatively cheap but at the same time reliable
method of managing a cryptocurrency wallet online.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Proposed method and solution</title>
      <p>The first and the simplest method of providing access to the management of a blockchain wallet is
the creation of a website that allows to control and manage cryptocurrencies.
(D.</p>
      <p>2022 Copyright for this paper by its authors.</p>
      <p>This method can be used when you need to implement it quickly. However, there is a great risk
associated with using this method. Namely, it may become vulnerable to all kinds of attacks, starting
with DOS and DDOS attacks. Hence, it necessary requires proper protection and maintenance to
function well. The second method is the development of a mobile application. Using this method
requires the development of a mobile application for each operating system separately. Also, there is a
need to publish it on special resources like Play Market or Appstore. The third method that was designed
solely for this research paper's purposes is to use the Telegram messenger as an application. This method
can overcome the disadvantages of the previously mentioned methods. There is no need to develop and
maintain a mobile application since it is already provided by a telegram messenger.
3.1.</p>
    </sec>
    <sec id="sec-4">
      <title>VPS hostings</title>
      <p>
        First, in order to create a telegram bot that will help us to maintain and control our crypto-wallet, the
"father of bots" telegram bot was used (https://t.me/BotFather). It allows users with no experience in
programming to easily set and manage their telegram bots. The second task is to configure the backend
of our bot. It will be required to send user requests and receive responses. Since we need to ensure that
the telegram bot works 24/7 and that there is no need to purchase a physical server that is much
expensive than alternatives, it was decided to rent a virtual server (hereinafter referred to as VPS) on
cloud services [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. We need a VPS where we could install the Linux Ubuntu operating system to
program the wallet. We were looking for a VPS with at least 4 GB of RAM and a permanent memory
on an SSD of at least 50 GB [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. One of the leading companies in Kazakhstan for virtual server rental
company ps.kz offers the following solutions:
      </p>
      <p>Of the proposed solutions, only the latest "KVM-6" for 20,000 tenges (equivalently 47 US dollars)
per month is suitable for us. In contrast to similar services, the PS.kz prices occur to be expensive.
Hence, choosing VPS hosting in Kazakhstan appears to be financially ineffective, although it is
compensated with a high Internet speed. For the stable work of our crypto wallets, the internet speed is
important, hence European servers compared to American ones are prioritized due to high and stable
Internet connection between Kazakhstan and European servers. We reviewed the solutions of European
companies, in particular, Aruba from Italy, which offers such solutions: Of the proposed, our
requirements are covered by the "Large" solution for 12.50 Euros (equivalently 6500 tenges),
specifically, because it has 4 GB of RAM and 80 GB of SSD, which is required for stable and reliable
work of our crypto-wallet.</p>
      <p>Additionally, one of the largest VPS hosting in Germany "Contabo" was considered. They have the
following prices for their service: On the left side, they offer VPS servers with HDD and SSD, while
on the right side, they offer VPS series that work solely on SSD. Of these, our requirements are covered
by the first solution "VPS S SSD". The cost of this service is 4.99 Euros, equivalent to about 2600
tenge. We settled on this solution. This server has a 4-core 2.2GHz virtual processor, with 8 GB of
RAM, and a 200 GB SSD disk, which is enough to sustain stable and reliable work of our wallet.
3.2.</p>
    </sec>
    <sec id="sec-5">
      <title>Implementation</title>
      <p>
        First, we need to install Linux Ubuntu operating system on our server. In the following picture,
Linux Ubuntu 16.04 was installed: Python was chosen as the service development language. Therefore,
a Python development environment was installed on this server. This language was not chosen by
chance. There are ready-made libraries for managing blockchain wallets for the Python language, and
it is convenient to use it to access various services using the API since our Telegram bot will have to
exchange different services via API [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        Blockchain wallets of cryptocurrencies - KZ Cash, Bitcoin, Litecoin were installed on the server. To
install, it is enough to run the following commands in the Linux OS command line [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]:
# wget https://raw.githubusercontent.com/kzcashteam/mn_install/master/kzcash_mn_install.sh
# chmod +x kzcash_mn_install.sh
# ./kzcash_mn_install.sh
# wget https://bitcoincore.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
# tar xvf bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
# wget https://download.litecoin.org/litecoin-0.17.1/linux/litecoin-0.17.1-x86_64-linux-gnu.tar.gz
# tar xvf litecoin-0.17.1-x86_64-linux-gnu.tar.gz
      </p>
      <p>After installation, it is needed to configure the ports with which they will work in the configuration
file of each coin. For the KZ Crash coin, the settings file will be the following data:
rpcuser={user_name kzc}
rpcpassword={user_password kzc}
rpcport=8279
listen=1
server=1
rpcallowip=127.0.0.1
For Bitcoin (btc):
rpcuser={user_name btc}
rpcpassword={user_password btc}
rpcport=9341
listen=1
server=1
rpcallowip=127.0.0.1
For Litcoin (ltc):
rpcuser={user_name ltc}
rpcpassword={user_password ltc}</p>
      <p>After making changes to the data in the configuration files, you need to run the wallet daemons:
# kzcashd -daemon
# bitcoind –daemon
# litecoind –daemon</p>
      <p>Now we go to the Python settings. It is necessary to create a configuration file there too, which will
help wallets to address. Example of a configuration file:
wallet_host = "127.0.0.1"
wallet_port_kzc = 8279
wallet_user_kzc = {user_name kzc}
wallet_passwd_kzc = {user_password kzc}
wallet_url_kzc="http://{user}:{passwd}@{host}:{port}".format(user=wallet_user_kzc,
passwd=wallet_passwd_kzc, host=wallet_host, port$
wallet_port = 9341
wallet_user = { user_name btc}
wallet_passwd = {user_password btc}
wallet_url="http://{user}:{passwd}@{host}:{port}".format(user=wallet_user,
passwd=wallet_passwd, host=wallet_host, port=wallet_port)
wallet_port_ltc = 9332
wallet_user_ltc = { user_name ltc}
wallet_passwd_ltc = {user_password ltc}
wallet_url_ltc="http://{user}:{passwd}@{host}:{port}".format(user=wallet_user_ltc,
passwd=wallet_passwd_ltc, host=wallet_host, port$</p>
      <p>
        Below is a code example of how a cryptocurrency blockchain wallet can be accessed using Python
[
        <xref ref-type="bibr" rid="ref7 ref8 ref9">7-9</xref>
        ]:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from config import wallet_url, wallet_url_kzc, wallet_url_ltc
def main(coin, wallet_addr):
if coin == 'kzc':
      </p>
      <p>cur_url = wallet_url_kzc
elif coin == 'ltc':</p>
      <p>cur_url = wallet_url_ltc
else:</p>
      <p>cur_url = wallet_url
acc = AuthServiceProxy(cur_url)
unspent = acc.listunspent(0)
for i in unspent:
if i["address"] == wallet_addr:
if count &gt;= amount_fee:</p>
      <p>break
txid_vout.append({"txid":i["txid"], "vout":i["vout"]})
count += i["amount"]
if __name__ == "__main__":</p>
      <p>main()</p>
      <p>
        It is necessary to use a database to account for certain data, for this the MySQL DBMS was
selected. This DBMS is easy to use and ensures the operation of our service [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>To install MySQL DBMS, the following command can be used:</p>
      <p># apt-get install mysql-server</p>
      <p>
        To connect to the database from Python, you need to connect the appropriate library and use it to
perform manipulations [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]:
import pymysql
class sql_db:
def __init__(self):
try: # connection to the database
self.conn = pymysql.connect(
unix_socket=config.ms_unix_socket,
user=config.ms_db_user,
passwd=config.ms_db_passwd,
db=config.ms_db_name,
use_unicode=True, charset='utf8')
except pymysql.OperationalError as e:
print("can't connect to Mysql")
print(e)
try: self.cursor = self.conn.cursor()
      </p>
      <p>self.cursor.execute('SET autocommit = 0;')
except pymysql.OperationalError as e:
print("can't get cursor")
print.error(e)
def select_user_id(self, user_id):
try: self.cursor.execute("SELECT * FROM
'{user_id}'".format(user_id=user_id))
except pymysql.Error as e:
print("select_user_id, error")
print(e)
return
result = self.cursor.fetchall()
if len(result) &lt;= 0:</p>
      <p>print("select_user_id, error,
user_id={user_id}".format(user_id=user_id))</p>
      <p>return False
else: return result[0]</p>
      <p>
        Next, in order to connect to the financial system, the Qiwi service was selected. The advantage of
this service is that it can be used both for non-cash and cash payments using Qiwi terminals. This service
also provides access to your account via the API. Sample code from Python [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]:
import requests
import json
def main():
s = requests.Session()
s_tok = "токен"
s_log = "логин"
s = requests.Session()
s.headers['authorization'] = 'Bearer ' + s_tok
parameters = {'rows': '10', 'operation': 'IN'}
h=s.get('https://edge.qiwi.com/payment-history/v1/persons/'+s_log+'/payments',
params = parameters)
r_str=json.loads(h.text)
print(r_str)
      </p>
      <p>Figure 5. The start page of the telegram bot and the main menu (a); The menu of added coins and
the menu for exchanging cryptocurrencies (b).</p>
      <p>
        To connect to banks, it was not possible to get an API to access your account, and therefore it was
implemented through a third-party service - Zen Money. This is a service for home accounting. It has
the opportunity to connect to many second-tier banks in Kazakhstan. And this service has access to its
account via the API [
        <xref ref-type="bibr" rid="ref13 ref14 ref15">13-15</xref>
        ]. Sample code for accessing the Zen Money service:
s_tok = "tocken"
dt = datetime.datetime.now()
timestamp = time.mktime(dt.timetuple())
s = requests.Session()
s_servtime = ""
s.headers['Authorization'] = 'Bearer ' + s_tok
logger.info("currentClientTimestamp={0}, serverTimestamp={1}".format(timestamp,
s_servtime))
      </p>
      <p>parameters = {"currentClientTimestamp": timestamp, "serverTimestamp":
float(s_servtime)}</p>
      <p>
        The working version of the telegram bot is now available at this address (fig. 5)
https://t.me/KZCashBot/ . The security of proposed approach can be improved by cryptographic
methods and random number generation means, for example [
        <xref ref-type="bibr" rid="ref16 ref17 ref18 ref19">16-19</xref>
        ].
      </p>
    </sec>
    <sec id="sec-6">
      <title>4. Conclusion</title>
      <p>In this article, the well-known methods of managing hot (online) wallets were considered. We
needed an optimal option that would be implemented quickly, supported on all platforms, not
complicated maintenance, and with the lowest costs.</p>
      <p>As a result, the optimal implementation option was chosen through the telegram messenger. Also,
to optimize the costs of server equipment, a VPS was rented on cloud services. The cost of renting a
VPS for 1 month is 4.99 EUR. About 40 days were spent on the implementation of this task.</p>
      <p>This wallet has also been integrated with fiat money through the Qiwi payment system. It is possible
to partially integrate with other second-tier banks using the Zen Money service. It is also planned to
add bot tokens on smart contracts to this telegram, as well as a service for launching and managing
masternodes.
5. References</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.</given-names>
            <surname>Leloup</surname>
          </string-name>
          , Blockchain. Paris,
          <year>2017</year>
          , 206 p.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Nakamoto</surname>
          </string-name>
          , “
          <article-title>Bitcoin: A Peer-to-Peer Electronic Cash System”</article-title>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Telegram</given-names>
            <surname>Bot Lessons</surname>
          </string-name>
          .
          <source>Make Telegram Bot using Python</source>
          , https://groosha.gitbook.io/telegram-botlessons/
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Al Housani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Mutrib</surname>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Jaradi</surname>
          </string-name>
          , “
          <source>The Linux review - Ubuntu desktop edition - version 8</source>
          .10”,
          <source>2009 International Conference on the Current Trends in Information Technology (CTIT)</source>
          ,
          <year>2009</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          , doi: 10.1109/CTIT.
          <year>2009</year>
          .
          <volume>5423142</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Bitcoin</given-names>
            <surname>Developer Reference</surname>
          </string-name>
          , https://bitcoin.org/en/developer-reference
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Sterling</surname>
          </string-name>
          , “Linux”,
          <source>in Beowulf Cluster Computing with Linux</source>
          , MIT Press,
          <year>2001</year>
          , pp.
          <fpage>61</fpage>
          -
          <lpage>93</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>G.</given-names>
            <surname>Ayoade</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Karande</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Khan</surname>
          </string-name>
          , K. Hamlen, “
          <article-title>Decentralized IoT Data Management Using Block Chain</article-title>
          and Trusted Execution Environment”,
          <source>2018 IEEE International Conference on Information Reuse and Integration (IRI)</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>15</fpage>
          -
          <lpage>22</lpage>
          , doi: 10.1109/IRI.
          <year>2018</year>
          .
          <volume>00011</volume>
          . \
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Ahmed</given-names>
            <surname>Banafa</surname>
          </string-name>
          ,
          <article-title>"Blockchain Technology and Applications," in Blockchain Technology and Applications</article-title>
          , River Publishers,
          <year>2020</year>
          , pp.
          <fpage>i</fpage>
          -xvi.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <article-title>[9] API reference (JSON-RPC)</article-title>
          , https://en.bitcoin.it/wiki/API_
          <article-title>reference_(JSON-RPC)</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>[10] MySQL, https://metanit.com/sql/mysql/</mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <article-title>Python 3 for beginners</article-title>
          , https://pythonworld.ru
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>API</given-names>
            <surname>Qiwi</surname>
          </string-name>
          , https://developer.qiwi.com/ru/qiwi-wallet-personal/#intro
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <article-title>Cryptocurrency payments by own hands</article-title>
          , https://habr.com/ru/post/350430/
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14] Telegram Bot via webhook, https://retifrav.github.io/blog/2018/12/02/telegram-bot
          <string-name>
            <surname>-</surname>
          </string-name>
          webhook-ru/
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Zenmoney</surname>
          </string-name>
          <article-title>:: The art of investing</article-title>
          , https://www.zenmoney.com/
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>M.</given-names>
            <surname>Iavich</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gnatyuk</surname>
          </string-name>
          , E. Jintcharadze,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Polishchuk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Fesenko</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Abisheva</surname>
          </string-name>
          ,
          <article-title>Comparison and Hybrid Implementation of Blowfish, Twofish and</article-title>
          RSA Cryptosystems,
          <source>Proceedings of 2019 IEEE 2nd Ukraine Conference on Electrical and Computer</source>
          Engineering (UKRCON), Lviv, Ukraine,
          <year>2019</year>
          , pp.
          <fpage>970</fpage>
          -
          <lpage>974</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <surname>Iavich</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuchukhidze</surname>
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gnatyuk</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fesenko</surname>
            <given-names>A</given-names>
          </string-name>
          .
          <article-title>Novel certification method for quantum random number generators</article-title>
          ,
          <source>International Journal of Computer Network and Information Security</source>
          , Volume
          <volume>13</volume>
          , Issue 3, pp.
          <fpage>28</fpage>
          -
          <lpage>38</lpage>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Gnatyuk</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Okhrimenko</surname>
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Azarenko</surname>
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fesenko</surname>
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Berdibayev</surname>
            <given-names>R</given-names>
          </string-name>
          .
          <article-title>Experimental Study of Secure PRNG for Q-trits Quantum Cryptography Protocols</article-title>
          ,
          <source>Proceedings of the 2020 IEEE 11th International Conference on Dependable Systems, Services and Technologies (DESSERT</source>
          <year>2020</year>
          ), Kyiv, Ukraine, May
          <volume>14</volume>
          ,
          <year>2020</year>
          , pp.
          <fpage>183</fpage>
          -
          <lpage>188</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Iashvili</surname>
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Iavich</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gagnidze</surname>
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gnatyuk</surname>
            <given-names>S.</given-names>
          </string-name>
          <article-title>Increasing usability of TLS certificate generation process using secure design</article-title>
          ,
          <source>CEUR Workshop Proceedings</source>
          , Vol.
          <volume>2698</volume>
          , pp.
          <fpage>35</fpage>
          -
          <lpage>41</lpage>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>