Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
likewhoa
samourai-dojo
Commits
91a5584e
Unverified
Commit
91a5584e
authored
May 15, 2021
by
Pavel Ševčík
Browse files
Merge remote-tracking branch 'upstream/develop' into develop
# Conflicts: # docker/my-dojo/bitcoin/Dockerfile
parents
20173ee2
43ab3507
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
57 additions
and
41 deletions
+57
-41
accounts/api-helper.js
accounts/api-helper.js
+1
-1
accounts/headers-rest-api.js
accounts/headers-rest-api.js
+1
-1
accounts/multiaddr-rest-api.js
accounts/multiaddr-rest-api.js
+2
-2
accounts/support-rest-api.js
accounts/support-rest-api.js
+4
-4
accounts/transactions-rest-api.js
accounts/transactions-rest-api.js
+2
-2
accounts/unspent-rest-api.js
accounts/unspent-rest-api.js
+4
-4
accounts/wallet-rest-api.js
accounts/wallet-rest-api.js
+2
-2
accounts/xpub-rest-api.js
accounts/xpub-rest-api.js
+4
-4
doc/DOCKER_advanced_setups.md
doc/DOCKER_advanced_setups.md
+2
-2
docker/my-dojo/.env
docker/my-dojo/.env
+1
-1
docker/my-dojo/bitcoin/Dockerfile
docker/my-dojo/bitcoin/Dockerfile
+1
-1
docker/my-dojo/explorer/Dockerfile
docker/my-dojo/explorer/Dockerfile
+6
-5
docker/my-dojo/mysql/mysql-default.cnf
docker/my-dojo/mysql/mysql-default.cnf
+2
-1
docker/my-dojo/mysql/mysql-low_mem.cnf
docker/my-dojo/mysql/mysql-low_mem.cnf
+1
-0
docker/my-dojo/node/Dockerfile
docker/my-dojo/node/Dockerfile
+7
-3
docker/my-dojo/node/restart.sh
docker/my-dojo/node/restart.sh
+4
-4
docker/my-dojo/node/wait-for-it.sh
docker/my-dojo/node/wait-for-it.sh
+5
-1
docker/my-dojo/tor/Dockerfile
docker/my-dojo/tor/Dockerfile
+2
-2
docker/my-dojo/whirlpool/Dockerfile
docker/my-dojo/whirlpool/Dockerfile
+5
-1
keys/index-example.js
keys/index-example.js
+1
-0
No files found.
accounts/api-helper.js
View file @
91a5584e
...
...
@@ -109,7 +109,7 @@ class ApiHelper {
* Express middleware validating if entities params are well formed
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateEntitiesParams
(
req
,
res
,
next
)
{
const
params
=
this
.
checkEntitiesParams
(
req
.
query
)
?
req
.
query
:
req
.
body
...
...
accounts/headers-rest-api.js
View file @
91a5584e
...
...
@@ -57,7 +57,7 @@ class HeadersRestApi {
* Validate request arguments
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetHeader
(
req
,
res
,
next
)
{
const
isValidHash
=
validator
.
isHash
(
req
.
params
.
hash
,
'
sha256
'
)
...
...
accounts/multiaddr-rest-api.js
View file @
91a5584e
...
...
@@ -79,7 +79,7 @@ class MultiaddrRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
query
.
active
?
req
.
query
.
active
:
''
}
\
${
req
.
query
.
new
?
req
.
query
.
new
:
''
}
\
${
req
.
query
.
pubkey
?
req
.
query
.
pubkey
:
''
}
\
...
...
@@ -120,7 +120,7 @@ class MultiaddrRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
body
.
active
?
req
.
body
.
active
:
''
}
\
${
req
.
body
.
new
?
req
.
body
.
new
:
''
}
\
${
req
.
body
.
pubkey
?
req
.
body
.
pubkey
:
''
}
\
...
...
accounts/support-rest-api.js
View file @
91a5584e
...
...
@@ -336,7 +336,7 @@ class SupportRestApi {
* Validate arguments related to GET xpub info requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetXpubInfo
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
@@ -353,7 +353,7 @@ class SupportRestApi {
* Validate arguments related to GET xpub rescan requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetXpubRescan
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
@@ -371,7 +371,7 @@ class SupportRestApi {
* Validate arguments related to GET xpub delete requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetXpubDelete
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
@@ -388,7 +388,7 @@ class SupportRestApi {
* Validate arguments related to addresses requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateAddress
(
req
,
res
,
next
)
{
const
isValidAddress
=
validator
.
isAlphanumeric
(
req
.
params
.
addr
)
...
...
accounts/transactions-rest-api.js
View file @
91a5584e
...
...
@@ -112,7 +112,7 @@ class TransactionsRestApi {
* Validate arguments of /tx requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetTransaction
(
req
,
res
,
next
)
{
const
isValidTxid
=
validator
.
isHash
(
req
.
params
.
txid
,
'
sha256
'
)
...
...
@@ -137,7 +137,7 @@ class TransactionsRestApi {
* Validate arguments of /txs requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetTransactions
(
req
,
res
,
next
)
{
const
isValidPage
=
...
...
accounts/unspent-rest-api.js
View file @
91a5584e
...
...
@@ -40,7 +40,7 @@ class UnspentRestApi {
)
this
.
httpServer
.
app
.
post
(
'
/unspent
'
,
'
/unspent
'
,
urlencodedParser
,
authMgr
.
checkAuthentication
.
bind
(
authMgr
),
apiHelper
.
validateEntitiesParams
.
bind
(
apiHelper
),
...
...
@@ -79,7 +79,7 @@ class UnspentRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
query
.
active
?
req
.
query
.
active
:
''
}
\
${
req
.
query
.
new
?
req
.
query
.
new
:
''
}
\
${
req
.
query
.
pubkey
?
req
.
query
.
pubkey
:
''
}
\
...
...
@@ -120,7 +120,7 @@ class UnspentRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
body
.
active
?
req
.
body
.
active
:
''
}
\
${
req
.
body
.
new
?
req
.
body
.
new
:
''
}
\
${
req
.
body
.
pubkey
?
req
.
body
.
pubkey
:
''
}
\
...
...
@@ -134,4 +134,4 @@ class UnspentRestApi {
}
module
.
exports
=
UnspentRestApi
\ No newline at end of file
module
.
exports
=
UnspentRestApi
accounts/wallet-rest-api.js
View file @
91a5584e
...
...
@@ -78,7 +78,7 @@ class WalletRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
query
.
active
?
req
.
query
.
active
:
''
}
\
${
req
.
query
.
new
?
req
.
query
.
new
:
''
}
\
${
req
.
query
.
pubkey
?
req
.
query
.
pubkey
:
''
}
\
...
...
@@ -119,7 +119,7 @@ class WalletRestApi {
}
finally
{
if
(
debugApi
)
{
const
strParams
=
const
strParams
=
`
${
req
.
body
.
active
?
req
.
body
.
active
:
''
}
\
${
req
.
body
.
new
?
req
.
body
.
new
:
''
}
\
${
req
.
body
.
pubkey
?
req
.
body
.
pubkey
:
''
}
\
...
...
accounts/xpub-rest-api.js
View file @
91a5584e
...
...
@@ -404,7 +404,7 @@ class XPubRestApi {
* Validate arguments of postXpub requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsPostXpub
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
body
.
xpub
)
...
...
@@ -436,7 +436,7 @@ class XPubRestApi {
* Validate arguments of getXpub requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsGetXpub
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
@@ -456,7 +456,7 @@ class XPubRestApi {
* Validate arguments of postLockXpub requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsPostLockXpub
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
@@ -480,7 +480,7 @@ class XPubRestApi {
* Validate arguments of deleteXpub requests
* @param {object} req - http request object
* @param {object} res - http response object
* @param {function} next - next
express
middleware
* @param {function} next - next
tiny-http
middleware
*/
validateArgsDeleteXpub
(
req
,
res
,
next
)
{
const
isValidXpub
=
validator
.
isAlphanumeric
(
req
.
params
.
xpub
)
...
...
doc/DOCKER_advanced_setups.md
View file @
91a5584e
...
...
@@ -11,7 +11,7 @@ A word of caution, though, the default values of these options try to maximize y
-
[
Local Electrum server used as data source for imports/rescans
](
#local_electrum
)
-
[
Local Whirlpool client
](
#local_whirlpool
)
-
[
External Bitcoin full node
](
#external_bitcoind
)
-
[
bitcoind RPC API an
s
ZMQ notifications exposed to external apps
](
#exposed_rpc_zmq
)
-
[
bitcoind RPC API an
d
ZMQ notifications exposed to external apps
](
#exposed_rpc_zmq
)
-
[
Static onion address for bitcoind hidden service
](
#static_onion
)
-
[
Configure Tor Bridges
](
#tor_bridges
)
-
[
Support of testnet
](
#testnet
)
...
...
@@ -282,7 +282,7 @@ Follow these steps if you want to speed up this operation by preloading an archi
<a
name=
"exposed_rpc_zmq"
/>
## bitcoind RPC API an
s
ZMQ notifications exposed to external apps ##
## bitcoind RPC API an
d
ZMQ notifications exposed to external apps ##
By default, access to the RPC API of your bitcoind is restricted to Docker containers hosted on the "dojonet" network.
...
...
docker/my-dojo/.env
View file @
91a5584e
...
...
@@ -17,7 +17,7 @@ DOJO_BITCOIND_VERSION_TAG=1.12.0
DOJO_NODEJS_VERSION_TAG=1.10.0
DOJO_NGINX_VERSION_TAG=1.6.0
DOJO_TOR_VERSION_TAG=1.8.0
DOJO_EXPLORER_VERSION_TAG=1.
6
.0
DOJO_EXPLORER_VERSION_TAG=1.
7
.0
DOJO_INDEXER_VERSION_TAG=1.3.0
DOJO_WHIRLPOOL_VERSION_TAG=1.4.0
...
...
docker/my-dojo/bitcoin/Dockerfile
View file @
91a5584e
FROM
debian:buster
FROM
debian:buster
-slim
#################################################################
...
...
docker/my-dojo/explorer/Dockerfile
View file @
91a5584e
FROM
node:12-buster
FROM
node:12-alpine
ENV
NODE_ENV production
ENV
APP_DIR /home/node/app
ENV
EXPLORER_URL https://github.com/janoside/btc-rpc-explorer/archive
ENV
EXPLORER_VERSION 3.
0.0
ENV
EXPLORER_VERSION 3.
1.1
# Install netcat
RUN
set
-ex
&&
\
apt-get update
&&
\
apt-get
install
-y
netcat
apk
--no-cache
add bash gcc g++ make python3 git netcat-openbsd
# Download the source code and install it
RUN
set
-ex
&&
\
...
...
@@ -29,4 +30,4 @@ RUN chown node:node "$APP_DIR/restart.sh" && \
EXPOSE
3002
USER
node
\ No newline at end of file
USER
node
docker/my-dojo/mysql/mysql-default.cnf
View file @
91a5584e
[mysqld]
sql_mode="NO_ENGINE_SUBSTITUTION"
\ No newline at end of file
sql_mode="NO_ENGINE_SUBSTITUTION"
transaction_isolation=READ-COMMITTED
\ No newline at end of file
docker/my-dojo/mysql/mysql-low_mem.cnf
View file @
91a5584e
[mysqld]
sql_mode="NO_ENGINE_SUBSTITUTION"
transaction_isolation=READ-COMMITTED
performance_schema=off
innodb_buffer_pool_size=128M
innodb_buffer_pool_chunk_size=16M
...
...
docker/my-dojo/node/Dockerfile
View file @
91a5584e
FROM
node:12-buster
FROM
node:12-alpine
ENV
NODE_ENV production
ENV
APP_DIR /home/node/app
ARG
TOR_LINUX_GID
RUN
set
-ex
&&
\
apk
--no-cache
add shadow bash gcc g++ make python3
# Add node user to tor group
RUN
addgroup
-
-system
-g
id
${
TOR_LINUX_GID
}
tor
&&
\
RUN
addgroup
-
S
-g
${
TOR_LINUX_GID
}
tor
&&
\
usermod
-a
-G
tor node
# Install forever
...
...
@@ -40,4 +44,4 @@ RUN chown node:node "$APP_DIR/wait-for-it.sh" && \
chmod
u+x
"
$APP_DIR
/wait-for-it.sh"
&&
\
chmod
g+x
"
$APP_DIR
/wait-for-it.sh"
USER
node
\ No newline at end of file
USER
node
docker/my-dojo/node/restart.sh
View file @
91a5584e
#!/bin/bash
cd
/home/node/app/accounts
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
"
$COMMON_BTC_NETWORK
"
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
cd
/home/node/app/pushtx
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
"
$COMMON_BTC_NETWORK
"
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index-orchestrator.js
"
$COMMON_BTC_NETWORK
"
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index-orchestrator.js
cd
/home/node/app/tracker
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
"
$COMMON_BTC_NETWORK
"
forever start
-a
-l
/dev/stdout
-o
/dev/null
-e
/dev/null index.js
# Keep the container up
while
true
...
...
docker/my-dojo/node/wait-for-it.sh
View file @
91a5584e
...
...
@@ -146,7 +146,11 @@ WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
WAITFORIT_TIMEOUT_PATH
=
$(
realpath
$WAITFORIT_TIMEOUT_PATH
2>/dev/null
||
readlink
-f
$WAITFORIT_TIMEOUT_PATH
)
if
[[
$WAITFORIT_TIMEOUT_PATH
=
~
"busybox"
]]
;
then
WAITFORIT_ISBUSY
=
1
WAITFORIT_BUSYTIMEFLAG
=
"-t"
# Check if busybox timeout uses -t flag
# (recent Alpine versions don't support -t anymore)
if
timeout
&>/dev/stdout |
grep
-q
-e
'-t '
;
then
WAITFORIT_BUSYTIMEFLAG
=
"-t"
fi
else
WAITFORIT_ISBUSY
=
0
...
...
docker/my-dojo/tor/Dockerfile
View file @
91a5584e
FROM
debian:buster
FROM
debian:buster
-slim
ENV
TOR_HOME /var/lib/tor
ENV
TOR_URL https://dist.torproject.org
...
...
@@ -24,7 +24,7 @@ ARG TOR_LINUX_GID
# Install Tor
RUN
set
-ex
&&
\
apt-get update
&&
\
apt-get
install
-y
git libevent-dev zlib1g-dev libssl-dev gcc make automake ca-certificates autoconf musl-dev coreutils gpg wget
&&
\
apt-get
install
-y
git libevent-dev zlib1g-dev libssl-dev gcc make automake ca-certificates autoconf musl-dev coreutils gpg wget
python3
&&
\
mkdir
-p
/usr/local/src/
&&
\
cd
/usr/local/src
&&
\
res
=
0
;
\
...
...
docker/my-dojo/whirlpool/Dockerfile
View file @
91a5584e
FROM
debian:buster
FROM
debian:buster
-slim
ENV
WHIRLPOOL_HOME /home/whirlpool
ENV
WHIRLPOOL_DIR /usr/local/whirlpool-cli
...
...
@@ -8,8 +8,12 @@ ARG WHIRLPOOL_LINUX_GID
# Install prerequisites
# Create group & user whirlpool
# Create /usr/share/man/man1 directory
# Create .whirlpool-cli subdirectory of WHIRLPOOL_HOME
# Create /usr/local/src/whirlpool-cli directory
RUN
mkdir
-p
/usr/share/man/man1
RUN
set
-ex
&&
\
apt-get update
&&
\
apt-get
install
-y
libevent-dev zlib1g-dev libssl-dev gcc make automake ca-certificates autoconf musl-dev coreutils gpg wget default-jdk
&&
\
...
...
keys/index-example.js
View file @
91a5584e
...
...
@@ -6,6 +6,7 @@
/**
* Desired structure of /keys/index.js, which is ignored in the repository.
* index.js should store only one of the 2 sets of parameters (mainnet or testnet)
*/
module
.
exports
=
{
/*
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment