warnet 0.9.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. warnet-0.9.9/.dockerignore +16 -0
  2. warnet-0.9.9/.github/workflows/deploy.yml +60 -0
  3. warnet-0.9.9/.github/workflows/publish-dist.yml +94 -0
  4. warnet-0.9.9/.github/workflows/test.yml +110 -0
  5. warnet-0.9.9/.gitignore +8 -0
  6. warnet-0.9.9/LICENSE +21 -0
  7. warnet-0.9.9/MANIFEST.in +11 -0
  8. warnet-0.9.9/PKG-INFO +88 -0
  9. warnet-0.9.9/README.md +28 -0
  10. warnet-0.9.9/docs/data.md +42 -0
  11. warnet-0.9.9/docs/developer-notes.md +21 -0
  12. warnet-0.9.9/docs/graph.md +85 -0
  13. warnet-0.9.9/docs/install.md +84 -0
  14. warnet-0.9.9/docs/lightning.md +97 -0
  15. warnet-0.9.9/docs/machines.webp +0 -0
  16. warnet-0.9.9/docs/monitoring.md +32 -0
  17. warnet-0.9.9/docs/quickrun.md +44 -0
  18. warnet-0.9.9/docs/random_internet_as_graph_n100.png +0 -0
  19. warnet-0.9.9/docs/release-process.md +29 -0
  20. warnet-0.9.9/docs/running.md +117 -0
  21. warnet-0.9.9/docs/scenarios.md +47 -0
  22. warnet-0.9.9/docs/services.md +1 -0
  23. warnet-0.9.9/docs/warcli.md +271 -0
  24. warnet-0.9.9/justfile +115 -0
  25. warnet-0.9.9/pyproject.toml +59 -0
  26. warnet-0.9.9/requirements.in +14 -0
  27. warnet-0.9.9/requirements.txt +121 -0
  28. warnet-0.9.9/scripts/apidocs.py +61 -0
  29. warnet-0.9.9/scripts/build-k8s-rpc.sh +45 -0
  30. warnet-0.9.9/scripts/graphdocs.py +51 -0
  31. warnet-0.9.9/setup.cfg +4 -0
  32. warnet-0.9.9/src/__init__.py +0 -0
  33. warnet-0.9.9/src/test_framework/__init__.py +0 -0
  34. warnet-0.9.9/src/test_framework/address.py +227 -0
  35. warnet-0.9.9/src/test_framework/authproxy.py +189 -0
  36. warnet-0.9.9/src/test_framework/bdb.py +151 -0
  37. warnet-0.9.9/src/test_framework/bip340_test_vectors.csv +16 -0
  38. warnet-0.9.9/src/test_framework/blockfilter.py +49 -0
  39. warnet-0.9.9/src/test_framework/blocktools.py +236 -0
  40. warnet-0.9.9/src/test_framework/coverage.py +113 -0
  41. warnet-0.9.9/src/test_framework/descriptors.py +64 -0
  42. warnet-0.9.9/src/test_framework/ellswift.py +163 -0
  43. warnet-0.9.9/src/test_framework/ellswift_decode_test_vectors.csv +77 -0
  44. warnet-0.9.9/src/test_framework/key.py +351 -0
  45. warnet-0.9.9/src/test_framework/messages.py +1906 -0
  46. warnet-0.9.9/src/test_framework/muhash.py +110 -0
  47. warnet-0.9.9/src/test_framework/netutil.py +160 -0
  48. warnet-0.9.9/src/test_framework/p2p.py +807 -0
  49. warnet-0.9.9/src/test_framework/psbt.py +140 -0
  50. warnet-0.9.9/src/test_framework/ripemd160.py +130 -0
  51. warnet-0.9.9/src/test_framework/script.py +928 -0
  52. warnet-0.9.9/src/test_framework/script_util.py +127 -0
  53. warnet-0.9.9/src/test_framework/secp256k1.py +346 -0
  54. warnet-0.9.9/src/test_framework/segwit_addr.py +141 -0
  55. warnet-0.9.9/src/test_framework/siphash.py +65 -0
  56. warnet-0.9.9/src/test_framework/socks5.py +162 -0
  57. warnet-0.9.9/src/test_framework/test_framework.py +1010 -0
  58. warnet-0.9.9/src/test_framework/test_node.py +892 -0
  59. warnet-0.9.9/src/test_framework/test_shell.py +78 -0
  60. warnet-0.9.9/src/test_framework/util.py +551 -0
  61. warnet-0.9.9/src/test_framework/wallet.py +426 -0
  62. warnet-0.9.9/src/test_framework/wallet_util.py +143 -0
  63. warnet-0.9.9/src/test_framework/xswiftec_inv_test_vectors.csv +33 -0
  64. warnet-0.9.9/src/warnet/__init__.py +0 -0
  65. warnet-0.9.9/src/warnet/backend/__init__.py +0 -0
  66. warnet-0.9.9/src/warnet/backend/kubernetes_backend.py +881 -0
  67. warnet-0.9.9/src/warnet/cli/__init__.py +0 -0
  68. warnet-0.9.9/src/warnet/cli/bitcoin.py +55 -0
  69. warnet-0.9.9/src/warnet/cli/cluster.py +193 -0
  70. warnet-0.9.9/src/warnet/cli/graph.py +127 -0
  71. warnet-0.9.9/src/warnet/cli/image.py +28 -0
  72. warnet-0.9.9/src/warnet/cli/image_build.py +97 -0
  73. warnet-0.9.9/src/warnet/cli/ln.py +39 -0
  74. warnet-0.9.9/src/warnet/cli/main.py +98 -0
  75. warnet-0.9.9/src/warnet/cli/network.py +159 -0
  76. warnet-0.9.9/src/warnet/cli/rpc.py +35 -0
  77. warnet-0.9.9/src/warnet/cli/scenarios.py +110 -0
  78. warnet-0.9.9/src/warnet/cln.py +196 -0
  79. warnet-0.9.9/src/warnet/graphs/__init__.py +3 -0
  80. warnet-0.9.9/src/warnet/graphs/default.graphml +81 -0
  81. warnet-0.9.9/src/warnet/lnchannel.py +148 -0
  82. warnet-0.9.9/src/warnet/lnd.py +191 -0
  83. warnet-0.9.9/src/warnet/lnnode.py +99 -0
  84. warnet-0.9.9/src/warnet/logging_config/config.json +64 -0
  85. warnet-0.9.9/src/warnet/scenarios/__init__.py +0 -0
  86. warnet-0.9.9/src/warnet/scenarios/ln_init.py +186 -0
  87. warnet-0.9.9/src/warnet/scenarios/miner_std.py +78 -0
  88. warnet-0.9.9/src/warnet/scenarios/sens_relay.py +43 -0
  89. warnet-0.9.9/src/warnet/scenarios/tx_flood.py +71 -0
  90. warnet-0.9.9/src/warnet/scenarios/utils.py +5 -0
  91. warnet-0.9.9/src/warnet/schema/__init__.py +3 -0
  92. warnet-0.9.9/src/warnet/schema/graph_schema.json +80 -0
  93. warnet-0.9.9/src/warnet/scripts/quick_start.sh +179 -0
  94. warnet-0.9.9/src/warnet/server.py +606 -0
  95. warnet-0.9.9/src/warnet/services.py +36 -0
  96. warnet-0.9.9/src/warnet/status.py +9 -0
  97. warnet-0.9.9/src/warnet/tank.py +194 -0
  98. warnet-0.9.9/src/warnet/templates/Dockerfile +88 -0
  99. warnet-0.9.9/src/warnet/templates/Dockerfile_sidecar +12 -0
  100. warnet-0.9.9/src/warnet/templates/__init__.py +3 -0
  101. warnet-0.9.9/src/warnet/templates/addrman.patch +51 -0
  102. warnet-0.9.9/src/warnet/templates/addrman_observer_config.toml +8 -0
  103. warnet-0.9.9/src/warnet/templates/archive/fluent.conf +28 -0
  104. warnet-0.9.9/src/warnet/templates/docker_entrypoint.sh +47 -0
  105. warnet-0.9.9/src/warnet/templates/entrypoint.sh +43 -0
  106. warnet-0.9.9/src/warnet/templates/fork_observer_config.toml +31 -0
  107. warnet-0.9.9/src/warnet/templates/grafana-provisioning/dashboards/10619_rev1.json +1782 -0
  108. warnet-0.9.9/src/warnet/templates/grafana-provisioning/dashboards/10619_rev2.json +1260 -0
  109. warnet-0.9.9/src/warnet/templates/grafana-provisioning/dashboards/bitcoin_rpc_scraper.json +340 -0
  110. warnet-0.9.9/src/warnet/templates/grafana-provisioning/dashboards/dashboards.yml +11 -0
  111. warnet-0.9.9/src/warnet/templates/grafana-provisioning/datasources/loki.yml +11 -0
  112. warnet-0.9.9/src/warnet/templates/grafana-provisioning/datasources/prometheus.yml +10 -0
  113. warnet-0.9.9/src/warnet/templates/isroutable.patch +14 -0
  114. warnet-0.9.9/src/warnet/templates/k8s/connect_logging.sh +8 -0
  115. warnet-0.9.9/src/warnet/templates/k8s/grafana/values.yaml +13 -0
  116. warnet-0.9.9/src/warnet/templates/k8s/install_logging.sh +13 -0
  117. warnet-0.9.9/src/warnet/templates/k8s/loki/values.yaml +15 -0
  118. warnet-0.9.9/src/warnet/templates/rpc/Dockerfile_rpc +29 -0
  119. warnet-0.9.9/src/warnet/templates/rpc/Dockerfile_rpc.dockerignore +16 -0
  120. warnet-0.9.9/src/warnet/templates/rpc/Dockerfile_rpc_dev +32 -0
  121. warnet-0.9.9/src/warnet/templates/rpc/entrypoint.sh +38 -0
  122. warnet-0.9.9/src/warnet/templates/rpc/livenessProbe.sh +7 -0
  123. warnet-0.9.9/src/warnet/templates/rpc/namespace.yaml +13 -0
  124. warnet-0.9.9/src/warnet/templates/rpc/rbac-config.yaml +60 -0
  125. warnet-0.9.9/src/warnet/templates/rpc/warnet-rpc-service.yaml +21 -0
  126. warnet-0.9.9/src/warnet/templates/rpc/warnet-rpc-statefulset-dev.yaml +49 -0
  127. warnet-0.9.9/src/warnet/templates/rpc/warnet-rpc-statefulset.yaml +23 -0
  128. warnet-0.9.9/src/warnet/templates/tor/Dockerfile_tor_da +18 -0
  129. warnet-0.9.9/src/warnet/templates/tor/Dockerfile_tor_relay +17 -0
  130. warnet-0.9.9/src/warnet/templates/tor/tor-entrypoint.sh +7 -0
  131. warnet-0.9.9/src/warnet/templates/tor/tor-keys/authority_certificate +45 -0
  132. warnet-0.9.9/src/warnet/templates/tor/tor-keys/authority_identity_key +41 -0
  133. warnet-0.9.9/src/warnet/templates/tor/tor-keys/authority_signing_key +27 -0
  134. warnet-0.9.9/src/warnet/templates/tor/tor-keys/ed25519_master_id_public_key +0 -0
  135. warnet-0.9.9/src/warnet/templates/tor/tor-keys/ed25519_master_id_secret_key +0 -0
  136. warnet-0.9.9/src/warnet/templates/tor/tor-keys/ed25519_signing_cert +0 -0
  137. warnet-0.9.9/src/warnet/templates/tor/tor-keys/ed25519_signing_secret_key +0 -0
  138. warnet-0.9.9/src/warnet/templates/tor/tor-keys/secret_id_key +15 -0
  139. warnet-0.9.9/src/warnet/templates/tor/tor-keys/secret_onion_key +15 -0
  140. warnet-0.9.9/src/warnet/templates/tor/tor-keys/secret_onion_key_ntor +0 -0
  141. warnet-0.9.9/src/warnet/templates/tor/torrc +34 -0
  142. warnet-0.9.9/src/warnet/templates/tor/torrc.da +41 -0
  143. warnet-0.9.9/src/warnet/templates/tor/torrc.relay +37 -0
  144. warnet-0.9.9/src/warnet/test_framework_bridge.py +406 -0
  145. warnet-0.9.9/src/warnet/utils.py +481 -0
  146. warnet-0.9.9/src/warnet/warnet.py +286 -0
  147. warnet-0.9.9/src/warnet.egg-info/PKG-INFO +88 -0
  148. warnet-0.9.9/src/warnet.egg-info/SOURCES.txt +169 -0
  149. warnet-0.9.9/src/warnet.egg-info/dependency_links.txt +1 -0
  150. warnet-0.9.9/src/warnet.egg-info/entry_points.txt +3 -0
  151. warnet-0.9.9/src/warnet.egg-info/requires.txt +48 -0
  152. warnet-0.9.9/src/warnet.egg-info/top_level.txt +2 -0
  153. warnet-0.9.9/test/__init__.py +0 -0
  154. warnet-0.9.9/test/build_branch_test.py +57 -0
  155. warnet-0.9.9/test/dag_connection_test.py +52 -0
  156. warnet-0.9.9/test/data/12_node_ring.graphml +69 -0
  157. warnet-0.9.9/test/data/LN_10.json +1191 -0
  158. warnet-0.9.9/test/data/LN_100.json +6190 -0
  159. warnet-0.9.9/test/data/build_v24_test.graphml +19 -0
  160. warnet-0.9.9/test/data/ln.graphml +70 -0
  161. warnet-0.9.9/test/data/permutations.graphml +86 -0
  162. warnet-0.9.9/test/data/services.graphml +26 -0
  163. warnet-0.9.9/test/data/ten_semi_unconnected.graphml +94 -0
  164. warnet-0.9.9/test/framework_tests/__init__.py +0 -0
  165. warnet-0.9.9/test/framework_tests/connect_dag.py +136 -0
  166. warnet-0.9.9/test/graph_test.py +114 -0
  167. warnet-0.9.9/test/ln_test.py +127 -0
  168. warnet-0.9.9/test/onion_test.py +71 -0
  169. warnet-0.9.9/test/rpc_test.py +75 -0
  170. warnet-0.9.9/test/scenarios_test.py +86 -0
  171. warnet-0.9.9/test/test_base.py +218 -0
