REST API

Virgo node's REST API usage and examples

get
Get transaction

http://localhost:8000/tx/{id}
Gives you the requested transaction's raw data
Request
Response
Request
Path Parameters
id
required
string
Target transaction's ID Example: TXRb5nk98ZNNtriYdvAi8gMuMYA6ACRB2as
Response
200: OK
Transaction successfully retrieved.
//Transaction is basic
{
"sig": "Signature hex",
"outputs": [
"output target address,output value",
"output target address,output value"
],
"date": date in milliseconds,
"inputs": [
"Input transaction ID",
"Input transaction ID"
],
"pubKey": "public key hex",
"parents": [
"Parent transaction ID",
"Parent transaction ID"
]
}
//Transaction is a beacon
{
"outputs":[
"reward output address,reward output value"
],
"date": date in milliseconds,
"parentBeacon":"parent beacon ID",
"nonce":"transaction nonce string",
"parents":[
"parent transaction ID",
"parent transaction ID"
]
}
404: Not Found
Could not find a transaction with this ID.
{
"notFound": true
}

get
Get transaction state

http://localhost:8000/tx/{id}/state
Gives you the requested transaction's state
Request
Response
Request
Path Parameters
id
required
string
Target transaction's ID Example: TXRb5nk98ZNNtriYdvAi8gMuMYA6ACRB2as
Response
200: OK
Transaction's state successfully retrieved.
{
"outputsState":[
{
"amount": output amount,
"address": "output target address",
"spent": true if spent, otherwise false,
"claimers":[
"claiming transaction ID",
"claiming transaction ID"
]
}
],
"confirmations": transaction confirmations,
"beacon": "ID of the beacon confirming this transaction",
"status": transaction status (0=pending, 1=confirmed, 2=refused)
}
404: Not Found
Could not find a transaction with this ID.
{
"notFound": true
}

get
Get latest transactions

http://localhost:8000/tx/latest/[count]
Gives you the latest transactions IDs sorted by descending reception time
Request
Response
Request
Path Parameters
count
optional
integer
The number of transactions to retrieve, from 1 to 100 Defaults to 10
Response
200: OK
[
"transaction ID",
"transaction ID",
"transaction ID"
]

get
Get address transactions

http://localhost:8000/address/{addr}/txs/[count]/[page]
Gives you the requested address transactions
Request
Response
Request
Path Parameters
addr
required
string
Target address Example: V2N5Ydd1Cm1xqxQDsY15x9ED8kyAUvjbWv
count
optional
integer
The number of transactions to retrieve; from 1 to 100 Defaults to 10
page
optional
string
The result page, for example setting count 50 and page 2 will return transactions from 51 to 100
Response
200: OK
{
"size": number of transactions in total for this address,
"txs":[
"address transaction ID",
"address transaction ID",
"address transaction ID",
"address transaction ID",
"address transaction ID"
]
}

get
Get address balance

http://localhost:8000/address/{addr}/balance
Gives you the requested address confirmed balance
Request
Response
Request
Path Parameters
addr
required
string
Target address Example: V2N5tYdd1Cm1xqxQDsY15x9ED8kyAUvjbWv
Response
200: OK
{
"address": "target address",
"received": total confirmed received,
"sent": total confirmed sent
}

get
Get node informations

http://localhost:8000/nodeinfos
Gives you the current node's general informations
Request
Response
Request
Response
200: OK
Node informations
{
"DAGSize": 0,
"DAGHeight": 1,
"netID": 2946073207412533257,
"appName": "VirgoNode Java version x.x.x",
"beaconChainSize": 0,
"beaconChainWeight": 0
}

get
Get tips

http://localhost:8000/tips
Get child-less transactions
Request
Response
Request
Response
200: OK
Latest tips
[
"childless transaction",
"childless transaction"
]

get
Get beacon state

http://localhost:8000/beacon/{id}
Gives you the requested beacon state To get raw data of this beacon, use the Get transaction method
Request
Response
Request
Path Parameters
id
required
string
Target beacon's ID
Response
200: OK
{
"difficulty": beacon proof of work difficulty,
"isMainChainMember": is beacon part of main chain,
"weight": beacon weight (its difficulty + its childs difficulty),
"parentBeacon":"parent beacon id",
"confirmations": confirmations (number of child beacons),
"height": beacon height in beaconChain,
"randomXKey": "randomX key used to calculate this beacon"
}

get
Get latest beacons

http://localhost:8000/beacon/latest/[count]
Gives you the latest beacon transactions by descending order, only including main chain
Request
Response
Request
Path Parameters
count
optional
integer
The number of beacon transactions to retrieve; from 1 to 100 Defaults to 10
Response
200: OK
[
"transaction ID",
"transaction ID",
"transaction ID"
]

post
Submit transaction

http://localhost:8000/tx
Submit a transaction to the network
Request
Response
Request
Body Parameters
transaction data
required
string
The transaction raw JSON representation
Response
200: OK