Hathor API (0.29.0)

Download OpenAPI specification:Download

p2p

Add p2p peers

Connect to the given peers

Request Body schema: application/json
Array
string

Responses

200

The peers we connected to (we don't try connecting to already known peers)

post /p2p/peers
http://localhost:8080/p2p/peers

Request samples

application/json
Copy
Expand all Collapse all
[
  • "tcp:localhost:8000",
  • "tcp:17.24.137.234:40403"
]

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "peers":
    [
    ]
}

Block to be mined

Returns the base64 of the block to be mined inbytes and an array of the hash of parents in hex

query Parameters
address
string

Address to send the mined tokens

Responses

200

Success

503

Node still syncing

get /mining
http://localhost:8080/mining

Response samples

application/json
Copy
Expand all Collapse all
{
  • "parents":
    [
    ],
  • "block_bytes": "AAFALAAAAAAAAFw3hyYAAAAAAAAAAgAAAAEAAwAAAeKYVw431G+RAbz5A73mcYbyaoPYi5yxlvOLSWI0VwAAKzvk44duZ7XgkNdtzXHN4aMMoeVOONZXF7oTHNIvAAK7Fx3jSQgoAo7F7vMyWVastrz/pqUEZruagdODY8IAAAfQAAAZdqkUjb8SxMLMIljwVbjaYSHUbiVSjt6IrAAAAAA="
}

Propagate a mined block

Propagate to the Hathor network a complete block after the proof-of-work

Request Body schema: application/json
block_bytes
required
string

Bytes of block after pow in base 64

Responses

200

Success

post /mining
http://localhost:8080/mining

Request samples

application/json
Copy
Expand all Collapse all
{
  • "block_bytes": "AAFALAAAAAAAAFw3iaUAAAAAAAAAAgAAAAEAAwAAAeKYVw431G+RAbz5A73mcYbyaoPYi5yxlvOLSWI0VwAAKzvk44duZ7XgkNdtzXHN4aMMoeVOONZXF7oTHNIvAAK7Fx3jSQgoAo7F7vMyWVastrz/pqUEZruagdODY8IAAAfQAAAZdqkU0AoLEAX+1b36s+VyaMc9bkj/5byIrAAAEa8="
}

Response samples

application/json
Copy
Expand all Collapse all
null

Status of Hathor network

Returns the server data and the details of peers

Responses

200

Success

get /status
http://localhost:8080/status

Response samples

application/json
Copy
Expand all Collapse all
{
  • "server":
    {
    },
  • "known_peers": [ ],
  • "connections":
    {
    },
  • "dag":
    {
    }
}

transaction

Dashboard of transactions

query Parameters
tx
required
int

Quantity of transactions in the dashboard

block
required
int

Quantity of blocks in the dashboard

Responses

200

Success

get /dashboard_tx
http://localhost:8080/dashboard_tx

Response samples

application/json
Copy
Expand all Collapse all
{
  • "transactions":
    [
    ],
  • "blocks":
    [
    ]
}

Transaction or list of transactions/blocks

Returns a transaction by hash or a list of transactions/blocks depending on the parameters sent. If "id" is sent as parameter, we return only one transaction, else we return a list. In the list return we have a key "has_more" that indicatesif there are more transactions/blocks to be fetched

query Parameters
id
string

Hash in hex of the transaction/block

type
string

Type of list to return (block or tx)

count
int

Quantity of elements to return

page
string

If the user clicked "previous" or "next" button

hash
string

Hash reference for the pagination

Responses

200

Success

get /transaction
http://localhost:8080/transaction

Response samples

application/json
Copy
Expand all Collapse all
{
  • "tx":
    {
    },
  • "meta":
    {
    },
  • "spent_outputs":
    {
    },
  • "success": true
}

Decode transaction

query Parameters
hex_tx
required
string

Transaction to be decoded in hexadecimal

Responses

200

Success

get /decode_tx
http://localhost:8080/decode_tx

Response samples

