diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..419c36a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: Build Debian Package +on: + workflow_call: + inputs: + version: + description: 'Version to build' + required: false + type: string + default: "1.0.0" + revision: + description: 'Revision to build' + required: false + type: string + default: ${{ github.run_attempt }} + environment: + description: 'Environment where the secrets are stored' + required: false + type: string + secrets: + GPG_PRIVATE_KEY: + description: 'GPG private key' + required: false + GPG_PASSPHRASE: + description: 'GPG passphrase' + required: false + +jobs: + build-deb: + name: Build and attach .deb and .whl packages + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Poetry + uses: pantos-io/ci-workflows/.github/actions/install-poetry@v1 + + - name: Check secrets + id: is-signed-build + run: | + echo "HAS_SECRETS=$(if [ -n "$GPG_PRIVATE_KEY" ] && [ -n "$GPG_PASSPHRASE" ]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: Import GPG key + if: steps.is-signed-build.outputs.HAS_SECRETS == 'true' + id: import-gpg + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Install signing dependencies + if: steps.is-signed-build.outputs.HAS_SECRETS == 'true' + run: | + sudo apt-get update + sudo apt-get install -y debsigs + + - name: Build package + run: | + make debian + make wheel + env: + PANTOS_SERVICE_NODE_VERSION: ${{ inputs.version }} + PANTOS_SERVICE_NODE_REVISION: ${{ inputs.revision }} + + - name: Sign package + if: steps.is-signed-build.outputs.HAS_SECRETS == 'true' + run: | + debsigs --sign=origin -k ${{ steps.import-gpg.outputs.keyid }} dist/*.deb + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: build + path: dist/* diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 701f45d..8dbbffd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,3 +10,66 @@ jobs: shared: uses: pantos-io/ci-workflows/.github/workflows/python-ci.yml@v1 secrets: inherit + + docker-build: + name: Build Docker images + runs-on: ubuntu-latest + needs: [shared] + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + id: buildx + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-v1.0-service-node-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-v1.0-service-node- + + - name: Build and load + run: | + docker buildx bake \ + --set "*.cache-from=type=local,src=/tmp/.buildx-cache" \ + --set "*.cache-to=type=local,dest=/tmp/.buildx-cache-new" \ + --set "*.platform=linux/amd64" \ + --builder ${{ steps.buildx.outputs.name }} \ + -f docker-compose.yml \ + --load + + - name: Create local keystore + run: | + echo "1234" >> password.keystore + mkdir keystore_folder + docker run --rm -v=.:/local ethereum/client-go account new --keystore /local/keystore_folder --password /local/password.keystore + sudo chmod -R 777 keystore_folder + mv keystore_folder/UTC* ./keystore + + - name: Create local signer_key + run: | + echo "1234" >> password.key + python3 -m venv .venv + source .venv/bin/activate + pip3 install pycryptodome==3.18.0 + chmod +x scripts/generate-signer-key.py + cat password.key | ./scripts/generate-signer-key.py + mv signer-key*.pem signer_key.pem + + # - name: Test image + # run: | + # docker compose up -d + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + build: + needs: [shared] + uses: ./.github/workflows/build.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c8383ce --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,322 @@ +name: Release Workflow +run-name: ${{ (github.event.release.prerelease && 'Beta') || 'Prod'}} Release for ${{ github.repository }} - ${{ github.event.release.tag_name }} +on: + release: + # Triggered on Pre-Releases and Releases + types: [released, prereleased] + +# Only allow one release at the time +concurrency: + group: deploy-${{ github.repository }}-release-${{ github.event.release.prerelease }} + +jobs: + define-environment: + name: Define Environment + runs-on: ubuntu-latest + if: (!github.event.release.draft) + outputs: + deployment_environment: ${{ steps.get-environment.outputs.deployment_environment }} + deployment_longname: ${{ steps.get-environment.outputs.deployment_longname }} + deployment_version: ${{ steps.get-environment.outputs.deployment_version }} + deployment_pypi_environment: ${{ steps.get-environment.outputs.deployment_pypi_environment }} + deployment_url: ${{ steps.get-environment.outputs.deployment_url }} + steps: + - name: Configure Environment + id: get-environment + run: | + wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver + chmod +x /usr/local/bin/semver + if [[ $(semver validate ${{ github.event.release.tag_name }}) == "invalid" ]]; then + echo "::error title=Invalid Release::Release must be tagged with a valid SemVer version" + exit 1 + fi + TAG=${{ github.event.release.tag_name }} + echo "deployment_version=${TAG#v}" >> $GITHUB_OUTPUT + if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then + echo "::notice title=Deployment Environment::Deployment for Test" + echo "deployment_environment=-rc" >> $GITHUB_OUTPUT + echo "deployment_longname=Beta" >> $GITHUB_OUTPUT + echo "deployment_pypi_environment=test-pypi" >> $GITHUB_OUTPUT + echo "deployment_url=https://test.pypi.org/p/pantos-service-node" >> $GITHUB_OUTPUT + else + echo "::notice title=Deployment Environment::Deployment for Prod" + echo "deployment_environment=" >> $GITHUB_OUTPUT + echo "deployment_longname=Prod" >> $GITHUB_OUTPUT + echo "deployment_pypi_environment=pypi" >> $GITHUB_OUTPUT + echo "deployment_url=https://pypi.org/p/pantos-service-node" >> $GITHUB_OUTPUT + fi + + publish-docker: + name: Publish docker image for ${{ needs.define-environment.outputs.deployment_longname }} + needs: [define-environment, build] + environment: + name: dockerhub + url: ${{ steps.set-output-url.outputs.deployment_dockerhub_url }} + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + token: ${{ secrets.GH_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + id: buildx + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-v1.0-service-node-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-v1.0-service-node- + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: actions/download-artifact@v4 + with: + name: build + path: dist + + - name: Rename built artifacts + run: | + for file in dist/*.deb; do + mv "$file" "${file%.deb}-signed.deb" + done + + - name: Build and push the images + run: | + docker buildx bake \ + --set "*.cache-from=type=local,src=/tmp/.buildx-cache" \ + --set "*.cache-to=type=local,dest=/tmp/.buildx-cache-new" \ + --set "*.platform=linux/amd64,linux/arm64" \ + --builder ${{ steps.buildx.outputs.name }} \ + --push \ + -f docker-compose.yml \ + app worker + env: + PANTOS_SERVICE_NODE_VERSION: ${{ needs.define-environment.outputs.deployment_version }} + PANTOS_SERVICE_NODE_REVISION: ${{ github.run_attempt }} + DOCKER_TAG: ${{ github.event.release.tag_name }}${{ needs.define-environment.outputs.deployment_environment }} + + - name: Set output url + id: set-output-url + run: | + echo "deployment_dockerhub_url=https://hub.docker.com/r/pantosio/service-node/tags?name=${{ github.event.release.tag_name }}${{ needs.define-environment.outputs.deployment_environment }}" >> $GITHUB_OUTPUT + + - uses: sigstore/cosign-installer@main + + - name: Sign the images + run: | + for app in $(docker buildx bake -f docker-compose.yml --print --progress "plain" | jq -r '.target[].tags | add'); do + for image in $(docker buildx imagetools inspect $app --raw | jq -r '.manifests[].digest'); do + echo "Signing $image from $app"; + cosign sign --yes --verbose "${app%%:*}@$image"; + done; + done; + env: + DOCKER_TAG: ${{ github.event.release.tag_name }}${{ needs.define-environment.outputs.deployment_environment }} + COSIGN_EXPERIMENTAL: "true" + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + build: + name: Build and attach .deb and .whl package + needs: [define-environment] + uses: ./.github/workflows/build.yml + secrets: 'inherit' + with: + # We need to use a semver that doesn't start with a v as debian will remove it anyways + version: ${{ needs.define-environment.outputs.deployment_version }} + revision: "${{ github.event.release.prerelease && 'rc' || '' }}${{ github.run_attempt }}" + environment: debian-release + + add-assets: + name: Add Assets to the ${{ github.event.release.tag_name }} Release + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: build + path: dist + + # We need to upload some artifacts, any, so that the download action works + - name: Upload release assets + uses: svenstaro/upload-release-action@v2 + with: + file: "./dist/*.deb" + file_glob: true + overwrite: true + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.release.tag_name }} + + # We need to upload some artifacts, any, so that the download action works + - uses: robinraju/release-downloader@v1.9 + with: + tag: ${{ github.event.release.tag_name }} + tarBall: true + zipBall: true + fileName: '*' + out-file-path: release + preRelease: ${{ github.event.release.prerelease }} + token: ${{ secrets.GH_TOKEN }} + + - name: List directory + run: | + cp dist/*.whl release/ + # Do not sign deb artifacts + rm release/*.deb + + - uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: release/* + + - uses: actions/upload-artifact@v4 + with: + name: signed-build + path: release/*.whl + + - name: Merge with previous files + run: | + cp dist/*.deb release/ + ls -lha release + + - name: Upload release assets + uses: svenstaro/upload-release-action@v2 + with: + file: "./release/*" + file_glob: true + overwrite: true + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.release.tag_name }} + + publish-pypi: + name: Publish to ${{ needs.define-environment.outputs.deployment_pypi_environment }} + needs: [define-environment, add-assets] + runs-on: ubuntu-latest + environment: + name: ${{ needs.define-environment.outputs.deployment_pypi_environment }} + url: ${{ needs.define-environment.outputs.deployment_url }} + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + token: ${{ secrets.GH_TOKEN }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + cache: 'pip' + + - uses: actions/download-artifact@v4 + with: + name: signed-build + path: dist + + - name: List directory + run: | + ls -lha . + ls -lha dist + + - name: Publish package distributions to ${{ needs.define-environment.outputs.deployment_pypi_environment }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: ${{ needs.define-environment.outputs.deployment_pypi_environment == 'test-pypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }} + + publish-ppa: + name: Publishes assets to the PPA as ${{ github.event.release.tag_name }} + needs: [add-assets] + # Disable the job for the moment being + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: build + path: dist + + - name: List directory + run: | + ls -lha . + ls -lha dist + mkdir -p release + mv dist/*.deb release/ + + - name: Add index file + run: | + # Source: https://stackoverflow.com/questions/39048654/how-to-enable-directory-indexing-on-github-pages + cat > index.html<< 'EOF' + + + + + + + EOF + working-directory: release + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Prepare PPA + run: | + gpg --armor --export > ./KEY.gpg + dpkg-scanpackages --multiversion . > Packages + gzip -k -f Packages + working-directory: release + + - name: Create Release files + run: | + apt-ftparchive release . > Release + gpg -abs -o - Release > Release.gpg + gpg --clearsign -o - Release > InRelease + url="$(gh api "repos/pantos-io/servicenode/pages" --jq '.html_url')" + echo "Using URL: $url" + echo "deb [signed-by=/etc/apt/trusted.gpg.d/servicenode.gpg] $url ./" > pantos-servicenode.list + working-directory: release + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Publish to GH Pages + uses: peaceiris/actions-gh-pages@v3 + with: + personal_token: ${{ secrets.GH_TOKEN }} + publish_dir: release + publish_branch: ppa + external_repository: pantos-io/servicenode + full_commit_message: "Publishing ${{ github.event.release.tag_name }} to the PPA" diff --git a/Makefile b/Makefile index 6b2cc2d..40f83c8 100644 --- a/Makefile +++ b/Makefile @@ -66,9 +66,9 @@ coverage-all: .PHONY: tar tar: dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION).tar.gz -dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION).tar.gz: pantos/ service-node-config.yml service-node-config.publish.env bids.yml alembic.ini pantos-service-node.sh pantos-service-node-worker.sh +dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION).tar.gz: pantos/ service-node-config.yml service-node-config.env bids.yml alembic.ini pantos-service-node.sh pantos-service-node-worker.sh cp service-node-config.yml pantos/service-node-config.yml - cp service-node-config.publish.env pantos/service-node-config.env + cp service-node-config.env pantos/service-node-config.env cp bids.yml pantos/bids.yml cp alembic.ini pantos/alembic.ini cp pantos-service-node.sh pantos/pantos-service-node.sh @@ -86,9 +86,9 @@ dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION).tar.gz: pantos/ service- .PHONY: wheel wheel: dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION)-py3-none-any.whl -dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION)-py3-none-any.whl: pantos/ service-node-config.yml service-node-config.publish.env bids.yml alembic.ini +dist/pantos_service_node-$(PANTOS_SERVICE_NODE_VERSION)-py3-none-any.whl: pantos/ service-node-config.yml service-node-config.env bids.yml alembic.ini cp service-node-config.yml pantos/service-node-config.yml - cp service-node-config.publish.env pantos/service-node-config.env + cp service-node-config.env pantos/service-node-config.env cp bids.yml pantos/bids.yml cp alembic.ini pantos/alembic.ini poetry build -f wheel diff --git a/bids.yaml b/bids.yaml deleted file mode 100644 index 353f2bb..0000000 --- a/bids.yaml +++ /dev/null @@ -1,331 +0,0 @@ -blockchains: - ethereum: - ethereum: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - ethereum: - - execution_time: 600 - fee: 10000000000 - valid_period: 300 - - execution_time: 1200 - fee: 8500000000 - valid_period: 300 - bnb_chain: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - avalanche: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - polygon: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - cronos: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - fantom: - - execution_time: 600 - fee: 200000000 - valid_period: 300 - - execution_time: 1200 - fee: 150000000 - valid_period: 300 - celo: - - execution_time: 600 - fee: 50000000 - valid_period: 300 - \ No newline at end of file diff --git a/pantos-service-node.conf b/pantos-service-node.conf deleted file mode 100644 index 8cc77f1..0000000 --- a/pantos-service-node.conf +++ /dev/null @@ -1,201 +0,0 @@ -application: - debug: false - url: https://sn1.testnet.pantos.io/ - log: - format: json - console: - enabled: true - file: - enabled: false - name: /var/log/pantos/service-node.log - max_bytes: 104857600 - backup_count: 10 - -database: - url: postgresql: - pool_size: 20 - max_overflow: 50 - echo: false - -celery: - broker: amqp: - backend: db+postgresql: - log: - format: json - console: - enabled: true - file: - enabled: false - name: /var/log/pantos/service-node-worker.log - max_bytes: 104857600 - backup_count: 10 - -plugins: - bids: - class: pantos.servicenode.plugins.bids.ConfigFileBidPlugin - arguments: - file_path: /pantos-servicenode/bids.yaml - -signer: - pem_path: /pantos-servicenode/signer_key.pem - pem_password: - -tasks: - confirm_transfer: - interval: 120 - retry_interval_after_error: 300 - execute_transfer: - retry_interval_after_error: 120 - -blockchains: - avalanche: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://api-eu1.tatum.io/v3/blockchain/node/AVAX/ - fallback_providers: - - https://api.avax-test.network/ext/bc/C/rpc - average_block_time: 3 - provider_timeout: 100 - chain_id: 43113 - hub: '0xbafFb84601BeC1FCb4B842f8917E3eA850781BE7' - forwarder: '0xb06fA5184355f92264a7e9cbc9D72D6886dBaeC6' - pan_token: '0xC892F1D09a7BEF98d65e7f9bD4642d36BC506441' - confirmations: 20 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - bnb_chain: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://api-eu1.tatum.io/v3/blockchain/node/BSC/ - fallback_providers: - - https://data-seed-prebsc-1-s1.binance.org:8545/ - average_block_time: 3 - provider_timeout: 100 - chain_id: 97 - hub: '0xFB37499DC5401Dc39a0734df1fC7924d769721d5' - forwarder: '0x1C48A203AC0F21664268ad69b8fa7a6105Bd2C38' - pan_token: '0xC892F1D09a7BEF98d65e7f9bD4642d36BC506441' - confirmations: 20 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - celo: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://api-eu1.tatum.io/v3/blockchain/node/CELO/ - fallback_providers: - - https://alfajores-forno.celo-testnet.org - average_block_time: 5 - provider_timeout: 100 - chain_id: 44787 - hub: '0x8389B9A7608dbf52a699b998f309883257923C0E' - forwarder: '0xFB37499DC5401Dc39a0734df1fC7924d769721d5' - pan_token: '0x5538e600dc919f72858dd4D4F5E4327ec6f2af60' - confirmations: 3 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - cronos: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://evm-t3.cronos.org - average_block_time: 6 - provider_timeout: 100 - chain_id: 338 - hub: '0x0Cfb3c7C11A33BEf124A9D86073e73932b9AbF90' - forwarder: '0xa5be3feb2B217671E7DC653705a8F9eDd41ACBE0' - pan_token: '0x5538e600dc919f72858dd4D4F5E4327ec6f2af60' - confirmations: 3 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - ethereum: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://ethereum-holesky.publicnode.com - average_block_time: 14 - provider_timeout: 100 - chain_id: 17000 - hub: '0x5e447968d4a177fE7bFB8877cA12aE20Bd60dD85' - forwarder: '0xFd9a7A3fDA872eA8E948b3b41f2dcb6CB40ed277' - pan_token: '0x7EFfCc0a130E452c2FB78bFEDBd02a33E03FD50d' - confirmations: 20 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - fantom: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://rpc.ankr.com/fantom_testnet - average_block_time: 1 - provider_timeout: 100 - chain_id: 4002 - hub: '0x4BC6A71D4C3D6170d0Db849fE19b8DbA18f1a7F5' - forwarder: '0x24c991Db710964211383ad929f043FA6007DB767' - pan_token: '0x5538e600dc919f72858dd4D4F5E4327ec6f2af60' - confirmations: 6 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - polygon: - active: true - unstaking_address: '0x726265A9e352F2e9f15F255957840992803cED7d' - private_key: /pantos-servicenode/keystore - private_key_password: - provider: https://api-eu1.tatum.io/v3/blockchain/node/MATIC/ - fallback_providers: - - https://rpc.ankr.com/polygon_mumbai - average_block_time: 3 - provider_timeout: 100 - chain_id: 80001 - hub: '0x5C4B92cd0A956dedc14AF31fD474931540D8277B' - forwarder: '0xC458D148d1Cac769239629e744be37eDEf4F06A6' - pan_token: '0xC892F1D09a7BEF98d65e7f9bD4642d36BC506441' - confirmations: 200 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 - solana: - active: false - unstaking_address: ' ' - private_key: ' ' - private_key_password: ' ' - provider: ' ' - average_block_time: 1 - chain_id: -1 - hub: ' ' - forwarder: ' ' - pan_token: ' ' - confirmations: 1 - min_adaptable_fee_per_gas: 1000000000 - #max_total_fee_per_gas: - adaptable_fee_increase_factor: 1.101 - blocks_until_resubmission: 20 - stake: 10000000000000 \ No newline at end of file diff --git a/scripts/generate-signer-key.py b/scripts/generate-signer-key.py new file mode 100755 index 0000000..a9aef09 --- /dev/null +++ b/scripts/generate-signer-key.py @@ -0,0 +1,24 @@ +#! /usr/bin/env python3 +# Source: https://github.com/pantos-io/common/blob/main/scripts/generate-signer-key.py +"""Generate a private key to be used with the pantos.common.signer +module. + +""" +import getpass +import random +import string + +import Crypto.PublicKey.ECC + +passphrase = getpass.getpass('Passphrase: ') +random_string = ''.join( + random.choices(string.ascii_lowercase + string.digits, k=8)) +key_file_name = f'signer-key-{random_string}.pem' +key = Crypto.PublicKey.ECC.generate(curve='Ed25519') + +with open(key_file_name, 'wt') as key_file: + key_file.write( + key.export_key(format='PEM', passphrase=passphrase, + protection='PBKDF2WithHMAC-SHA1AndAES128-CBC')) + +print(f'PEM file written to {key_file_name}') \ No newline at end of file diff --git a/service-node-config.yml b/service-node-config.yml index 888c7a9..80921a6 100644 --- a/service-node-config.yml +++ b/service-node-config.yml @@ -163,7 +163,7 @@ blockchains: unstaking_address: !ENV ${FANTOM_UNSTAKING_ADDRESS:0x726265A9e352F2e9f15F255957840992803cED7d} private_key: !ENV ${FANTOM_PRIVATE_KEY:/etc/pantos/service-node.keystore} private_key_password: !ENV ${FANTOM_PRIVATE_KEY_PASSWORD:} - provider: !ENV ${FANTOM_PROVIDER:https://rpc.ankr.com/fantom_testnet} + provider: !ENV ${FANTOM_PROVIDER:https://rpc.testnet.fantom.network} fallback_providers: - !ENV ${FANTOM_FALLBACK_PROVIDER:https://rpc.ankr.com/fantom_testnet} average_block_time: !ENV tag:yaml.org,2002:int ${FANTOM_AVERAGE_BLOCK_TIME:1}