OMG Network Watcher API
curl -X GET "https://example.com/alarm.get"{
"data": [
{
"disk_almost_full": "/dev/null",
"ethereum_connection_error": {},
"ethereum_stalled_sync": {},
"system_memory_high_watermark": []
}
]
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}curl -X GET "https://example.com/configuration.get"{
"data": [
{
"deposit_finality_margin": 10,
"contract_semver": "1.0.0.1+a1s29s8"
}
]
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}The Watcher's most critical function is to monitor the child chain and report dishonest activity. Call the /status.get endpoint periodically to check for issues. Any situation that requires you to exit or challenge an invalid exit appears in the byzantine_events field.
Response Body
application/json
application/json
curl -X POST "https://example.com/status.get"{
"data": {
"last_validated_child_block_timestamp": 1558535130,
"last_validated_child_block_number": 10000,
"last_mined_child_block_timestamp": 1558535190,
"last_mined_child_block_number": 11000,
"last_seen_eth_block_timestamp": 1558535190,
"last_seen_eth_block_number": 4427041,
"contract_addr": {
"plasma_framework": "0x44de0ec539b8c4a4b530c78620fe8320167f2f74"
},
"eth_syncing": true,
"byzantine_events": [
{
"event": "invalid_exit",
"details": {
"eth_height": 615440,
"utxo_pos": 10000000010000000,
"owner": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea",
"currency": "0x0000000000000000000000000000000000000000",
"amount": 100,
"root_chain_txhash": "0xde8210dd179e4a067c5649ebeee8871e0f258fecbd1eb02e11db88121bb8de01",
"spending_txhash": "0x21aee8dcc74d6b309f6e98a967a6aa6002432f98a5bc13c75529dbe228e04451",
"scheduled_finalization_time": 1588144725
}
},
{
"event": "unchallenged_exit",
"details": {
"eth_height": 615440,
"utxo_pos": 10000000010000000,
"owner": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea",
"currency": "0x0000000000000000000000000000000000000000",
"amount": 100,
"root_chain_txhash": "0xde8210dd179e4a067c5649ebeee8871e0f258fecbd1eb02e11db88121bb8de01",
"spending_txhash": "0x21aee8dcc74d6b309f6e98a967a6aa6002432f98a5bc13c75529dbe228e04451",
"scheduled_finalization_time": 1588144725
}
},
{
"event": "invalid_block",
"details": {
"blockhash": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec",
"blknum": 10000,
"error_type": "tx_execution"
}
},
{
"event": "block_withholding",
"details": {
"hash": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec",
"blknum": 10000
}
},
{
"event": "noncanonical_ife",
"details": {
"txbytes": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec"
}
},
{
"event": "invalid_ife_challenge",
"details": {
"txbytes": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec"
}
},
{
"event": "piggyback_available",
"details": {
"txbytes": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec",
"available_outputs": [
{
"index": 0,
"address": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea"
},
{
"index": "1,",
"address": "0x488f85743ef16cfb1f8d4dd1dfc74c51dc496434"
}
],
"available_inputs": [
{
"index": 0,
"address": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea"
}
]
}
},
{
"event": "invalid_piggyback",
"details": {
"txbytes": "0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec",
"inputs": [
1
],
"outputs": [
0
]
}
},
{
"event": "ethereum_stalled_sync",
"details": {
"eth_height": 615440,
"synced_at": "2020-02-07T10:10:10+00:00"
}
}
],
"in_flight_txs": [
{
"txhash": "0xbdf562c24ace032176e27621073df58ce1c6f65de3b5932343b70ba03c72132d",
"txbytes": "0x3eb6ae5b06f3...",
"input_addresses": [
"0x1234..."
],
"ouput_addresses": [
"0x1234...",
"0x7890..."
]
}
],
"in_flight_exits": [
{
"txhash": "0x5df13a6bf96dbcf6e66d8babd6b55bd40d64d4320c3b115364c6588fc18c2a21",
"txbytes": "0xf3170101c094...",
"eth_height": 615441,
"piggybacked_inputs": [
1
],
"piggybacked_outputs": [
0,
1
]
}
],
"services_synced_heights": [
{
"service": "block_getter",
"height": 4427041
},
{
"service": "challenges_responds_processor",
"height": 4427029
},
{
"service": "competitor_processor",
"height": 4427029
},
{
"service": "depositor",
"height": 4427031
},
{
"service": "exit_challenger",
"height": 4427029
},
{
"service": "exit_finalizer",
"height": 4427029
},
{
"service": "exit_processor",
"height": 4427029
},
{
"service": "ife_exit_finalizer",
"height": 4427029
},
{
"service": "in_flight_exit_processor",
"height": 4427029
},
{
"service": "piggyback_challenges_processor",
"height": 4427029
},
{
"service": "piggyback_processor",
"height": 4427029
},
{
"service": "root_chain_height",
"height": 4427041
}
]
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Note: This is a performance-intensive call. Use it only when the chain is byzantine and you need to retrieve utxo information to exit. In most cases, use the Informational API's Account - Get Utxos endpoint instead; this endpoint exists only as a fallback for when the Informational API is unavailable.
Request Body
application/json
HEX-encoded address of the account
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/account.get_exitable_utxos" \ -H "Content-Type: application/json" \ -d '{ "address": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea" }'{
"data": [
{
"blknum": 123000,
"txindex": 111,
"oindex": 0,
"otype": 1,
"utxo_pos": 123000001110000,
"owner": "0xb3256026863eb6ae5b06fa396ab09069784ea8ea",
"currency": "0x0000000000000000000000000000000000000000",
"amount": 10
}
]
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Returns the data needed to challenge a fraudulent exit for the given utxo, including the exit ID, input index, transaction bytes, and signature.
Request Body
application/json
Utxo position (encoded as single integer, the way contract represents them)
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/utxo.get_challenge_data" \ -H "Content-Type: application/json" \ -d '{ "utxo_pos": 10000000010000000 }'{
"data": {
"exit_id": 1.7176118930141594e+45,
"input_index": 0,
"sig": "0x6bfb9b2dbe32...",
"txbytes": "0x3eb6ae5b06f3...",
"exiting_tx": "0x6d6bda6bd6d6..."
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Returns the data required to start a standard exit for the given utxo, including the transaction bytes and Merkle proof.
Request Body
application/json
Utxo position (encoded as single integer, the way contract represents them)
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/utxo.get_exit_data" \ -H "Content-Type: application/json" \ -d '{ "utxo_pos": 10000000010000000 }'{
"data": {
"proof": "0xcedb8b31d1e4...",
"txbytes": "0x3eb6ae5b06f3...",
"utxo_pos": 10000000010000000
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}The Watcher forwards the signed transaction to the child chain only if it determines the transaction is secure - for example, that the Watcher is fully synced, all operator blocks have been verified, and the transaction does not spend funds that have not yet been mined.
Request Body
application/json
Signed transaction RLP-encoded to bytes and HEX-encoded to string
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/transaction.submit" \ -H "Content-Type: application/json" \ -d '{ "transaction": "0xf8d083015ba98080808080940000..." }'{
"data": {
"blknum": 123000,
"txindex": 111,
"txhash": "0xbdf562c24ace032176e27621073df58ce1c6f65de3b5932343b70ba03c72132d"
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Returns the exit data required as arguments to the startInFlightExit root chain contract function.
Request Body
application/json
In-flight transaction bytes body
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/in_flight_exit.get_data" \ -H "Content-Type: application/json" \ -d '{ "txbytes": "0xf3170101c0940000..." }'{
"data": {
"in_flight_tx": "0xf3170101c0940000...",
"input_txs": [
"0xa3470101c0940000..."
],
"input_txs_inclusion_proofs": [
"0xcedb8b31d1e4..."
],
"in_flight_tx_sigs": [
"0x6bfb9b2dbe32..."
],
"input_utxos_pos": [
300010002001
]
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Note that if the competing transaction has not been included in a block, competing_tx_pos and competing_proof are not returned.
Request Body
application/json
In-flight transaction bytes body
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/in_flight_exit.get_competitor" \ -H "Content-Type: application/json" \ -d '{ "txbytes": "0xf3170101c0940000..." }'{
"data": {
"in_flight_txbytes": "0xf3170101c0940000...",
"in_flight_input_index": 1,
"competing_txbytes": "0x5df13a6bee20000...",
"competing_input_index": 1,
"competing_sig": "0xa3470101c0940000...",
"competing_tx_pos": 26000003920000,
"competing_proof": "0xcedb8b31d1e4...",
"input_tx": "0xaaa70101c0940000...",
"input_utxo_pos": 300010002001
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Responds to a challenge against an in-flight exit by proving that the transaction has been included in a block, and is therefore canonical.
Request Body
application/json
In-flight transaction bytes body
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/in_flight_exit.prove_canonical" \ -H "Content-Type: application/json" \ -d '{ "txbytes": "0xf3170101c0940000..." }'{
"data": {
"in_flight_txbytes": "0xf3170101c0940000...",
"in_flight_tx_pos": 26000003920000,
"in_flight_proof": "0xcedb8b31d1e4..."
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Returns the data needed to challenge an invalid piggybacked input on a non-canonical in-flight transaction, including the transaction that spent the input and its signature.
Request Body
application/json
In-flight transaction bytes and invalid input index
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/in_flight_exit.get_input_challenge_data" \ -H "Content-Type: application/json" \ -d '{ "txbytes": "0xf3170101c0940000...", "input_index": 1 }'{
"data": {
"in_flight_txbytes": "0xf3170101c0940000...",
"in_flight_input_index": 1,
"spending_txbytes": "0x5df13a6bee20000...",
"spending_input_index": 1,
"spending_sig": "0xa3470101c0940000...",
"input_tx": "0xaaa70101c0940000...",
"input_utxo_pos": 300010002001
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}Returns the data needed to challenge an invalid piggybacked output on a canonical in-flight transaction, including the inclusion proof for the in-flight transaction, the transaction that spent the output, and its signature.
Request Body
application/json
In-flight transaction bytes and invalid output index
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/in_flight_exit.get_output_challenge_data" \ -H "Content-Type: application/json" \ -d '{ "txbytes": "0xf3170101c0940000...", "output_index": 0 }'{
"data": {
"in_flight_txbytes": "0xf3170101c0940000...",
"in_flight_output_pos": 21000634002,
"in_flight_proof": "0xcedb8b31d1e4...",
"spending_txbytes": "0x5df13a6bee20000...",
"spending_input_index": 1,
"spending_sig": "0xa3470101c0940000..."
}
}{
"success": false,
"data": {
"object": "error",
"code": "server:internal_server_error",
"description": "Something went wrong on the server",
"messages": {
"error_key": "error_reason"
}
}
}