Click or drag to resize

Access Authentication

Basic access authentication

In the context of HTTP transactions, basic access authentication is a method for an HTTP user agent (e.g. a web browser) to provide a user name and password when making a request. In basic HTTP authentication, a request contains a header field of the form Authorization: Basic 'credentials'", where credentials is the base64 encoding of id and password joined by a colon.

Running Bitcoin Rhodium node with the server=1 argument tells it to function as a HTTP JSON-RPC server, but Basic access authentication must be used when communicating with it, and, for security reasons, the server by default only accepts connections from other processes on the same machine.

Allowing arbitrary machines to access the JSON-RPC port (using the rpcallowip configuration option) is dangerous and strongly discouraged access should be strictly limited to trusted machines.

Configuration of node

If you don't need to secure the access to API RPC-JSON, just set server=1 only.

In the data folder is file brhodium.conf (created after first run of node) which contains whole configuration

You only need to set these params to activate and configurate basic authentication for Bitcoin Rhodium API RPC-JSON.

C#
####RPC Settings####
#Activate RPC Server (default: 0)
server=1
#Where the RPC Server binds (default: 127.0.0.1 and ::1)
rpcbind=127.0.0.1
#Ip address allowed to connect to RPC (default all: 0.0.0.0 and ::)
rpcallowip=127.0.0.1
rpcuser=loginname
rpcport=16661 (is default testnet port)
rpcpassword=loginpassword
How to work with basic authentication

You can call API RPC-JSON with CURL. You have to add Basic Auth BASE64 hash to your header.

C#
Authorization: Basic bG9naW5uYW1lOmxvZ2lucGFzc3dvcmQ=

Whole CURL example

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic Yzc4dmRmYTJzZjFjOmZnNzgxdmQ0dmc2MQ==' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"rescanblockchain", "params":["1","167"],  "id":1525052699893}]'

You can generate base64 on this link Online header generator. You have to take rpcuser and rpcpassword to generate it.

C#
rpcuser = Username = loginname
rpcpassword = Password = loginpassword

Generated hash loginname:loginpassword is

C#
Authorization: Basic bG9naW5uYW1lOmxvZ2lucGFzc3dvcmQ=