CentOS Stream 9: How to install and use bitcoin-rpcauth-js

1. Description of “bitcoin-rpcauth-js”

Create login credentials for a JSON-RPC user
    Bitcoin 'rpcauth' option generator
    A canonical python script is included in share/rpcauth.

-rpcauth=
  Username and HMAC-SHA-256 hashed password for JSON-RPC connections.
  The field  comes in the format: :$. 
  A canonical python script is included in share/rpcauth.
  The client then connects normally using the rpcuser=/rpcpassword= pair of arguments.
  This option can be specified multiple times

2. yarn install

#  curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
[yarn]
name=Yarn Repository
baseurl=https://dl.yarnpkg.com/rpm/
enabled=1
gpgcheck=1
gpgkey=https://dl.yarnpkg.com/rpm/pubkey.gpg
[root@localhost ~]#  sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
[root@localhost ~]# dnf install yarn
Yarn Repository                                 479 kB/s | 316 kB     00:00
Last metadata expiration check: 0:00:01 ago on Fri 12 Aug 2022 04:25:19 AM JST.
Dependencies resolved.
================================================================================
 Package         Architecture      Version                Repository       Size
================================================================================
Installing:
 yarn            noarch            1.22.19-1              yarn            1.2 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.2 M
Installed size: 5.1 M
Is this ok [y/N]: y
Downloading Packages:
yarn-1.22.19-1.noarch.rpm                       911 kB/s | 1.2 MB     00:01
--------------------------------------------------------------------------------
Total                                           909 kB/s | 1.2 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : yarn-1.22.19-1.noarch                                  1/1
  Verifying        : yarn-1.22.19-1.noarch                                  1/1

Installed:
  yarn-1.22.19-1.noarch

Complete!
# yarn --version
1.22.19

3. login new user
4. yarn add

$ yarn add bitcoin-rpcauth-js
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 26 new dependencies.
info Direct dependencies
mq bitcoin-rpcauth-js@1.0.0
info All dependencies
tq ansi-regex@5.0.1
tq ansi-styles@4.3.0
tq base64url@3.0.1
tq bitcoin-rpcauth-js@1.0.0
tq camelcase@5.3.1
tq cliui@6.0.0
tq color-convert@2.0.1
tq color-name@1.1.4
tq emoji-regex@8.0.0
tq find-up@4.1.0
tq get-caller-file@2.0.5
tq is-fullwidth-code-point@3.0.0
tq locate-path@5.0.0
tq p-limit@2.3.0
tq p-locate@4.1.0
tq p-try@2.2.0
tq path-exists@4.0.0
tq require-directory@2.1.1
tq require-main-filename@2.0.0
tq set-blocking@2.0.0
tq string-width@4.2.3
tq which-module@2.0.0
tq wrap-ansi@6.2.0
tq y18n@4.0.3
tq yargs-parser@18.1.3
mq yargs@15.4.1
Done in 4.65s.

5. yarn add

$ yarn add https://github.com/an-ivannikov-dev/bitcoin-rpcauth-js.git
yarn add v1.22.19
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 1 new dependency.
info Direct dependencies
mq bitcoin-rpcauth-js@1.0.0
info All dependencies
mq bitcoin-rpcauth-js@1.0.0
Done in 4.24s.

6. ls, cd

$ ls
node_modules  package.json  yarn.lock
[user04@localhost ~]$ cd node_modules/
[user04@localhost node_modules]$ ls
ansi-regex          find-up                  set-blocking
ansi-styles         get-caller-file          string-width
base64url           is-fullwidth-code-point  strip-ansi
bitcoin-rpcauth-js  locate-path              which-module
camelcase           path-exists              wrap-ansi
cliui               p-limit                  y18n
color-convert       p-locate                 yargs
color-name          p-try                    yargs-parser
decamelize          require-directory
emoji-regex         require-main-filename
[user04@localhost node_modules]$ cd bitcoin-rpcauth-js/
[user04@localhost bitcoin-rpcauth-js]$ ls
bin  bitcoin-rpcauth.js  index.js  LICENSE  package.json  README.md  yarn.lock

7. yarn install, version

$ yarn install
yarn install v1.22.19
warning ../../package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 1.00s.
$ yarn -version
1.22.19

8. Create login credentials for a JSON-RPC user

$ yarn start -u=eve
yarn run v1.22.19
warning ../../package.json: No license field
$ node ./bin/bitcoin-rpcauth -u=eve

String to be appended to bitcoin.conf:
rpcauth=eve:53a812e88ef88a90c3b9625460434fa9$13120a7e457d911a8e92c6584edfe77ca3d12e34e555be10c93aad49717bdf07
Your password:
txg9th9wF4YRhOHzH39FiAMNXQva1dUg6bVTz_aEUqg

Done in 0.18s.

9. fill in bitcoin.conf

username=eve
password=txg9th9wF4YRhOHzH39FiAMNXQva1dUg6bVTz_aEUqg
salt=53a812e88ef88a90c3b9625460434fa9
hash=13120a7e457d911a8e92c6584edfe77ca3d12e34e555be10c93aad49717bdf07
rpcuser=eve
rpcpassword=53a812e88ef88a90c3b9625460434fa9$13120a7e457d911a8e92c6584edfe77ca3d12e34e555be10c93aad49717bdf07