The Provable pBTC Token BTC syncing tool, designed to keep up a feed of BTC block submissions to the enclave.
First install dependencies:
❍ pnpm i
Then run syncer via:
❍ node btc-syncer.js
For more information run:
❍ node btc-syncer.js --help
./build-image vanilla <gpg-encrypted-gh-pat>
gpg-encrypted-gh-pat: GPG encrypted Github personal access token for local builds only.
When developing you can use:
./build-image vanilla <gpg-encrypted-gh-pat> -f Dockerfile.dev
It'll use the locally build version of ptokens-utils.js, so be sure to run the build-image script
from that repo first.
For on-the-fly testing you can also push the -dev suffixed image to the docker hub repo and pull
it wherever you need it.
A guide to the various configurable fields in the config.js file in the crate root:
SYMBOL The not reduced symbol (i.e. btc, ltc or dash etc...)
OUTPUT_TX_TYPE Whether the output transaction is for the host or native chain.
LEGACY_REPORT_KEYS Whether to use legacy-style report keys when saving a report in MongoDB.
USE_ANY_SENDER_TX_TYPE Whether to use an Any.Sender transaction type for outputted ETH transactions.
ANY_SENDER_REPORT_PREFIX The prefix to use when saving an Any.Sender type report into the MongoDB.
ENCLAVE_BINARY_NAME Name of the enclave binary.
MAX_ENCLAVE_RETRIES Max number of times to try and communicate with the enclave binary.
ENCLAVE_QUERY_MAX_TIME Max amount of time (in milliseconds) to wait for an enclave query to execute.
DB_LOCK_SLEEP_TIME: The amount of time in milliseconds the tool will sleep when encountering a database lock in the enclave before trying its previous action once more.
SLEEP_TIME: The amout of time in milliseconds the tool will sleep between successfully finding and submitting a BTC block.
MONGO_DATABASE_NAME: The name of the Mongo database accessible via the mongod daemon.
MONGO_REPORTS_COLLECTION_NAME: The name of the collection in the aforementioned database containing reports.
MONGO_DEPOSIT_ADDRESSES_COLLECTION_NAME: The name of the collection in the aforementioned database containing deposit addresses.
MONGO_DB_URL: The URL to access the above defined database.
RELATIVE_PATH_TO_ENCLAVE: Per title: a path to the enclave binary, relative to this configuration file.
API_ENDPOINT: A BTC node's RPC endpoint.
DEPOSIT_ADDRESSES_DB_KEY: The key of the deposit-addresses array in the Mongo database. This array is where user generated p2sh deposit addresses are stored. This array then forms part of the enclave submission material. It is configurable due to the database containing two arrays, one each for the BTC testnet and mainnet.
To run the tests simply run:
❍ pnpx mocha
Content type
Image
Digest
sha256:b7501a006…
Size
177.4 MB
Last updated
almost 4 years ago
docker pull provable/ptokens-btc-syncer:3.1.3-nitro