bitcoin-teleport / teleport-transactions

CoinSwap implementation
Other
236 stars 70 forks source link

Support cookie-based RPC authentication (Bitcoin Core) #10

Closed theStack closed 3 years ago

theStack commented 3 years ago

This PR is a first step towards supporting cookie-based RPC authentication, as offered by Bitcoin Core since v0.12.

A constant RPC_CREDENTIALS is introduced that determines the RPC authentication method: if credentials are set (i.e. Some(user, pass)), user-pass-authentication is used, otherwise (i.e. None), authentication is cookie-based.

Note that by now the cookie-file is assumed to reside in ~/.bitcoin/regtest/.cookie and thus this authentication method will only work for Linux (also *BSD I guess?) and regtest network. Tested successfully with Debian 10 and Bitcoin Core 0.21.0.

If this PR gets accepted, there are a few possible follow-ups I could think of: