-
Notifications
You must be signed in to change notification settings - Fork 83
Feat/btcd nodes #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lucasdbr05
wants to merge
10
commits into
bitcoin-dev-project:main
Choose a base branch
from
lucasdbr05:feat/btcd-nodes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Feat/btcd nodes #810
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4adca40
feat(charts): add btcd Helm chart
lucasdbr05 f9bf6cc
feat(examples): add btcd example
lucasdbr05 d91ef48
feat(btcd): add btcd support to core warnet modules
lucasdbr05 f0711c2
refactor: restart policy on failure for 6_node_btcd example
lucasdbr05 81167f4
feat(btcd): add BtcdRPC framework to interact with btcd nodes
lucasdbr05 56742b2
test: add scenarios related to btcd nodes
lucasdbr05 0d5f6de
refactor(btcd): move btcd logic to a dedicated module
lucasdbr05 c657935
style(btcd): apply ruff lint and format fixes to btcd_rpc_test
lucasdbr05 fc73ef5
lint
pinheadmz d473f09
fix: complete btcd integration follow-ups
lucasdbr05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| nodes: | ||
| - name: tank-0001 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0002 | ||
| - tank-0003 | ||
| - name: tank-0002 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0003 | ||
| - tank-0004 | ||
| - name: tank-0003 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0004 | ||
| - tank-0005 | ||
| - name: tank-0004 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0005 | ||
| - tank-0006 | ||
| - name: tank-0005 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| addnode: | ||
| - tank-0006 | ||
| - name: tank-0006 | ||
| implementation: btcd | ||
| image: | ||
| repository: lucasdbr05/btcd | ||
| tag: "latest" | ||
| caddy: | ||
| enabled: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| chain: regtest | ||
|
|
||
| implementation: btcd | ||
| restartPolicy: OnFailure | ||
|
|
||
| # TODO: find a better approach to can mine blocks (this address is just for tests) | ||
| config: | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have |
||
| miningaddr=bcrt1qthmht0k2qnh3wy7336z05lu2km7emzfpm3wg46 | ||
|
|
||
| collectLogs: true | ||
| metricsExport: false | ||
|
|
||
| resources: {} | ||
|
|
||
| image: | ||
| repository: lucasdbr05/btcd | ||
| pullPolicy: IfNotPresent | ||
| tag: "latest" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v2 | ||
| name: btcd | ||
| description: A Helm chart for btcd (alternative Bitcoin full node in Go) | ||
|
|
||
| # Application chart | ||
| type: application | ||
|
|
||
| version: 0.1.0 | ||
| appVersion: 0.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Thank you for installing {{ include "btcd.fullname" . }}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "btcd.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| */}} | ||
| {{- define "btcd.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "btcd.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "btcd.labels" -}} | ||
| helm.sh/chart: {{ include "btcd.chart" . }} | ||
| {{ include "btcd.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "btcd.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "btcd.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Map chain name to btcd config file flag | ||
| */}} | ||
| {{- define "btcd.chainFlag" -}} | ||
| {{- if eq .Values.global.chain "regtest" -}} | ||
| regtest=1 | ||
| {{- else if eq .Values.global.chain "signet" -}} | ||
| signet=1 | ||
| {{- else if eq .Values.global.chain "testnet" -}} | ||
| testnet=1 | ||
| {{- else -}} | ||
| {{/* mainnet: no flag needed */}} | ||
| {{- end -}} | ||
| {{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| data: | ||
| btcd.conf: | | ||
| {{ include "btcd.chainFlag" . }} | ||
| rpclisten=0.0.0.0:{{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| rpcuser={{ .Values.global.rpcuser }} | ||
| rpcpass={{ .Values.global.rpcpassword }} | ||
| listen=0.0.0.0:{{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| debuglevel=info | ||
| txindex=1 | ||
| {{- $p2pPort := index .Values.global .Values.global.chain "P2PPort" }} | ||
| {{- range .Values.addnode }} | ||
| {{- printf "addpeer=%s:%v" . $p2pPort | nindent 4 }} | ||
| {{- end }} | ||
| {{- .Values.config | nindent 4 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| {{- with .Values.podLabels }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| chain: {{ .Values.global.chain }} | ||
| P2PPort: "{{ index .Values.global .Values.global.chain "P2PPort" }}" | ||
| RPCPort: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}" | ||
| rpcuser: {{ .Values.global.rpcuser }} | ||
| rpcpassword: {{ .Values.global.rpcpassword }} | ||
| app: {{ include "btcd.fullname" . }} | ||
| implementation: btcd | ||
| {{- if .Values.collectLogs }} | ||
| collect_logs: "true" | ||
| {{- end }} | ||
| annotations: | ||
| init_peers: "{{ .Values.addnode | len }}" | ||
| addconnection_peers: {{ default (list) .Values.addconnection | toJson | quote }} | ||
| spec: | ||
| restartPolicy: "{{ .Values.restartPolicy }}" | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| securityContext: | ||
| {{- toYaml .Values.podSecurityContext | nindent 4 }} | ||
| {{- if .Values.loadSnapshot.enabled }} | ||
| initContainers: | ||
| - name: download-blocks | ||
| image: alpine:latest | ||
| command: ["/bin/sh", "-c"] | ||
| args: | ||
| - | | ||
| apk add --no-cache curl | ||
| mkdir -p /root/.btcd/data | ||
| curl -L {{ .Values.loadSnapshot.url }} | tar -xz -C /root/.btcd/data | ||
| volumeMounts: | ||
| - name: data | ||
| mountPath: /root/.btcd | ||
| {{- end }} | ||
| containers: | ||
| - name: btcd | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 8 }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: | ||
| - "/bin/linux_amd64/btcd" | ||
| args: | ||
| - "--configfile=/root/.btcd/btcd.conf" | ||
| {{- if .Values.extraArgs }} | ||
| {{- range (split " " .Values.extraArgs) }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| ports: | ||
| - name: rpc | ||
| containerPort: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| protocol: TCP | ||
| - name: p2p | ||
| containerPort: {{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| protocol: TCP | ||
| livenessProbe: | ||
| {{- toYaml .Values.livenessProbe | nindent 8 }} | ||
| readinessProbe: | ||
| {{- toYaml .Values.readinessProbe | nindent 8 }} | ||
| tcpSocket: | ||
| port: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| resources: | ||
| {{- toYaml .Values.resources | nindent 8 }} | ||
| volumeMounts: | ||
| {{- with .Values.volumeMounts }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| - mountPath: /root/.btcd | ||
| name: data | ||
| - mountPath: /root/.btcd/btcd.conf | ||
| name: config | ||
| subPath: btcd.conf | ||
| {{- if .Values.metricsExport }} | ||
| - name: prometheus | ||
| image: bitcoindevproject/bitcoin-exporter:latest | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - name: prom-metrics | ||
| containerPort: {{ .Values.prometheusMetricsPort }} | ||
| protocol: TCP | ||
| env: | ||
| - name: BITCOIN_RPC_HOST | ||
| value: "127.0.0.1" | ||
| - name: BITCOIN_RPC_PORT | ||
| value: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}" | ||
| - name: BITCOIN_RPC_USER | ||
| value: {{ .Values.global.rpcuser }} | ||
| - name: BITCOIN_RPC_PASSWORD | ||
| value: {{ .Values.global.rpcpassword }} | ||
| {{- end }} | ||
| {{- with .Values.extraContainers }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| volumes: | ||
| {{- with .Values.volumes }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| - name: data | ||
| {{- if .Values.persistence.enabled }} | ||
| {{- if .Values.persistence.existingClaim }} | ||
| persistentVolumeClaim: | ||
| claimName: {{ .Values.persistence.existingClaim }} | ||
| {{- else }} | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data | ||
| {{- end }} | ||
| {{- else }} | ||
| emptyDir: {} | ||
| {{- end }} | ||
| - name: config | ||
| configMap: | ||
| name: {{ include "btcd.fullname" . }} | ||
| {{- with .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| annotations: | ||
| "helm.sh/resource-policy": keep | ||
| spec: | ||
| accessModes: | ||
| - {{ .Values.persistence.accessMode }} | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.persistence.size }} | ||
| {{- if .Values.persistence.storageClass }} | ||
| storageClassName: {{ .Values.persistence.storageClass }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "btcd.fullname" . }} | ||
| labels: | ||
| {{- include "btcd.labels" . | nindent 4 }} | ||
| app: {{ include "btcd.fullname" . }} | ||
| spec: | ||
| type: {{ .Values.service.type }} | ||
| ports: | ||
| - port: {{ index .Values.global .Values.global.chain "RPCListenPort" }} | ||
| targetPort: rpc | ||
| protocol: TCP | ||
| name: rpc | ||
| - port: {{ index .Values.global .Values.global.chain "P2PPort" }} | ||
| targetPort: p2p | ||
| protocol: TCP | ||
| name: p2p | ||
| - port: {{ .Values.prometheusMetricsPort }} | ||
| targetPort: prom-metrics | ||
| protocol: TCP | ||
| name: prometheus-metrics | ||
| selector: | ||
| {{- include "btcd.selectorLabels" . | nindent 4 }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c47fbbb
Is this required for btcd? For lnd for example we expect it to crash and restart a few times on deployment while it waits for the bitcoin core node to come up. However, for bitcoin core itself we usually don't want this, because if bitcoin core crashes we don't want it to silently restart, we want to know why it crashed.