How to programmatically reset local chain

Is there is a way to programmatically reset the local chain rather than going through the UI?

It is possible to do that, it isn’t mentioned in documentation. You have to make a http request to a specific path in the server with the master key as parameter.

POST Server:2087/reset_local_chain

{
“moralisMasterKey”: “master key here"
}

So I am posting via Postman with the URL

https://mbnzxbccj8uw.usemoralis.com:2053/server/reset_local_chain

and the body params

{“moralisMasterKey”:“masterkey-here”}

I am getting the response:

{“error”:“unauthorized”}

Any suggestions?

If I send the same request to URL

https://mbnzxbccj8uw.usemoralis.com:2087/reset_local_chain

with the same body params I get the response

"Unauthorized"

I am able to do it via a curl request.

curl 'https://mbnzxbccj8uw.usemoralis.com:2087/reset_local_chain' \
              -H 'Accept: application/json, text/plain, */*' \
              -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
              -H 'Connection: keep-alive' \
              -H 'Content-Type: application/json' \
              -H 'Origin: https://legacy.moralis.io' \
              -H 'Referer: https://legacy.moralis.io/' \
              -H 'Sec-Fetch-Dest: empty' \
              -H 'Sec-Fetch-Mode: cors' \
              -H 'Sec-Fetch-Site: cross-site' \
              -H 'Sec-GPC: 1' \
              -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36' \
              --data-raw '{"moralisMasterKey":"masterkey-here"}' \
              --compressed
1 Like