application/json
Copy
Expand all Collapse all
{
  • "tx":
    {
    },
  • "meta":
    {
    },
  • "spent_outputs":
    {
    },
  • "success": true
}

Graphviz

Returns the generated file with the graph of the full DAG in the format requested.

path Parameters
format
required
string
Enum:"pdf" "png" "jpg" "dot"

Format of the returned file

query Parameters
weight
boolean

If we will show the weight

acc_weight
boolean

If we will show the accumulated weight

verifications
boolean

Wether to show the verifications graph

funds
boolean

If we will generate the network graph or the funds graph

only_blocks
boolean

Only show blocks, hides transactions

Responses

200

Success

get /graphviz/full.{format}
http://localhost:8080/graphviz/full.{format}

Response samples

application/json
Copy
Expand all Collapse all
{ }

Graphviz neighbours

Returns the generated file with the graph of neighbours of a tx in the format requested.

path Parameters
format
required
string
Enum:"pdf" "png" "jpg" "dot"

Format of the returned file

query Parameters
tx
required
string

Id of the transaction or block to generate the neighborhood graph

graph_type
required
string
Enum:"verification" "funds"

Type of the graph in case of a neighborhood graph.

max_level
required
int

How many levels the neighbor can appear in the graph.Max level is 3

Responses

200

Success

get /graphviz/neighbours.{format}
http://localhost:8080/graphviz/neighbours.{format}

Response samples

application/json
Copy
Expand all Collapse all
{ }

Push transaction to the network

query Parameters
hex_tx
required
string

Transaction to be pushed in hexadecimal

Responses

200

Success

get /push_tx
http://localhost:8080/push_tx

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true
}

Tips

Returns a list of tips hashes in hexadecimal

query Parameters
timestamp
int

Timestamp to search for the tips

Responses

200

Success

get /tips
http://localhost:8080/tips

Response samples

application/json
Copy
Expand all Collapse all
[
  • "00002b3be4e3876e67b5e090d76dcd71cde1a30ca1e54e38d65717ba131cd22f",
  • "0002bb171de3490828028ec5eef3325956acb6bcffa6a50466bb9a81d38363c2"
]

Histogram of tips

Returns a list of tuples (timestamp, quantity)for each timestamp in the requested interval

query Parameters
begin
required
int

Beggining of the timestamp interval

end
required
int

End of the timestamp interval

Responses

200

Success

get /tips-histogram
http://localhost:8080/tips-histogram

Response samples

application/json
Copy
Expand all Collapse all
[
  • [
    ],
  • [
    ],
  • [
    ]
]

Accumulated weight data of a transaction

Returns the accumulated weight and confirmation level of a transaction

query Parameters
id
required
string

Hash in hex of the transaction/block

Responses

200

Success

get /transaction_acc_weight
http://localhost:8080/transaction_acc_weight

Response samples

application/json
Copy
Expand all Collapse all
{
  • "accumulated_weight": 15.4,
  • "confirmation_level": 0.88,
  • "stop_value": 14.5,
  • "accumulated_bigger": true,
  • "success": true
}

nano-contract

Decode nano contract

Returns the nano contract transaction decoded

query Parameters
hex_tx
required
string

Nano contract to be decoded in hexadecimal

Responses

200

Success

get /wallet/nano-contract/decode
http://localhost:8080/wallet/nano-contract/decode

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "nano_contract":
    {
    },
  • "outputs":
    [
    ],
  • "my_inputs":
    [
    ],
  • "other_inputs": [ ]
}

Execute nano contract

Returns the hexadecimal of the propagated transaction

Request Body schema: application/json
spent_tx_id
required
string

Id in hex of the transaction being spent

spent_tx_index
required
index

Index of the output of the transaction being spent

oracle_data
required
string

Data in base64 provided by the oracle

oracle_signature
required
string

Signature in base64 of the oracle data

oracle_pubkey
required
string

Public key of the oracle in base64

address
required
string

Winning address in base58

value
required
int

Total value of the nano contract (without decimal places)

Responses

