Replay Contract
As a DSP, you will want the ability to replay a contract’s vRAM (IPFS) related transactions to load that data into your IPFS cluster. We provide a file that does just that replay-contract.js.
To do this you will need to sign up for an API key from dfuse.io, you can select the Server to Server option from the dropdown when creating it. Dfuse offers free keys that last 24 hours, so there’s no need to pay.
There are some mandatory and optional environment variables.
Hyperion may also be used thanks to Christoph Michel: replay-contract-hyperion.js. List of endpoints here: https://hyperion.docs.eosrio.io/endpoint/, status of endpoint (UP/DOWN) here: https://bloks.io/hyperion
The dfuse GET /v0/search/transactions API has been discontinued, so Hyperion is currently the only option unless you have access to your own dfuse API.
Mandatory:
In Config.toml
Enable:
Restart the DSP with these.
Be sure to set allow_api_non_broadcast and postgresql_force_replay to false and restart the DSP after running the replay script. This is to prevent external actors from pushing unauthorized transactions to the DSP to drain CPU and to allow cache retrieval of IPFS data. As a note, the sign service will never process externally sourced transactions as a safety precaution.
Sidechain:
If replaying an account on a sidechain, must add the following environment variables.
SIDECHAIN
if using a sidechain, must specify sidechain name (sidechain names can be found here)SIDECHAIN_DSP_PORT
if using a sidechain, must specify sidechain DSP’s portDSP_LIQUIDX_CONTRACT
the liquidx contract name must be setliquidx.dsp
on mainnet if cleaning a sidechainNODEOS_MAINNET_ENDPOINT
set mainnet nodeos endpoint
Optional:
Once you’ve set those, simply run with:
How to know if it is running correctly:
In the IPFS logs, you SHOULD see this log because this is a replay. You will not see this log for normal IPFS related transactions, only ones sent from the replay script.
You should NOT see this log because you have set DSP_ALLOW_API_NON_BROADCAST=true
.
Last updated