Cardano Submit API (CoinCashew & CNTools Users)
NOTE
This guide works for both Coincashew and CNTool users. CNTool users should, however, skip the INSTALLING CARDANO-SUBMIT-API section and go straight to OPERATING tx-api.service USING SYSTEMD since cardano-submit-api is already installed (should be the same location file paths for both).
Feel free to change any of the file paths to suite your needs.
INSTALLING CARDANO-SUBMIT-API
Navigate to /home/user/git/cardano-node where you downloaded cardano-node and cardano-cli previously and there you will install cardano-submit-api with the following:
(taken directly from IOG github: https://github.com/input-output-hk/cardano-node/tree/56336a031c1540340c523f5a45ae8ba4b2c07cde/cardano-submit-api)
Before we write the scripts/service files, we will need to locate cardano-submit-api and tx-submit-mainnet-config.yaml. You can use which cardano-submit-api to ensure the file path.
cardano-submit-api should be located in /home/<user_name>/.cabal/bin/
tx-submit-mainnet-config.yaml should be located in /home/<user_name>/git/cardano-node/cardano-submit-api/config/
OPERATING tx-api.service USING SYSTEMD
(All credit to PANL Stake Pool for writing this code!! Source: https://panl-stake-pool.gitbook.io/grafana-monitoring-setup-for-cardano-stake-pool/tx-submit-api)
Noting the above filepaths, we first create the startup script tx-api.sh. Be sure to replace instances of /path/to/ and <user_name> with appropriate values:
/path/to/cardano-submit-api should be /home/<user_name>/.cabal/bin/cardano-submit-api
/path/to/cardano-submit-api/tx-submit-mainnet-config.yaml should be /home/<user_name>/git/cardano-node/cardano-submit-api/config/
/path/to/node.socket should be /home/<user_name>/cardano-my-node/db/socket
Next, make the script executable:
Next, we will write the tx-api.service unit configuration file (i.e., 'service' file), which will be run by systemd. Be sure to replace instances of /path/to/ and <user_name> with appropriate values:
/path/to/cardano-submit-api/ should be /home/<user_name>/git/cardano-node/cardano-submit-api/
<user_name> is the username under your home directory that you log into when you login into your node
Move tx-api.service to /etc/systemd/system/ so it can operated via systemd:
Lastly, we enable the service to run at start and turn it on:
You can ensure that tx-api.service is active by checking its status:
That's all! Your url will be http://<ip-address>:8090/api/submit/tx.
TROUBLESHOOTING
If you have any issues, first check the service logs by running the following:
Note the error, make adjustments, then be sure to reload the daemon and restart the service with the following:
If you need to check or edit the script or service files, you can do so with the following commands:
COMMON ERRORS
1) Make sure to use http and not https if you use your ip address!
2) If for some reason you can't locate the tx-submit-mainnet-config.yaml file, you can install it with the following:
3) If you start or reload tx-api.service and receive error codes 126 or 127, check the following:
Exit code 126 is printed when the server cannot execute the script. First, go to /opt/startup-scripts/ and make sure that the script is executable with the following:
If tx-api.sh is not executable, make sure to make it executable by rerunning:
Another issue I ran into was to make sure that the script is written correctly. Double check the script using the following:
Make sure nothing looks off. Check spacing, spelling, make sure the path is to cardano-my-node located in /home/<user_name>/.cabal/bin/cardano-submit-api and NOT the directory that you downloaded under /home/<user_name>/git/cardano-node!
Exit code 127 is printed when the server cannot find the script. Double check that script is located in /opt/startup-scripts/
Last updated