Using algosdk.min.js from Firefox

I have used algosdk.min.js from my Firefox browser, and used the PureStake API to communicate with the blockchain. Recently I have experienced problems with the PureStake testnet interface, so I decided to use the local algod client.

I have generated a token with

goal node generatetoken

Then I tried to communicate using the new token with the local testnet “node”:


Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:4001/v2/accounts/WOIX2F25IIRAP3RLXZHINMSSIF2B4WMR3XCQW76KXESN4ZXYB3JF6L3K5Q. (Reason: CORS request did not succeed).

If I try from the browser the line:


then I get unable to connect.

I also tried

curl http://$(cat ~/n_test1/data_testnet/ -H "X-Algo-API-Token: $(cat ~/n_test1/data_testnet/algod.token)"

failed to retrieve information from the ledger

Can it be fixed somehow?


curl http://$(cat ~/n_test1/data_testnet/ -H "X-Algo-API-Token: $(cat ~/n_test1/data_testnet/algod.token)"

The doc example referred to a block outside of the last 1000 blocks.

Can you check the content of ~/n_test1/data_testnet/ is localhost:4001 and that the content of ~/n_test1/data_testnet/algod.token is your token?

If you’re not running a node in sandbox, the port is usually 8080 and not 4001.

Thank you, fabrice.
Interesting, that the port was 43839.

cat ~/n_test1/data_testnet/