200

Success

post /wallet/nano-contract/execute
http://localhost:8080/wallet/nano-contract/execute

Request samples

application/json
Copy
Expand all Collapse all
{
  • "spent_tx_id": "6da000cdbd93d71052a45d33809f9fbd4400f0ec614ed7fcec7e01071629946e",
  • "spent_tx_index": 0,
  • "oracle_data": "B3NvbWVfaWQEW/xjGQIBLA==",
  • "oracle_signature": "MEUCIGeqbmLRI6lrgXMy4sQEgK94F5m14oVL5Z7oLLVII7BUAiEApKTMuWlwvws574+jtqKW5/AuH+ICD0u+HyMyHe0aric=",
  • "oracle_pubkey": "Awmloohhey8WhajdDURgvbk1z3JHX2vxDSBjz9uG9wEp",
  • "address": "1Pa4MMsr5DMRAeU1PzthFXyEJeVNXsMHoz",
  • "value": 2000
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "hex_tx": "00013ff00000000000005c3899fc0000000000000000000100010002005d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd30002bb171de3490828028ec5eef3325956acb6bcffa6a50466bb9a81d38363c25d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd300007b1007736f6d655f6964045bfc631902012c473045022067aa6e62d123a96b817332e2c40480af781799b5e2854be59ee82cb54823b054022100a4a4ccb96970bf0b39ef8fa3b6a296e7f02e1fe2020f4bbe1f23321ded1aae27210309a5a288617b2f1685a8dd0d4460bdb935cf72475f6bf10d2063cfdb86f70129000007d000001976a914f7934a91973cd100d753304f9a98267c8d4e6c0a88ac00000000"
}

Create a match value nano contract

Returns the hexadecimal of the created nano contract

Request Body schema: application/json
values
required
Array of object (NanoContractBet)

List of bets

fallback_address
required
string

Address in base58 that will execute the contract in case none of the bets is the winner

oracle_pubkey_hash
required
string

Oracle public key in base64

oracle_data_id
required
string

Id of the oracle of this nano contract

total_value
required
int

Total value of the nano contract

input_value
required
int

Amount this wallet should stake in the nano contract

Responses

200

Success

post /wallet/nano-contract/match-value
http://localhost:8080/wallet/nano-contract/match-value

Request samples

application/json
Copy
Expand all Collapse all
{
  • "oracle_data_id": "some_id",
  • "total_value": 2000,
  • "input_value": 2000,
  • "min_timestamp": 1,
  • "fallback_address": "1CBxvu6tFPTU8ygSPj9vyEadf9DsqTwy3D",
  • "values":
    [
    ],
  • "oracle_pubkey_hash": "6o6ul2c+sqAariBVW+CwNaSJb9w="
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "hex_tx": "00013ff00000000000005c3899fc0000000000000000000100010002005d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd30002bb171de3490828028ec5eef3325956acb6bcffa6a50466bb9a81d38363c25d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd300007b1007736f6d655f6964045bfc631902012c473045022067aa6e62d123a96b817332e2c40480af781799b5e2854be59ee82cb54823b054022100a4a4ccb96970bf0b39ef8fa3b6a296e7f02e1fe2020f4bbe1f23321ded1aae27210309a5a288617b2f1685a8dd0d4460bdb935cf72475f6bf10d2063cfdb86f70129000007d000001976a914f7934a91973cd100d753304f9a98267c8d4e6c0a88ac00000000"
}

Update a match value nano contract

Returns the hexadecimal of the updated nano contract

Request Body schema: application/json
hex_tx
required
string

Nano contract transaction being updated in hexadecimal

new_values
required
Array of object (NanoContractBet)

New list of bets

input_value
required
int

New amount this wallet should stake in the nano contract

Responses

200

Success

put /wallet/nano-contract/match-value
http://localhost:8080/wallet/nano-contract/match-value

Request samples