@@ -0,0 +1,16 @@
1
+ .git
2
+
3
+ **/__pycache__
4
+ .trunk
5
+ .venv
6
+ build
7
+ dist
8
+ **/*.egg-info
9
+ **/*.egg/
10
+ **/*.pyc
11
+ **/*.swp
12
+
13
+ frontend
14
+ .ruff_cache
15
+ .idea
16
+ .ignored_extras
@@ -0,0 +1,60 @@
1
+ name: deploy
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["test"]
6
+ types:
7
+ - completed
8
+
9
+ jobs:
10
+ deploy-to-dockerhub:
11
+ runs-on: ubuntu-latest
12
+ if: >
13
+ github.event.workflow_run.conclusion == 'success'
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: Set up QEMU
17
+ uses: docker/setup-qemu-action@v3
18
+ - name: Set up Docker Buildx
19
+ uses: docker/setup-buildx-action@v3
20
+ - name: Docker meta
21
+ id: meta
22
+ uses: docker/metadata-action@v5
23
+ with:
24
+ images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}
25
+ tags: |
26
+ type=ref,event=tag
27
+ type=ref,event=pr
28
+ type=raw,value=latest,enable={{is_default_branch}}
29
+ labels: |
30
+ maintainer=bitcoindevproject
31
+ org.opencontainers.image.title=warnet-rpc
32
+ org.opencontainers.image.description=Warnet RPC server
33
+ - name: Login to Docker Hub
34
+ uses: docker/login-action@v3
35
+ with:
36
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
37
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
38
+ - name: Build and push production RPC image
39
+ uses: docker/build-push-action@v5
40
+ with:
41
+ file: src/templates/rpc/Dockerfile_rpc
42
+ platforms: linux/amd64,linux/arm64
43
+ context: .
44
+ push: true
45
+ tags: ${{ steps.meta.outputs.tags }}
46
+ labels: ${{ steps.meta.outputs.labels }}
47
+ cache-from: type=gha
48
+ cache-to: type=gha,mode=max
49
+ - name: Build and push dev RPC image
50
+ if: github.ref == 'refs/heads/main'
51
+ uses: docker/build-push-action@v5
52
+ with:
53
+ file: src/templates/rpc/Dockerfile_rpc_dev
54
+ platforms: linux/amd64,linux/arm64
55
+ context: .
56
+ push: true
57
+ tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}:dev
58
+ labels: ${{ steps.meta.outputs.labels }}
59
+ cache-from: type=gha
60
+ cache-to: type=gha,mode=max
@@ -0,0 +1,94 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.x"
16
+ - name: Install pypa/build
17
+ run: >-
18
+ python3 -m
19
+ pip install
20
+ build
21
+ --user
22
+ - name: Build a binary wheel and a source tarball
23
+ run: python3 -m build
24
+ - name: Store the distribution packages
25
+ uses: actions/upload-artifact@v3
26
+ with:
27
+ name: python-package-distributions
28
+ path: dist/
29
+
30
+ publish-to-pypi:
31
+ name: >-
32
+ Publish Python 🐍 distribution 📦 to PyPI
33
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34
+ needs:
35
+ - build
36
+ runs-on: ubuntu-latest
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/warnet
40
+ permissions:
41
+ id-token: write # IMPORTANT: mandatory for trusted publishing
42
+
43
+ steps:
44
+ - name: Download all the dists
45
+ uses: actions/download-artifact@v3
46
+ with:
47
+ name: python-package-distributions
48
+ path: dist/
49
+ - name: Publish distribution 📦 to PyPI
50
+ uses: pypa/gh-action-pypi-publish@release/v1
51
+
52
+ github-release:
53
+ name: >-
54
+ Sign the Python 🐍 distribution 📦 with Sigstore
55
+ and upload them to GitHub Release
56
+ needs:
57
+ - publish-to-pypi
58
+ runs-on: ubuntu-latest
59
+
60
+ permissions:
61
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
62
+ id-token: write # IMPORTANT: mandatory for sigstore
63
+
64
+ steps:
65
+ - name: Download all the dists
66
+ uses: actions/download-artifact@v3
67
+ with:
68
+ name: python-package-distributions
69
+ path: dist/
70
+ - name: Sign the dists with Sigstore
71
+ uses: sigstore/gh-action-sigstore-python@v2.1.1
72
+ with:
73
+ inputs: >-
74
+ ./dist/*.tar.gz
75
+ ./dist/*.whl
76
+ - name: Create GitHub Release
77
+ env:
78
+ GITHUB_TOKEN: ${{ github.token }}
79
+ run: >-
80
+ gh release create
81
+ '${{ github.ref_name }}'
82
+ --repo '${{ github.repository }}'
83
+ --notes ""
84
+ - name: Upload artifact signatures to GitHub Release
85
+ env:
86
+ GITHUB_TOKEN: ${{ github.token }}
87
+ # Upload to GitHub Release using the `gh` CLI.
88
+ # `dist/` contains the built packages, and the
89
+ # sigstore-produced signatures and certificates.
90
+ run: >-
91
+ gh release upload
92
+ '${{ github.ref_name }}' dist/**
93
+ --repo '${{ github.repository }}'
94
+
@@ -0,0 +1,110 @@
1
+ name: test
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ ruff:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: chartboost/ruff-action@v1
15
+ ruff-format:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ # - uses: chartboost/ruff-action@v1
20
+ # Until this gets updated we need to use this commit hash (or later)
21
+ - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b
22
+ with:
23
+ args: 'format --check'
24
+ changed-files: 'true'
25
+ build-image:
26
+ needs: [ruff, ruff-format]
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@v4
31
+
32
+ - name: Set up Docker Buildx
33
+ uses: docker/setup-buildx-action@v3
34
+
35
+ - name: Build and export
36
+ uses: docker/build-push-action@v5
37
+ with:
38
+ file: src/warnet/templates/rpc/Dockerfile_rpc
39
+ context: .
40
+ tags: warnet/dev
41
+ cache-from: type=gha
42
+ cache-to: type=gha,mode=max
43
+ outputs: type=docker,dest=/tmp/warnet.tar
44
+
45
+ - name: Upload artifact
46
+ uses: actions/upload-artifact@v4
47
+ with:
48
+ name: warnet
49
+ path: /tmp/warnet.tar
50
+ test:
51
+ needs: [build-image]
52
+ runs-on: ubuntu-latest
53
+ strategy:
54
+ matrix:
55
+ test: [scenarios_test.py, rpc_test.py, graph_test.py, ln_test.py, dag_connection_test.py]
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+ - uses: hynek/setup-cached-uv@v1
59
+ - uses: medyagh/setup-minikube@master
60
+ with:
61
+ mount-path: ${{ github.workspace }}:/mnt/src
62
+ - uses: actions/download-artifact@v4
63
+ with:
64
+ name: warnet
65
+ path: /tmp
66
+ - run: |
67
+ echo loading the image directly into minikube docker
68
+ eval $(minikube -p minikube docker-env)
69
+ docker load --input /tmp/warnet.tar
70
+ docker image ls -a
71
+
72
+ echo Installing warnet python package for cli
73
+ uv venv
74
+ uv pip install -e .
75
+
76
+ echo "Contents of warnet-rpc-statefulset-dev.yaml being used:"
77
+ cat src/warnet/templates/rpc/warnet-rpc-statefulset-dev.yaml
78
+
79
+ echo Setting up k8s
80
+ kubectl apply -f src/warnet/templates/rpc/namespace.yaml
81
+ kubectl apply -f src/warnet/templates/rpc/rbac-config.yaml
82
+ kubectl apply -f src/warnet/templates/rpc/warnet-rpc-service.yaml
83
+ kubectl apply -f src/warnet/templates/rpc/warnet-rpc-statefulset-dev.yaml
84
+ kubectl config set-context --current --namespace=warnet
85
+
86
+ echo sleeping for 30s to give k8s time to boot
87
+ sleep 30
88
+ kubectl describe pod rpc-0
89
+ kubectl logs rpc-0
90
+
91
+ echo Waiting for rpc-0 to come online
92
+ until kubectl get pod rpc-0 --namespace=warnet; do
93
+ echo "Waiting for server to find pod rpc-0..."
94
+ sleep 4
95
+ done
96
+ kubectl wait --for=condition=Ready --timeout=2m pod rpc-0
97
+ shell: bash
98
+ - run: |
99
+ kubectl port-forward svc/rpc 9276:9276 &
100
+ - name: Run tests
101
+ run: |
102
+ source .venv/bin/activate
103
+ ./test/${{matrix.test}}
104
+ # build-test:
105
+ # needs: [build-image]
106
+ # runs-on: ubuntu-latest
107
+ # steps:
108
+ # - uses: actions/checkout@v4
109
+ # - uses: ./.github/actions/compose
110
+ # - run: ./test/build_branch_test.py compose
@@ -0,0 +1,8 @@
1
+ .vscode
2
+ __pycache__
3
+ .venv
4
+ warnet.egg-info
5
+ .python-version
6
+ .env
7
+ dist/
8
+ build/
warnet-0.9.9/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 The Warnet Developers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ include src/warnet/schema/*.json
2
+ include src/warnet/templates/bitcoin.conf
3
+ include src/warnet/templates/fork_observer_config.toml
4
+ include src/warnet/templates/addrman_observer_config.toml
5
+ include src/warnet/templates/addrman.patch
6
+ include src/warnet/templates/isroutable.patch
7
+ include src/warnet/scripts/quick_start.sh
8
+ graft src/warnet/templates/k8s
9
+ graft src/warnet/templates/rpc
10
+ graft src/warnet/templates/grafana-provisioning
11
+ graft src/warnet/logging_config
warnet-0.9.9/PKG-INFO ADDED
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.1
2
+ Name: warnet
3
+ Version: 0.9.9
4
+ Summary: Monitor and analyze the emergent behaviours of bitcoin networks
5
+ License: MIT
6
+ Project-URL: Homepage, https://warnet.dev
7
+ Project-URL: GitHub, https://github.com/bitcoindevproject/warnet
8
+ Keywords: bitcoin,warnet
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: attrs==23.2.0
14
+ Requires-Dist: blinker==1.7.0
15
+ Requires-Dist: cachetools==5.3.2
16
+ Requires-Dist: certifi==2023.11.17
17
+ Requires-Dist: charset-normalizer==3.3.2
18
+ Requires-Dist: click==8.1.7
19
+ Requires-Dist: docker==7.0.0
20
+ Requires-Dist: flask==3.0.0
21
+ Requires-Dist: flask-jsonrpc==1.1.0
22
+ Requires-Dist: google-auth==2.25.2
23
+ Requires-Dist: idna==3.6
24
+ Requires-Dist: itsdangerous==2.1.2
25
+ Requires-Dist: jinja2==3.1.2
26
+ Requires-Dist: jsonrpcclient==4.0.3
27
+ Requires-Dist: jsonrpcserver==5.0.9
28
+ Requires-Dist: jsonschema==4.20.0
29
+ Requires-Dist: jsonschema-specifications==2023.12.1
30
+ Requires-Dist: kubernetes==28.1.0
31
+ Requires-Dist: markdown-it-py==3.0.0
32
+ Requires-Dist: markupsafe==2.1.3
33
+ Requires-Dist: mdurl==0.1.2
34
+ Requires-Dist: networkx==3.2.1
35
+ Requires-Dist: numpy==1.26.2
36
+ Requires-Dist: oauthlib==3.2.2
37
+ Requires-Dist: oslash==0.6.3
38
+ Requires-Dist: packaging==23.2
39
+ Requires-Dist: pyasn1==0.5.1
40
+ Requires-Dist: pyasn1-modules==0.3.0
41
+ Requires-Dist: pygments==2.17.2
42
+ Requires-Dist: python-dateutil==2.8.2
43
+ Requires-Dist: pyyaml==6.0.1
44
+ Requires-Dist: referencing==0.32.0
45
+ Requires-Dist: requests==2.29.0
46
+ Requires-Dist: requests-oauthlib==1.3.1
47
+ Requires-Dist: rich==13.7.0
48
+ Requires-Dist: rpds-py==0.16.2
49
+ Requires-Dist: rsa==4.9
50
+ Requires-Dist: six==1.16.0
51
+ Requires-Dist: tabulate==0.9.0
52
+ Requires-Dist: typeguard==2.13.3
53
+ Requires-Dist: typing-extensions==4.9.0
54
+ Requires-Dist: urllib3==1.26.18
55
+ Requires-Dist: websocket-client==1.7.0
56
+ Requires-Dist: werkzeug==3.0.1
57
+ Provides-Extra: build
58
+ Requires-Dist: twine; extra == "build"
59
+ Requires-Dist: build; extra == "build"
60
+
61
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/pyproject.toml)
62
+ # Warnet
63
+
64
+ Monitor and analyze the emergent behaviors of Bitcoin networks.
65
+
66
+ ## Major Features
67
+
68
+ * Launch a bitcoin network with a specified number of nodes connected to each other according to a network topology from a graphml file.
69
+ * Scenarios can be run across the network which can be programmed using the Bitcoin Core functional [test_framework language](https://github.com/bitcoin/bitcoin/tree/master/test/functional).
70
+ * Nodes can have traffic shaping parameters assigned to them via the graph using [tc-netem](https://manpages.ubuntu.com/manpages/trusty/man8/tc-netem.8.html) tool.
71
+ * Data from nodes can be collected and searched including log files and p2p messages.
72
+ * Performance data from containers can be monitored and visualized.
73
+ * Lightning Network nodes can be deployed and operated.
74
+ * Networks can be deployed using Kubernetes, e.g. via MiniKube (small network graphs) or a managed cluster for larger network graphs.
75
+
76
+ ## Documentation
77
+
78
+ - [Installation](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/install.md)
79
+ - [Quick Run](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/quickrun.md)
80
+ - [Running Warnet](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/running.md)
81
+ - [Network Topology](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/graph.md)
82
+ - [CLI Commands](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/warcli.md)
83
+ - [Scenarios](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/scenarios.md)
84
+ - [Data Collection](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/data.md)
85
+ - [Monitoring](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/monitoring.md)
86
+ - [Lightning Network](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/lightning.md)
87
+
88
+ ![warnet-art](https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/docs/machines.webp)
warnet-0.9.9/README.md ADDED
@@ -0,0 +1,28 @@
1
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/pyproject.toml)
2
+ # Warnet
3
+
4
+ Monitor and analyze the emergent behaviors of Bitcoin networks.
5
+
6
+ ## Major Features
7
+
8
+ * Launch a bitcoin network with a specified number of nodes connected to each other according to a network topology from a graphml file.
9
+ * Scenarios can be run across the network which can be programmed using the Bitcoin Core functional [test_framework language](https://github.com/bitcoin/bitcoin/tree/master/test/functional).
10
+ * Nodes can have traffic shaping parameters assigned to them via the graph using [tc-netem](https://manpages.ubuntu.com/manpages/trusty/man8/tc-netem.8.html) tool.
11
+ * Data from nodes can be collected and searched including log files and p2p messages.
12
+ * Performance data from containers can be monitored and visualized.
13
+ * Lightning Network nodes can be deployed and operated.
14
+ * Networks can be deployed using Kubernetes, e.g. via MiniKube (small network graphs) or a managed cluster for larger network graphs.
15
+
16
+ ## Documentation
17
+
18
+ - [Installation](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/install.md)
19
+ - [Quick Run](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/quickrun.md)
20
+ - [Running Warnet](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/running.md)
21
+ - [Network Topology](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/graph.md)
22
+ - [CLI Commands](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/warcli.md)
23
+ - [Scenarios](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/scenarios.md)
24
+ - [Data Collection](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/data.md)
25
+ - [Monitoring](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/monitoring.md)
26
+ - [Lightning Network](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/lightning.md)
27
+
28
+ ![warnet-art](https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/docs/machines.webp)
@@ -0,0 +1,42 @@
1
+ # Data Collection
2
+
3
+ ## Bitcoin Core logs
4
+
5
+ Complete log output from a Bitcoin Core node can be retrieved by RPC `debug-log` using
6
+ its network name and graph node index.
7
+
8
+ Example:
9
+
10
+ ```
11
+ $ warcli debug-log 0 --network=v25_test
12
+
13
+
14
+ 2023-10-11T17:54:39.616974Z Bitcoin Core version v25.0.0 (release build)
15
+ 2023-10-11T17:54:39.617209Z Using the 'arm_shani(1way,2way)' SHA256 implementation
16
+ 2023-10-11T17:54:39.628852Z Default data directory /home/bitcoin/.bitcoin
17
+ ... (etc)
18
+ ```
19
+
20
+ ## Aggregated logs from all nodes
21
+
22
+ Aggregated logs can be searched using RPC `grep-logs` with regex patterns.
23
+
24
+ Example:
25
+
26
+ ```
27
+ $ warcli grep-logs 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d
28
+
29
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:48.716582Z [miner] AddToWallet 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d newupdate
30
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:48.717787Z [miner] Submitting wtx 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d to mempool for relay
31
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:48.717929Z [validation] Enqueuing TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
32
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:48.718040Z [validation] TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
33
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:48.723017Z [miner] AddToWallet 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d
34
+ warnet_test_uhynisdj_tank_000007: 2023-10-11T17:44:52.173199Z [validation] Enqueuing TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
35
+ warnet_test_uhynisdj_tank_000007: 2023-10-11T17:44:52.173237Z [mempool] AcceptToMemoryPool: peer=0: accepted 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d (poolsz 1 txn, 1 kB)
36
+ warnet_test_uhynisdj_tank_000007: 2023-10-11T17:44:52.173303Z [validation] TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
37
+ warnet_test_uhynisdj_tank_000001: 2023-10-11T17:44:52.172963Z [mempool] Removed 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d from set of unbroadcast txns
38
+ warnet_test_uhynisdj_tank_000002: 2023-10-11T17:44:52.325655Z [validation] Enqueuing TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
39
+ warnet_test_uhynisdj_tank_000002: 2023-10-11T17:44:52.325691Z [mempool] AcceptToMemoryPool: peer=1: accepted 94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d (poolsz 1 txn, 1 kB)
40
+ warnet_test_uhynisdj_tank_000002: 2023-10-11T17:44:52.325838Z [validation] TransactionAddedToMempool: txid=94cacabc09b024b56dcbed9ccad15c90340c596e883159bcb5f1d2152997322d wtxid=0cc875e73bb0bd8f892b70b8d1e5154aab64daace8d571efac94c62b8c1da3cf
41
+ ... (etc)
42
+ ```
@@ -0,0 +1,21 @@
1
+ # Developer notes
2
+
3
+ ## Kubernetes
4
+
5
+ Kubernetes is running the RPC server as a `statefulSet` which is pulled from a
6
+ container image on a registry. This means that (local) changes to the RPC
7
+ server are **not** reflected on the RPC server when running in Kubernetes,
8
+ unless you **also** push an updated image to a registry and update the
9
+ Kubernetes config files.
10
+
11
+ To help with this a helper script is provided: [build-k8s-rpc.sh](../scripts/build-k8s-rpc.sh).
12
+
13
+ This script can be run in the following way:
14
+
15
+ ```bash
16
+ DOCKER_REGISTRY=bitcoindevproject/warnet-rpc TAG=0.1 ./scripts/build-k8s-rpc.sh Dockerfile_rpc
17
+ ```
18
+
19
+ You can optionally specify `LATEST=1` to also include the `latest` tag on docker hub.
20
+
21
+ Once a new image has been pushed, it should be referenced in [warnet-rpc-statefulset.yaml](../src/warnet/templates/warnet-rpc-statefulset.yaml) in the `image` field.
@@ -0,0 +1,85 @@
1
+ # Warnet Network Topology
2
+
3
+ Warnet creates a Bitcoin network using a network topology from a [graphml](https://graphml.graphdrawing.org/specification.html) file.
4
+
5
+ Before any scenarios or RPC commands can be executed, a Warnet network must be started from a graph.
6
+ See [warcli.md](warcli.md) for more details on these commands.
7
+
8
+ To start a network called `"warnet"` from the [default graph file](../src/graphs/default.graphml):
9
+ ```
10
+ warcli network start
11
+ ```
12
+
13
+ To start a network with custom configurations:
14
+ ```
15
+ warcli network start <path/to/file.graphml> --network="network_name"
16
+ ```
17
+
18
+ ## Creating graphs automatically
19
+
20
+ Graphs can be created via the graph menu:
21
+
22
+ ```bash
23
+ # show graph commands
24
+ warcli graph --help
25
+
26
+ # Create a cycle graph of 12 nodes using default Bitcoin Core version (v26.0)
27
+ warcli graph create 12 --outfile=./12_x_v26.0.graphml
28
+
29
+ # Start network with default name "warnet"
30
+ warcli network start ./12_x_v26.0.graphml
31
+ ```
32
+
33
+ ## Warnet graph nodes and edges
34
+
35
+ Nodes in a Warnet graph MUST have either a `"version"` key or an `"image"` key.
36
+ These dictate what version of Bitcoin Core to deploy in a fiven tank.
37
+
38
+ Edges without additional properties are interpreted as Bitcoin p2p connections.
39
+ If an edge has additional key-value properties, it will be interpreted as a
40
+ lightning network channel (see [lightning.md](lightning.md)).
41
+
42
+ ## GraphML file specification
43
+
44
+ ### GraphML file format and headers
45
+ ```xml
46
+ <?xml version="1.0" encoding="UTF-8"?><graphml xmlns="http://graphml.graphdrawing.org/xmlns">
47
+ <key id="services" attr.name="services" attr.type="string" for="graph" />
48
+ <key id="version" attr.name="version" attr.type="string" for="node" />
49
+ <key id="image" attr.name="image" attr.type="string" for="node" />
50
+ <key id="bitcoin_config" attr.name="bitcoin_config" attr.type="string" for="node" />
51
+ <key id="tc_netem" attr.name="tc_netem" attr.type="string" for="node" />
52
+ <key id="exporter" attr.name="exporter" attr.type="boolean" for="node" />
53
+ <key id="collect_logs" attr.name="collect_logs" attr.type="boolean" for="node" />
54
+ <key id="build_args" attr.name="build_args" attr.type="string" for="node" />
55
+ <key id="ln" attr.name="ln" attr.type="string" for="node" />
56
+ <key id="ln_image" attr.name="ln_image" attr.type="string" for="node" />
57
+ <key id="ln_cb_image" attr.name="ln_cb_image" attr.type="string" for="node" />
58
+ <key id="ln_config" attr.name="ln_config" attr.type="string" for="node" />
59
+ <key id="channel_open" attr.name="channel_open" attr.type="string" for="edge" />
60
+ <key id="source_policy" attr.name="source_policy" attr.type="string" for="edge" />
61
+ <key id="target_policy" attr.name="target_policy" attr.type="string" for="edge" />
62
+ <graph edgedefault="directed">
63
+ <!-- <nodes> -->
64
+ <!-- <edges> -->
65
+ </graph>
66
+ </graphml>
67
+ ```
68
+
69
+ | key | for | type | default | explanation |
70
+ |----------------|-------|---------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
71
+ | services | graph | string | | A space-separated list of extra service containers to deploy in the network. See [docs/services.md](services.md) for complete list of available services |
72
+ | version | node | string | | Bitcoin Core version with an available Warnet tank image on Dockerhub. May also be a GitHub repository with format user/repository:branch to build from source code |
73
+ | image | node | string | | Bitcoin Core Warnet tank image on Dockerhub with the format repository/image:tag |
74
+ | bitcoin_config | node | string | | A string of Bitcoin Core options in command-line format, e.g. '-debug=net -blocksonly' |
75
+ | tc_netem | node | string | | A tc-netem command as a string beginning with 'tc qdisc add dev eth0 root netem' |
76
+ | exporter | node | boolean | False | Whether to attach a Prometheus data exporter to the tank |
77
+ | collect_logs | node | boolean | False | Whether to collect Bitcoin Core debug logs with Promtail |
78
+ | build_args | node | string | | A string of configure options used when building Bitcoin Core from source code, e.g. '--without-gui --disable-tests' |
79
+ | ln | node | string | | Attach a lightning network node of this implementation (currently only supports 'lnd') |
80
+ | ln_image | node | string | | Specify a lightning network node image from Dockerhub with the format repository/image:tag |
81
+ | ln_cb_image | node | string | | Specify a lnd Circuit Breaker image from Dockerhub with the format repository/image:tag |
82
+ | ln_config | node | string | | A string of arguments for the lightning network node in command-line format, e.g. '--protocol.wumbo-channels --bitcoin.timelockdelta=80' |
83
+ | channel_open | edge | string | | Indicate that this edge is a lightning channel with these arguments passed to lnd openchannel |
84
+ | source_policy | edge | string | | Update the channel originator policy by passing these arguments passed to lnd updatechanpolicy |
85
+ | target_policy | edge | string | | Update the channel partner policy by passing these arguments passed to lnd updatechanpolicy |