The Provable pBTC Token ETH syncing tool, designed to keep up a feed of ETH blocks to the enclave.
./build-image ptokens-eth-syncer:latest-vanilla vanilla ghp_... -f Dockerfile.dev
First install dependencies:
❍ npm i
Then run the tool via:
❍ node eth-syncer.js
For more information:
❍ node eth-syncer.js --help
❍ ETH Syncer:
Copyright Provable Things 2020
Questions: [email protected]
❍ Info:
A tool to watch for new ETH blocks & feed them to a pToken enclave.
❍ Usage:
eth-syncer.js
eth-syncer.js --help
eth-syncer.js --version
eth-syncer.js getInitBlock [--file=<path>]
eth-syncer.js getSubmissionMaterial <blockNum> [--file=<path>]
❍ Commands:
<no-command> ❍ Start the ETH syncer.
getSubmissionMaterial ❍ Get the submission material for a given block number.
getInitBlock ❍ Get a block that can be used to initialize the ETH side of a pToken enclave.
❍ Options:
--help ❍ Show this message.
--version ❍ Show version information.
<blockNum> ❍ The number of the bitcoin block in question.
--file=<path> ❍ Path to write the output to.
This tool polls the ETH blockchain for new blocks and upon finding one, assembles that block, all of it's transactions into a JSON, which it then submits to the pBTC enclave.
A guide to the various configurable fields in the config.js file in the crate root:
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.
ETH_ENDPOINT: An endpoint for a full ethereum node on the desired ethereum network.
MONGO_COLLECTION_NAME: The name of the collection in the aforementioned database.
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.
GET_TX_RECEIPTS_CALL_TYPE: Depending on the endpoint in use, you can select 4 different RPC calls methods:
parity: perform parity_getBlockReceipts to download tx receipts
erigon: perform eth_getBlockReceipts to download tx receipts
single: (a.k.a. batch JSON RPC call) perform a single JSON RPC call to download all the block receipts
multiple: (a.k.a. non-batch json RPC call) performs a call for each tx receipt inside the block
auto: use parity if available otherwise use multiple
To run the tests simply run:
❍ npx mocha
PATH_TO_ENCLAVE configurable!maybeGetNextBlock... fxn.ctrl-c & exit gracefully! (& in this case we can NOT delete the temp file EXCEPT when we catch a sigint)NO_RESPONSE_FROM_NODE_ERR better by counting the retries or something before giving up. Then somehow send an alert that the node is down.Content type
Image
Digest
sha256:81b5715b3…
Size
210 MB
Last updated
over 2 years ago
docker pull provable/ptokens-eth-syncer:3.12.0-strongbox