application/json
Copy
Expand all Collapse all
{
  • "new_values":
    [
    ],
  • "input_value": 2000,
  • "hex_tx": "000100000000000000005c38a2bd00000000000000000001000200000075b16110c1bb244c6b8f23882c1846c1f6ec4e03427ecb676549381cecf11711000000000007d000006676a914ea8eae97673eb2a01aae20555be0b035a4896fdc88ba5007736f6d655f6964c0510400000001c15219007abc3b0c0425d3065c43f6bccdc16aa871f3bbad9ced28f002012c1900f7934a91973cd100d753304f9a98267c8d4e6c0a5554da250101d1d0ffffffff00001976a914fd05059b6006249543b82f36876a17c73fd2267b88ac00000000"
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "hex_tx": "00013ff00000000000005c3899fc0000000000000000000100010002005d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd30002bb171de3490828028ec5eef3325956acb6bcffa6a50466bb9a81d38363c25d9e609fb85c512ac590221aed8cc5e7b7f646a4511e61ec401eba7bda794bd300007b1007736f6d655f6964045bfc631902012c473045022067aa6e62d123a96b817332e2c40480af781799b5e2854be59ee82cb54823b054022100a4a4ccb96970bf0b39ef8fa3b6a296e7f02e1fe2020f4bbe1f23321ded1aae27210309a5a288617b2f1685a8dd0d4460bdb935cf72475f6bf10d2063cfdb86f70129000007d000001976a914f7934a91973cd100d753304f9a98267c8d4e6c0a88ac00000000"
}

wallet

History of some addresses

query Parameters
addresses[]
required
string

Stringified array of addresses

Responses

200

Success

get /thin_wallet/address_history
http://localhost:8080/thin_wallet/address_history

Response samples

application/json
Copy
Expand all Collapse all
{
  • "history":
    [
    ]
}

Send tokens

Request Body schema: application/json
tx_hex
required
string

Serialized transaction in hexadecimal before parents and pow

Responses

200

Success

post /thin_wallet/send_tokens
http://localhost:8080/thin_wallet/send_tokens

Request samples

application/json
Copy
Expand all Collapse all
{
  • "tx_hex": "00000c064ec72c8561a24b65bd50095a401b8d9a66c360cfe99cfcfeed73afc4"
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "message": "",
  • "tx":
    {
    }
}

Get history transactions of a token

query Parameters
count
int

Quantity of elements to return

page
string

If the user clicked "previous" or "next" button

hash
string

Hash reference for the pagination

timestamp
integer

Timestamp reference for the pagination

id
required
string

Token id

Responses

200

Success

get /thin_wallet/token_history
http://localhost:8080/thin_wallet/token_history

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "transactions":
    [
    ],
  • "has_more": true
}

Get information about a token

query Parameters
id
required
string

Token id

Responses

200

Success

get /thin_wallet/token
http://localhost:8080/thin_wallet/token

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "name": "MyCoin",
  • "symbol": "MYC",
  • "mint":
    [
    ],
  • "melt":
    [
    ],
  • "total": 50000,
  • "transactions_count": 3
}

Hathor version

Responses

200

Success

get /version
http://localhost:8080/version

Response samples

application/json
Copy
Expand all Collapse all
{
  • "version": "0.16.0-beta",
  • "network": "testnet-bravo",
  • "min_weight": 14,
  • "min_tx_weight": 14,
  • "min_tx_weight_coefficient": 1.6,
  • "min_tx_weight_k": 100,
  • "token_deposit_percentage": 0.01
}

Run full node profiler

Request Body schema: application/json
start
bool

Only sent if should start profiler

stop
bool

Only sent if should stop profiler

filepath
string

Path to save the profiler path (only in case of stop)

Responses

200

Success

post /profiler
http://localhost:8080/profiler

Request samples

application/json
Copy
Expand all Collapse all
{
  • "start": true
}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true
}

Websocket stats

Responses

200

Success

get /websocket_stats
http://localhost:8080/websocket_stats

Response samples

application/json
Copy
Expand all Collapse all
{
  • "connections": 4,
  • "addresses": 6
}