Qortal Project

The future of blockchain platforms

User Tools

Site Tools


api_calls

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
api_calls [03/15/2021 16:51] marraccapi_calls [06/15/2023 13:53] (current) – Added API Version info quickmythril
Line 1: Line 1:
 ====== API Calls ====== ====== API Calls ======
 +{{:qortal_official_logo_transparent_.png?400|}}
  
-You need to have enabled API documentation in your settings.json file for using API calls. +**Please note: the API calls are universal. They will work on any operating system. You need to have enabled API documentation in your settings.json file for using API calls. You can only run these calls on the computer acting as a node which will need to be fully synced!**
  
-Here is the line:+**Here is the line:**
 "apiDocumentationEnabled": true "apiDocumentationEnabled": true
  
 List of mostly used API calls: List of mostly used API calls:
  
-Your Qortal Node API Documentation/Access: +**Your Qortal Node API Documentation/Access:** 
 + 
 http://localhost:12391/api-documentation/ http://localhost:12391/api-documentation/
  
-Your core block chain height, core status (minting or syncing), number of connected nodes: http://localhost:12391/admin/status+**Your core block chain height, core status (minting or syncing), number of connected nodes: 
 +**  
 + 
 +http://localhost:12391/admin/status 
 + 
 +**Your Qortal Node Admin Information (your up time & Build Version):  
 +**
  
-Your Qortal Node Admin Information (your up time & Build Version):  
 http://localhost:12391/admin/info http://localhost:12391/admin/info
  
-Your Qortal Node Information (Address, PublicKey, Blocks Minted): http://localhost:12391/addresses/(INPUT_YOUR_ADDRESS)+**Your Qortal Node Information (Address, PublicKey, Blocks Minted):  
 +** 
 + 
 +http://localhost:12391/addresses/(INPUT_YOUR_ADDRESS) 
 + 
 +**Adding new peer to your DB:  
 +**
  
-Adding new peer to your DB:  
 http://localhost:12391/api-documentation/#/Peers/addPeer http://localhost:12391/api-documentation/#/Peers/addPeer
 +
 +**Ditch chain to set height:**
  
 If your core is stuck at some height, you can try to ditch blocks to some height and re-sync from there.  If your core is stuck at some height, you can try to ditch blocks to some height and re-sync from there. 
-You are inputting height to ditch to. If you will input 300000, your core will drop blocks up to 300000 and then start to sync from that: +You are inputting height to ditch to. If you will input 300000, your core will drop blocks up to 300000 and then start to sync from that height and catch back up to the right height. If during the roll back you notice its getting slower or stalling, just close core and repeat steps, sometimes you need to repeat the steps a couple to roll back to your desired block quickly 
 http://localhost:12391/api-documentation/#/Admin/orphan http://localhost:12391/api-documentation/#/Admin/orphan
 +
 +
 +**Version 3.0 & the 'API Key'**
 +
 +In **core version 3.0.1** and beyond, there is now an 'apikey.txt' file that is created by the UI when accessing the Qortal core. This file is located in the qortal core folder. You will need to utilize this file with 'sensitive' API calls in order to make them function.
 +
 +Any API call that has the **X-API-KEY** section in it, will require the API key to be input in order to function. For calls that have that, simply open the **apikey.txt**, copy the API key, and put in the API key into that field when making the call. If you do not do this, the call will not function.
 +
 +**New 'API Version'**
 +
 +Any API call that has the **X-API-VERSION** section in it, will require the desired API version to be input in order to function. When using version 1, the API will simply return with "TRUE" if the transaction is accepted.  When using vesion 2, the API will return with json formatted data containing the transaction details.
 +
 +====== Building Transactions ======
 +**NOTE: As a prerequisite, you will need to get your wallet private key.**
 +
 +**WARNING: If this key is stolen, you will lose your funds.**
 +
 +Better to not save this key in a file. After used, clear your browser cache as well as your copy-paste clipboard.
 +
 +a. Start the UI \\
 +b. Go to http://localhost:12388/ \\
 +c. Set developer mode from browser \\
 +(ex Chrome: More tool->Development Tools), and Go to the "Console" tab \\
 +d. Login to the Wallet account \\
 +e. To display your private key, execute in console: \\
 +Base58.encode(reduxStore.getState().app.selectedAddress.seed)
 +
 +**1: Find the API call for the desired transaction.**
 +
 +It will say "Build raw, unsigned, ... transaction".
 +Click the heading then click the "Try it out" button.
 +Edit all the keys to their proper values for this tx.
 +Fee is 0.001 and enter reference and timestamp last.
 +(see info at 1a & 1b)
 +Press "Execute" and copy the entire Response Body.
 +
 +1a: Reference is retrieved using the following API call:
 +
 +/addresses/lastreference/{address}
 +
 +1b: Timestamp is retrieved using the following API call:
 +
 +/utils/timestamp
 +
 +**2: Sign the raw, unsigned transaction with API call:**
 +
 +/transactions/sign
 +
 +Enter your Private Key and the Response Body from step 1.
 +Press "Execute" and copy the entire Response Body.
 +
 +**3: Submit signed transaction with API call:**
 +
 +/transactions/process
 +
 +Paste the Response Body from step 2 and press "Execute"
api_calls.1615841465.txt.gz · Last modified: 03/15/2021 16:51 by marracc