gui

package
v0.0.0-...-9802667 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

README

REST API Documentation

API default service port is 8640.

A REST API implemented in Go is available, see Spo REST API Client Godoc.

CSRF

All POST, PUT and DELETE requests require a CSRF token, obtained with a GET /csrf call. The token must be placed in the X-CSRF-Token header. A token is only valid for 30 seconds and it is expected that the client obtains a new CSRF token for each request.

A request rejected for invalid or expired CSRF will respond with 403 Forbidden - invalid CSRF token as the response body.

Get current csrf token
URI: /csrf
Method: GET

Example:

curl http://127.0.0.1:8620/csrf

Result:

{
    "csrf_token": "klSgXoMOFTvEnt8KptBvHjhlFnW0OIkzyFVn4i8frDvIus9iLsFukqA9sM9Rxf3pLZHRLr82vBQxTq50vbYA8g"
}

General system checks

Health check
URI: /health
Method: GET

Example:

curl http://127.0.0.1:8620/health

Response:

{
    "blockchain": {
        "head": {
            "seq": 21175,
            "block_hash": "8a3e0aac619551ae009cfb28c2b36bb1300925f74da770d1512072314f6a4c80",
            "previous_block_hash": "001eb7911b6a6ab7c75feb88726dd2bc8b87133aebc82201c4404537eb74f7ac",
            "timestamp": 1523168686,
            "fee": 2,
            "version": 0,
            "tx_body_hash": "36be8d70d1e9f70b340ea7ecf0b247c27086bad10568044c1196fe150f6cea1b"
        },
        "unspents": 14750,
        "unconfirmed": 0,
        "time_since_last_block": "12m6s"
    },
    "version": {
        "version": "0.23.0",
        "commit": "f61b4319c2f146a5ad86f7cbda26a1ba6a09998d",
        "branch": "develop"
    },
    "open_connections": 30,
    "uptime": "13.686460853s"
}

Simple query APIs

Get node version info
URI: /version
Method: GET

Example:

curl http://127.0.0.1:8620/version

Result:

{
    "version": "0.20.0",
    "commit": "cc733e9922d85c359f5f183d3a3a6e42c73ccb16"
}
Get balance of addresses
URI: /balance
Method: GET
Args:
    addrs: comma-separated list of addresses. must contain at least one address

Example:

curl http://127.0.0.1:8620/balance\?addrs\=7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD,nu7eSpT6hr5P21uzw7bnbxm83B6ywSjHdq

Result:

{
    "confirmed": {
        "coins": 70000000,
        "hours": 28052
    },
    "predicted": {
        "coins": 9000000,
        "hours": 8385
    }
}
Get unspent output set of address or hash
URI: /outputs
Method: GET
Args:
    addrs: address list, joined with ","
    hashes: hash list, joined with ","

Addrs and hashes cannot be combined.

Example:

curl http://127.0.0.1:8620/outputs?addrs=6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY

or

curl http://127.0.0.1:8620/outputs?hashes=7669ff7350d2c70a88093431a7b30d3e69dda2319dcb048aa80fa0d19e12ebe0

Result:

{
    "head_outputs": [
        {
            "hash": "7669ff7350d2c70a88093431a7b30d3e69dda2319dcb048aa80fa0d19e12ebe0",
            "block_seq": 22,
            "time": 1494275011,
            "src_tx": "b51e1933f286c4f03d73e8966186bafb25f64053db8514327291e690ae8aafa5",
            "address": "6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY",
            "coins": "2.000000",
            "hours": 633,
            "calculated_hours": 10023
        },
    ],
    "outgoing_outputs": [],
    "incoming_outputs": []
}

Wallet APIs

Get wallet
URI: /wallet
Method: GET
Args:
    id: Wallet ID [required]

Example:

curl http://127.0.0.1:8620/wallet?id=2017_11_25_e5fb.wlt

Result:

{
    "meta": {
        "coin": "spo",
        "filename": "2017_11_25_e5fb.wlt",
        "label": "test",
        "type": "deterministic",
        "version": "0.2",
        "crypto_type": "",
        "timestamp": 1511640884,
        "encrypted": false
    },
    "entries": [
        {
            "address": "2HTnQe3ZupkG6k8S81brNC3JycGV2Em71F2",
            "public_key": "0316ff74a8004adf9c71fa99808ee34c3505ee73c5cf82aa301d17817da3ca33b1"
        },
        {
            "address": "SMnCGfpt7zVXm8BkRSFMLeMRA6LUu3Ewne",
            "public_key": "02539528248a1a2c4f0b73233491103ca83b40249dac3ae9eee9a10b9f9debd9a3"
        }
    ]
}
Get wallet transactions
URI: /wallet/transactions
Method: GET
Args:
	id: Wallet ID

Returns all pending transaction for all addresses by selected Wallet

Example:

curl http://127.0.0.1:8620/wallet/transactions?id=2017_11_25_e5fb.wlt

Result:

{
    "transactions": [
        {
            "transaction": {
                "length": 317,
                "type": 0,
                "txid": "76ecbabc53ea2a3be46983058433dda6a3cf7ea0b86ba14d90b932fa97385de7",
                "inner_hash": "5d55837bb0cbda9c9323ff9aafd7c3d31d0d38638346172fbe2d9078ebaa892a",
                "sigs": [
                    "464b7724302178c1cfeacadaaf3556a3b7e5259adf51919476c3acc695747ed244b5ce2187ce7bedb6ad65c71f7f7ff3fa6805e64fe5da3aaa00ad563c7424f600",
                    "1155537b0391d4a6ee5eac07dee5798e953dca3a7c30643403dd2d326582c7d35080a16dc22644782ce1087bfc3bd06c2bf68e9a98e3989d90831646a9be2c9101"
                ],
                "inputs": [
                    "782a8662efb0e933cab7d3ae9429ab53c4208cf44d8cdc07c2fbd7204b6b5cad",
                    "2f6b61a44086588c4eaa56a5dd9f1e0be2528861a6731608fcec38891b95db91"
                ],
                "outputs": [
                    {
                        "uxid": "bd302ef776efa8548183b89f21e90649f21b90fe2d2e90ecc1b880f2d995f226",
                        "dst": "2UXZTg4ZHF6715b6tRhtaqceuQQ3G79GiZg",
                        "coins": "998.000000",
                        "hours": 247538
                    },
                    {
                        "uxid": "31058b6bfb30bfd441aec00929e75782bce47c8a75787ba519dbb268f89d2c4b",
                        "dst": "2awsJ2CR5H6QXCF2hwDjcvcAH9SgyfxCxgz",
                        "coins": "1.000000",
                        "hours": 247538
                    }
                ]
            },
            "received": "2018-03-16T18:03:57.139109904+05:30",
            "checked": "2018-03-16T18:03:57.139109904+05:30",
            "announced": "0001-01-01T00:00:00Z",
            "is_valid": true
        }
    ]
}
Get wallets
URI: /wallets
Method: GET

Example:

curl http://127.0.0.1:8620/wallets

Result:

[
    {
        "meta": {
            "coin": "spo",
            "filename": "2017_11_25_e5fb.wlt",
            "label": "test",
            "type": "deterministic",
            "version": "0.2",
            "crypto_type": "",
            "timestamp": 1511640884,
            "encrypted": false
        },
        "entries": [
            {
                "address": "8C5icxR9zdkYTZZTVV3cCX7QoK4EkLuK4p",
                "public_key": "0316ff74a8004adf9c71fa99808ee34c3505ee73c5cf82aa301d17817da3ca33b1"
            },
            {
                "address": "23A1EWMZopUFLCwtXMe2CU9xTCbi5Gth643",
                "public_key": "02539528248a1a2c4f0b73233491103ca83b40249dac3ae9eee9a10b9f9debd9a3"
            }
        ]
    }
]
Get wallet folder name
URI: /wallets/folderName
Method: GET

Example:

curl http://127.0.0.1:8620/wallets/folderName

Result:

{
    "address": "/Users/user/.spo/wallets"
}
Generate wallet seed
URI: /wallet/newSeed
Method: GET
Args:
    entropy: seed entropy [optional]
             can either be 128 or 256; 128 = 12 word seed, 256 = 24 word seed
             default: 128

Example:

curl http://127.0.0.1:8620/wallet/newSeed

Result:

{
    "seed": "helmet van actor peanut differ icon trial glare member cancel marble rack"
}
Create a wallet from seed
URI: /wallet/create
Method: POST
Args:
    seed: wallet seed [required]
    label: wallet label [required]
    scan: the number of addresses to scan ahead for balances [optional, must be > 0]
    encrypt: encrypt wallet [optional, bool value]
    password: wallet password[optional, must be provided if encrypt is true]

Example:

curl -X POST http://127.0.0.1:8620/wallet/create \
 -H 'Content-Type: application/x-www-form-urlencoded' \
 -d 'seed=$seed' \
 -d 'label=$label' \
 -d 'scan=5' \
 -d 'password=$password'

Result:

{
    "meta": {
        "coin": "spo",
        "filename": "2017_05_09_d554.wlt",
        "label": "test",
        "type": "deterministic",
        "version": "0.2",
        "crypto_type": "",
        "timestamp": 1511640884,
        "encrypted": false
    },
    "entries": [
        {
            "address": "y2JeYS4RS8L9GYM7UKdjLRyZanKHXumFoH",
            "public_key": "0316ff74a8004adf9c71fa99808ee34c3505ee73c5cf82aa301d17817da3ca33b1"
        }
    ]
}
Generate new address in wallet
URI: /wallet/newAddress
Method: POST
Args:
    id: wallet file name
    num: the number you want to generate
    password: wallet password

Example:

curl -X POST http://127.0.0.1:8620/wallet/newAddress \
 -H 'Content-Type: x-www-form-urlencoded' \
 -d 'id=2017_05_09_d554.wlt' \
 -d 'num=2' \
 -d 'password=$password'

Result:

{
    "addresses": [
        "TDdQmMgbEVTwLe8EAiH2AoRc4SjoEFKrHB"
    ]
}
Updates wallet label
URI: /wallet/update
Method: POST
Args:
    id: wallet file name
    label: wallet label

Example:

curl -X POST http://127.0.0.1:8620/wallet/update \
 -H 'Content-Type: application/x-www-form-urlencoded' \
 -d 'id=$id' \
 -d 'label=$label'

Result:

"success"
Get wallet balance
URI: /wallet/balance
Method: GET
Args:
    id: wallet file name

Example:

curl http://127.0.0.1:8620/wallet/balance?id=2017_05_09_d554.wlt

Result:

{
    "confirmed": {
        "coins": 0,
        "hours": 0
    },
    "predicted": {
        "coins": 0,
        "hours": 0
    }
}
Spend coins from wallet
URI: /wallet/spend
Method: POST
Args:
    id: wallet id
    dst: recipient address
    coins: number of coins to send, in droplets. 1 coin equals 1e6 droplets.
    password: wallet password.
Response:
    balance: new balance of the wallet
    txn: spent transaction
    error: an error that may have occured after broadcast the transaction to the network
           if this field is not empty, the spend succeeded, but the response data could not be prepared
Statuses:
    200: successful spend. NOTE: the response may include an "error" field. if this occurs, the spend succeeded
         but the response data could not be prepared. The client should NOT spend again.
    400: Invalid query params, wallet lacks enough coin hours, insufficient balance
    403: Wallet api disabled
    404: wallet does not exist
    500: other errors

example, send 1 coin to 2iVtHS5ye99Km5PonsB42No3pQRGEURmxyc from wallet 2017_05_09_ea42.wlt:

curl -X POST  http://127.0.0.1:8620/wallet/spend \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'id=2017_05_09_ea42.wlt' \
  -d 'dst=2iVtHS5ye99Km5PonsB42No3pQRGEURmxyc' \
  -d 'coins=1000000'
  -d 'password=$password'

Result:

{
    "balance": {
        "confirmed": {
            "coins": 61000000,
            "hours": 19667
        },
        "predicted": {
            "coins": 61000000,
            "hours": 19667
        }
    },
    "txn": {
        "length": 317,
        "type": 0,
        "txid": "89578005d8730fe1789288ee7dea036160a9bd43234fb673baa6abd91289a48b",
        "inner_hash": "cac977eee019832245724aa643ceff451b9d8b24612b2f6a58177c79e8a4c26f",
        "sigs": [
            "3f084a0c750731dd985d3137200f9b5fc3de06069e62edea0cdd3a91d88e56b95aff5104a3e797ab4d6d417861af0c343efb0fff2e5ba9e7cf88ab714e10f38101",
            "e9a8aa8860d189daf0b1dbfd2a4cc309fc0c7250fa81113aa7258f9603d19727793c1b7533131605db64752aeb9c1f4465198bb1d8dd597213d6406a0a81ed3701"
        ],
        "inputs": [
            "bb89d4ed40d0e6e3a82c12e70b01a4bc240d2cd4f252cfac88235abe61bd3ad0",
            "170d6fd7be1d722a1969cb3f7d45cdf4d978129c3433915dbaf098d4f075bbfc"
        ],
        "outputs": [
            {
                "uxid": "ec9cf2f6052bab24ec57847c72cfb377c06958a9e04a077d07b6dd5bf23ec106",
                "dst": "nu7eSpT6hr5P21uzw7bnbxm83B6ywSjHdq",
                "coins": "60.000000",
                "hours": 2458
            },
            {
                "uxid": "be40210601829ba8653bac1d6ecc4049955d97fb490a48c310fd912280422bd9",
                "dst": "2iVtHS5ye99Km5PonsB42No3pQRGEURmxyc",
                "coins": "1.000000",
                "hours": 2458
            }
        ]
    },
    "error": ""
}
Create transaction
URI: /wallet/transaction
Method: POST
Content-Type: application/json
Args: JSON body, see examples

Creates a transaction, returning the transaction preview and the encoded, serialized transaction. The encoded_transaction can be provided to POST /injectTransaction to broadcast it to the network.

The request body includes:

  • A change address
  • A wallet to spend from with the optional ability to restrict which addresses in the wallet to use
  • A list of destinations with address and coins specified, as well as optionally specifying hours
  • A configuration for how destination hours are distributed, either manual or automatic

Example request body with manual hours selection type, unencrypted wallet and all wallet addresses may spend:

{
    "hours_selection": {
        "type": "manual"
    },
    "wallet": {
        "id": "foo.wlt"
    },
    "change_address": "nu7eSpT6hr5P21uzw7bnbxm83B6ywSjHdq",
    "to": [{
        "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
        "coins": "1.032",
        "hours": 7
    }, {
        "address": "7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD",
        "coins": "99.2",
        "hours": 0
    }]
}

Example request body with auto hours selection type, encrypted wallet, specified spending addresses:

{
    "hours_selection": {
        "type": "auto",
        "mode": "share",
        "share_factor": "0.5"
    },
    "wallet": {
        "id": "foo.wlt",
        "addresses": ["2iVtHS5ye99Km5PonsB42No3pQRGEURmxyc"],
        "password": "foobar",
    },
    "change_address": "nu7eSpT6hr5P21uzw7bnbxm83B6ywSjHdq",
    "to": [{
        "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
        "coins": "1.032"
    }, {
        "address": "7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD",
        "coins": "99.2"
    }]
}

The hours_selection field has two types: manual or auto.

If manual, all destination hours must be specified.

If auto, the mode field must be set. The only valid value for mode is "share". For the "share" mode, share_factor must also be set. This must be a decimal value greater than or equal to 0 and less than or equal to 1. In the auto share mode, the remaining hours after the fee are shared between the destination addresses as a whole, and the change address. Amongst the destination addresses, the shared hours are distributed proportionally.

Note that if there are remaining coin hours as change, but no coins are available as change from the wallet, these remaining coin hours will be burned as an additional fee.

All objects in to must be unique; a single transaction cannot create multiple outputs with the same address, coins and hours.

For example, this is a valid value for to, if hours_selection.type is "manual":

[{
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2",
    "hours": "1"
}, {
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2",
    "hours": "2"
}]

But this is an invalid value for to, if hours_selection.type is "manual":

[{
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2",
    "hours": "1"
}, {
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2",
    "hours": "1"
}]

And this is a valid value for to, if hours_selection.type is "auto":

[{
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2"
}, {
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.201"
}]

But this is an invalid value for to, if hours_selection.type is "auto":

[{
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2"
}, {
    "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
    "coins": "1.2"
}]

If wallet.addresses is empty or not provided, then all addresses from the wallet will be considered to use for spending. To control which addresses may spend, specify the addresses in this field.

change_address must be set, but it is not required to be an address in the wallet.

Example:

curl -X POST http://127.0.0.1:8620/wallet/transaction -H 'content-type: application/json' -d '{
    "hours_selection": {
        "type": "auto",
        "mode": "share",
        "share_factor": "0.5"
    },
    "wallet": {
        "id": "foo.wlt"
    },
    "change_address": "uvcDrKc8rHTjxLrU4mPN56Hyh2tR6RvCvw",
    "to": [{
        "address": "2Huip6Eizrq1uWYqfQEh4ymibLysJmXnWXS",
        "coins": "1",
    }, {
        "address": "2Huip6Eizrq1uWYqfQEh4ymibLysJmXnWXS",
        "coins": "8.99",
    }]
}'

Result:

{
    "transaction": {
        "length": 257,
        "type": 0,
        "txid": "5f060918d2da468a784ff440fbba80674c829caca355a27ae067f465d0a5e43e",
        "inner_hash": "97dd062820314c46da0fc18c8c6c10bfab1d5da80c30adc79bbe72e90bfab11d",
        "fee": "437691",
        "sigs": [
            "6120acebfa61ba4d3970dec5665c3c952374f5d9bbf327674a0b240de62b202b319f61182e2a262b2ca5ef5a592084299504689db5448cd64c04b1f26eb01d9100"
        ],
        "inputs": [
            {
                "uxid": "7068bfd0f0f914ea3682d0e5cb3231b75cb9f0776bf9013d79b998d96c93ce2b",
                "address": "g4XmbmVyDnkswsQTSqYRsyoh1YqydDX1wp",
                "coins": "10.000000",
                "hours": "853667",
                "calculated_hours": "862290",
                "timestamp": 1524242826,
                "block": 23575,
                "txid": "ccfbb51e94cb58a619a82502bc986fb028f632df299ce189c2ff2932574a03e7"
            }
        ],
        "outputs": [
            {
                "uxid": "519c069a0593e179f226e87b528f60aea72826ec7f99d51279dd8854889ed7e2",
                "address": "2Huip6Eizrq1uWYqfQEh4ymibLysJmXnWXS",
                "coins": "1.000000",
                "hours": "22253"
            },
            {
                "uxid": "4e4e41996297511a40e2ef0046bd6b7118a8362c1f4f09a288c5c3ea2f4dfb85",
                "address": "2Huip6Eizrq1uWYqfQEh4ymibLysJmXnWXS",
                "coins": "8.990000",
                "hours": "200046"
            },
            {
                "uxid": "fdeb3f77408f39e50a8e3b6803ce2347aac2eba8118c494424f9fa4959bab507",
                "address": "uvcDrKc8rHTjxLrU4mPN56Hyh2tR6RvCvw",
                "coins": "0.010000",
                "hours": "222300"
            }
        ]
    },
    "encoded_transaction": "010100000097dd062820314c46da0fc18c8c6c10bfab1d5da80c30adc79bbe72e90bfab11d010000006120acebfa61ba4d3970dec5665c3c952374f5d9bbf327674a0b240de62b202b319f61182e2a262b2ca5ef5a592084299504689db5448cd64c04b1f26eb01d9100010000007068bfd0f0f914ea3682d0e5cb3231b75cb9f0776bf9013d79b998d96c93ce2b0300000000ba2a4ac4a5ce4e03a82d2240ae3661419f7081b140420f0000000000ed5600000000000000ba2a4ac4a5ce4e03a82d2240ae3661419f7081b1302d8900000000006e0d0300000000000083874350e65e84aa6e06192408951d7aaac7809e10270000000000005c64030000000000"
}
Unload wallet
URI: /wallet/unload
Method: POST
Args:
    id: wallet file name

Example:

curl -X POST http://127.0.0.1:8620/wallet/unload \
 -H 'Content-Type: x-www-form-urlencoded' \
 -d 'id=2017_05_09_d554.wlt'
Encrypt wallet
URI: /wallet/encrypt
Method: POST
Args:
    id: wallet id
    password: wallet password

Example:

curl -X POST http://127.0.0.1:8620/wallet/encrypt \
 -H 'Content-Type: application/x-www-form-urlencoded' \
 -d 'id=test.wlt' \
 -d 'password=$password'

Result:

{
    "meta": {
        "coin": "spo",
        "filename": "test.wlt",
        "label": "test",
        "type": "deterministic",
        "version": "0.2",
        "crypto_type": "scrypt-chacha20poly1305",
        "timestamp": 1521083044,
        "encrypted": true
    },
    "entries": [
        {
            "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
            "public_key": "0316ff74a8004adf9c71fa99808ee34c3505ee73c5cf82aa301d17817da3ca33b1"
        }
    ]
}
Decrypt wallet
URI: /wallet/decrypt
Method: POST
Args:
    id: wallet id
    password: wallet password

Example:

curl -X POST http://127.0.0.1:8620/wallet/decrypt \
 -H 'Content-Type: application/x-www-form-urlencoded' \
 -d 'id=test.wlt' \
 -d 'password=$password'

Result:

{
    "meta": {
        "coin": "spo",
        "filename": "test.wlt",
        "label": "test",
        "type": "deterministic",
        "version": "0.2",
        "crypto_type": "",
        "timestamp": 1521083044,
        "encrypted": false
    },
    "entries": [
        {
            "address": "fznGedkc87a8SsW94dBowEv6J7zLGAjT17",
            "public_key": "032a1218cbafc8a93233f363c19c667cf02d42fa5a8a07c0d6feca79e82d72753d"
        }
    ]
}
Get wallet seed

This endpoint is supported only when -enable-seed-api option is enabled and the wallet is encrypted.

URI: /wallet/seed
Method: POST
Args:
    id: wallet id
    password: wallet password

Example:

curl http://127.0.0.1:8620/wallet/seed?id=test.wlt&password=$password

Result:

{
    "seed": "your wallet seed"
}

Transaction APIs

Get unconfirmed transactions
URI: /pendingTxs
Method: GET

Example:

curl http://127.0.0.1:8620/pendingTxs

Result:

[
    {
        "transaction": {
            "length": 317,
            "type": 0,
            "txid": "89578005d8730fe1789288ee7dea036160a9bd43234fb673baa6abd91289a48b",
            "inner_hash": "cac977eee019832245724aa643ceff451b9d8b24612b2f6a58177c79e8a4c26f",
            "sigs": [
                "3f084a0c750731dd985d3137200f9b5fc3de06069e62edea0cdd3a91d88e56b95aff5104a3e797ab4d6d417861af0c343efb0fff2e5ba9e7cf88ab714e10f38101",
                "e9a8aa8860d189daf0b1dbfd2a4cc309fc0c7250fa81113aa7258f9603d19727793c1b7533131605db64752aeb9c1f4465198bb1d8dd597213d6406a0a81ed3701"
            ],
            "inputs": [
                "bb89d4ed40d0e6e3a82c12e70b01a4bc240d2cd4f252cfac88235abe61bd3ad0",
                "170d6fd7be1d722a1969cb3f7d45cdf4d978129c3433915dbaf098d4f075bbfc"
            ],
            "outputs": [
                {
                    "uxid": "ec9cf2f6052bab24ec57847c72cfb377c06958a9e04a077d07b6dd5bf23ec106",
                    "dst": "nu7eSpT6hr5P21uzw7bnbxm83B6ywSjHdq",
                    "coins": "60.000000",
                    "hours": 2458
                },
                {
                    "uxid": "be40210601829ba8653bac1d6ecc4049955d97fb490a48c310fd912280422bd9",
                    "dst": "2iVtHS5ye99Km5PonsB42No3pQRGEURmxyc",
                    "coins": "1.000000",
                    "hours": 2458
                }
            ]
        },
        "received": "2017-05-09T10:11:57.14303834+02:00",
        "checked": "2017-05-09T10:19:58.801315452+02:00",
        "announced": "0001-01-01T00:00:00Z",
        "is_valid": true
    }
]
Get transaction info by id
URI: /transaction
Method: GET
Args:
    txid: transaction id

Example:

curl http://127.0.0.1:8620/transaction?txid=a6446654829a4a844add9f181949d12f8291fdd2c0fcb22200361e90e814e2d3

Result:

{
    "status": {
        "confirmed": true,
        "unconfirmed": false,
        "height": 1,
        "block_seq": 1178,
        "unknown": false
    },
    "txn": {
        "length": 183,
        "type": 0,
        "txid": "a6446654829a4a844add9f181949d12f8291fdd2c0fcb22200361e90e814e2d3",
        "inner_hash": "075f255d42ddd2fb228fe488b8b468526810db7a144aeed1fd091e3fd404626e",
        "timestamp": 1494275231,
        "sigs": [
            "9b6fae9a70a42464dda089c943fafbf7bae8b8402e6bf4e4077553206eebc2ed4f7630bb1bd92505131cca5bf8bd82a44477ef53058e1995411bdbf1f5dfad1f00"
        ],
        "inputs": [
            "5287f390628909dd8c25fad0feb37859c0c1ddcf90da0c040c837c89fefd9191"
        ],
        "outputs": [
            {
                "uxid": "70fa9dfb887f9ef55beb4e960f60e4703c56f98201acecf2cad729f5d7e84690",
                "dst": "7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD",
                "coins": "8.000000",
                "hours": 931
            }
        ]
    }
}
Get raw transaction by id
URI: /rawtx
Method: GET

Example:

curl http://127.0.0.1:8620/rawtx?txid=a6446654829a4a844add9f181949d12f8291fdd2c0fcb22200361e90e814e2d3

Result:

"b700000000075f255d42ddd2fb228fe488b8b468526810db7a144aeed1fd091e3fd404626e010000009b6fae9a70a42464dda089c943fafbf7bae8b8402e6bf4e4077553206eebc2ed4f7630bb1bd92505131cca5bf8bd82a44477ef53058e1995411bdbf1f5dfad1f00010000005287f390628909dd8c25fad0feb37859c0c1ddcf90da0c040c837c89fefd9191010000000010722f061aa262381dce35193d43eceb112373c300127a0000000000a303000000000000"
Inject raw transaction
URI: /injectTransaction
Method: POST
Content-Type: application/json
Body: {"rawtx": "raw transaction"}

Broadcasts an encoded transaction to the network.

If there are no available connections, the API responds with a 503 Service Unavailable error.

Note that in some circumstances the transaction can fail to broadcast but this endpoint will still return successfully. This can happen if the node's network has recently become unavailable but its connections have not timed out yet.

Example:

curl -X POST http://127.0.0.1:8620/injectTransaction -H 'content-type: application/json' -d '{
    "rawtx":"dc0000000008b507528697b11340f5a3fcccbff031c487bad59d26c2bdaea0cd8a0199a1720100000017f36c9d8bce784df96a2d6848f1b7a8f5c890986846b7c53489eb310090b91143c98fd233830055b5959f60030b3ca08d95f22f6b96ba8c20e548d62b342b5e0001000000ec9cf2f6052bab24ec57847c72cfb377c06958a9e04a077d07b6dd5bf23ec106020000000072116096fe2207d857d18565e848b403807cd825c044840300000000330100000000000000575e472f8c5295e8fa644e9bc5e06ec10351c65f40420f000000000066020000000000000"
}'

Result:

"3615fc23cc12a5cb9190878a2151d1cf54129ff0cd90e5fc4f4e7debebad6868"
URI: /transactions
Method: GET
Args:
	addrs: Comma seperated addresses [optional, returns all transactions if no address is provided]
    confirmed: Whether the transactions should be confirmed [optional, must be 0 or 1; if not provided, returns all]

To get address related confirmed transactions:

curl http://127.0.0.1:8620/transactions?addrs=7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD,6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY&confirmed=1

To get address related unconfirmed transactions:

curl http://127.0.0.1:8620/transactions?addrs=7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD,6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY&confirmed=0

To get all addresses related transactions:

curl http://127.0.0.1:8620/transactions?addrs=7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD,6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY

Result:

[
    {
        "status": {
            "confirmed": true,
            "unconfirmed": false,
            "height": 10492,
            "block_seq": 1177,
            "unknown": false
        },
        "time": 1494275011,
        "txn": {
            "length": 317,
            "type": 0,
            "txid": "b09cd3a8baef6a449848f50a1b97943006ca92747d4e485d0647a3ea74550eca",
            "inner_hash": "2cb370051c92521a04ba5357e229d8ffa90d9d1741ea223b44dd60a1483ee0e5",
            "timestamp": 1494275011,
            "sigs": [
                "a55155ca15f73f0762f79c15917949a936658cff668647daf82a174eed95703a02622881f9cf6c7495536676f931b2d91d389a9e7b034232b3a1519c8da6fb8800",
                "cc7d7cbd6f31adabd9bde2c0deaa9277c0f3cf807a4ec97e11872817091dc3705841a6adb74acb625ee20ab6d3525350b8663566003276073d94c3bfe22fe48e01"
            ],
            "inputs": [
                "4f4b0078a9cd19b3395e54b3f42af6adc997f77f04e0ca54016c67c4f2384e3c",
                "36f4871646b6564b2f1ab72bd768a67579a1e0242bc68bcbcf1779bc75b3dddd"
            ],
            "outputs": [
                {
                    "uxid": "5287f390628909dd8c25fad0feb37859c0c1ddcf90da0c040c837c89fefd9191",
                    "dst": "2K6NuLBBapWndAssUtkxKfCtyjDQDHrEhhT",
                    "coins": "8.000000",
                    "hours": 7454
                },
                {
                    "uxid": "a1268e9bd2033b49b44afa765d20876467254f51e5515626780467267a65c563",
                    "dst": "7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD",
                    "coins": "1.000000",
                    "hours": 7454
                }
            ]
        }
    },
    {
        "status": {
            "confirmed": true,
            "unconfirmed": false,
            "height": 10491,
            "block_seq": 1178,
            "unknown": false
        },
        "time": 1494275231,
        "txn": {
            "length": 183,
            "type": 0,
            "txid": "a6446654829a4a844add9f181949d12f8291fdd2c0fcb22200361e90e814e2d3",
            "inner_hash": "075f255d42ddd2fb228fe488b8b468526810db7a144aeed1fd091e3fd404626e",
            "timestamp": 1494275231,
            "sigs": [
                "9b6fae9a70a42464dda089c943fafbf7bae8b8402e6bf4e4077553206eebc2ed4f7630bb1bd92505131cca5bf8bd82a44477ef53058e1995411bdbf1f5dfad1f00"
            ],
            "inputs": [
                "5287f390628909dd8c25fad0feb37859c0c1ddcf90da0c040c837c89fefd9191"
            ],
            "outputs": [
                {
                    "uxid": "70fa9dfb887f9ef55beb4e960f60e4703c56f98201acecf2cad729f5d7e84690",
                    "dst": "7cpQ7t3PZZXvjTst8G7Uvs7XH4LeM8fBPD",
                    "coins": "8.000000",
                    "hours": 931
                }
            ]
        }
    },
    {
        "status": {
            "confirmed": true,
            "unconfirmed": false,
            "height": 8730,
            "block_seq": 2939,
            "unknown": false
        },
        "time": 1505205561,
        "txn": {
            "length": 474,
            "type": 0,
            "txid": "b45e571988bc07bd0b623c999655fa878fb9bdd24c8cd24fde179bf4b26ae7b7",
            "inner_hash": "393804eca6afadc05db80cfb9e1024ef5761231c70705c406301bad33161f8bf",
            "timestamp": 1505205561,
            "sigs": [
                "fb9dd021cdff51ab56891cca0fd1600877f6e0691136dbe3f8324c3f4f7ee5bc624ded4954c1d70d8cb776ce3454d8f195bbb252e48b0f2cd388f5a733697d9301",
                "0639e61ba87a61f10b0e0114008ddd4e7090d9397370de28da27b7852b231b8e66c36d10fe3424c9b23a41266fd2c50f169233009713b332d6a48ce9c128ccef01",
                "055afe17222aab66c48c8e08e03a406bf2b8719f5221ec54c8e678078033bcd56b66bbc46a866f2be5e3f9ca454e3fbc2021630d0430b72e18c24d02df03c03100",
                "8cf56fb96e11d49bea728cb35ba5953fbc640817fac01b82e62a959ef8d4c3105298f2a6ea127bb07552abd905a667b58f6c79717e9f05258079de08d91f10a500"
            ],
            "inputs": [
                "dea9266aa7b687f4391e92f04436407c51a834274a5a33bc8bcf3189732e82e3",
                "e811bdce52ddac0d952d2546fdca8d1ac4e0ad32f170d3d73b724fb37c802652",
                "e94ccdbc07cc62fb41140b4daa7969438c749837c0808acf20dde113bdf1876b",
                "534afc496a7aee2ec55c71d85abfc27f35d16c56506f663b24d8ee4815583b6e"
            ],
            "outputs": [
                {
                    "uxid": "732e129fc1630aba3f06d833ce0a7a25f05dae5df3e7a135b5f82e99222e8c28",
                    "dst": "2hAjmdPP9R3um9JhKczeVdJUVugY6SPJBDm",
                    "coins": "6.000000",
                    "hours": 204
                }
            ]
        }
    }
]
Resend unconfirmed transactions
URI: /resendUnconfirmedTxns
Method: GET

Example:

curl http://127.0.0.1:8620/resendUnconfirmedTxns

Result:

{
    "txids":[
        "b45e571988bc07bd0b623c999655fa878fb9bdd24c8cd24fde179bf4b26ae7b7",
        "a6446654829a4a844add9f181949d12f8291fdd2c0fcb22200361e90e814e2d3"
    ]
}

Block APIs

Get blockchain metadata
URI:  /blockchain/metadata
Method: GET

Example:

curl http://127.0.0.1:8620/blockchain/metadata

Result:

{
    "head": {
        "seq": 17936,
        "block_hash": "b91663fa8ff14aab529cd7bfd48bde5bd86e3c2db154d601528801ee0d064d19",
        "previous_block_hash": "b57d3b644898f95c9f7a9281e786a0ae2a567e9dc573654363ffafaa41ab4caf",
        "timestamp": 1520967639,
        "fee": 61662,
        "version": 0,
        "tx_body_hash": "f0e8440f30acf01def3acaa9a88ea91f1fbaea19c0df003726edfe5bd1c7b51d"
    },
    "unspents": 12704,
    "unconfirmed": 0
}
Get blockchain progress
URI: /blockchain/progress
Method: GET

Example:

curl http://127.0.0.1:8620/blockchain/progress

Result:

{
    "current": 2760,
    "highest": 2760,
    "peers": [
    {
        "address": "35.157.164.126:6000",
        "height": 2760
    },
    {
        "address": "63.142.253.76:6000",
        "height": 2760
    },
    ]
}
Get block by hash or seq
URI: /block
Method: GET
Args:
    hash: get block by hash
    seq: get block by sequence number
curl http://127.0.0.1:8620/block?hash=6eafd13ab6823223b714246b32c984b56e0043412950faf17defdbb2cbf3fe30

or

curl http://127.0.0.1:8620/block?seq=2760

Result:

{
    "header": {
        "seq": 2760,
        "block_hash": "6eafd13ab6823223b714246b32c984b56e0043412950faf17defdbb2cbf3fe30",
        "previous_block_hash": "eaccd527ef263573c29000dbfb3c782ee175153c63f42abb671588b7071e877f",
        "timestamp": 1504220821,
        "fee": 196130,
        "version": 0,
        "tx_body_hash": "825ae95b81ae0ce037cdf9f1cda138bac3f3ed41c51b09e0befb71848e0f3bfd"
    },
    "body": {
        "txns": [
            {
                "length": 220,
                "type": 0,
                "txid": "825ae95b81ae0ce037cdf9f1cda138bac3f3ed41c51b09e0befb71848e0f3bfd",
                "inner_hash": "312e5dd55e06be5f9a0ee43a00d447f2fea47a7f1fb9669ecb477d2768ab04fd",
                "sigs": [
                    "f0d0eb337e3440af6e8f0c105037ec205f36c83770d26a9e3a0fb4b7ec1a2be64764f4e31cbaf6629933c971613d10d58e6acb592704a7d511f19836441f09fb00"
                ],
                "inputs": [
                    "e7594379c9a6bb111205cbfa6fac908cac1d136e207960eb0429f15fde09ac8c"
                ],
                "outputs": [
                    {
                        "uxid": "840d0ee483c1dc085e6518e1928c68979af61188b809fc74da9fca982e6a61ba",
                        "dst": "2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv",
                        "coins": "998.000000",
                        "hours": 35390
                    },
                    {
                        "uxid": "38177c437ff42f29dc8d682e2f7c278f2203b6b02f42b1a88f9eb6c2392a7f70",
                        "dst": "2YHKP9yH7baLvkum3U6HCBiJjnAUCLS5Z9U",
                        "coins": "2.000000",
                        "hours": 70780
                    }
                ]
            }
        ]
    },
    "size": 220
}
Get blocks in specific range
URI: /blocks
Method: GET
Args:
    start: start seq
    end: end seq

Example:

curl http://127.0.0.1:8620/blocks?start=1&end=2

Result:

{
    "blocks": [
        {
            "header": {
                "seq": 100,
                "block_hash": "725e76907998485d367a847b0fb49f08536c592247762279fcdbd9907fee5607",
                "previous_block_hash": "5c06896760ace71b02edab01700ff9ca8c32ef1d647e14c3e0d5fa751e47867e",
                "timestamp": 1429274636,
                "fee": 613712,
                "version": 0,
                "tx_body_hash": "9f20b52befed2cbaaa4a066de7119b7fdbff09a83d8e2a82628671f51f3f6551"
            },
            "body": {
                "txns": [
                    {
                        "length": 183,
                        "type": 0,
                        "txid": "9f20b52befed2cbaaa4a066de7119b7fdbff09a83d8e2a82628671f51f3f6551",
                        "inner_hash": "c2e60dbb6ad5095985d21391cbeb679fd0787c4a20471340d63f8de437d915df",
                        "sigs": [
                            "2fefd2da9d3b4af87c4157f87da0b1bf82e3d6c9f6427572bd768cf85900d15d36971ffa17eb3b486f7692584102a7a58d9fb3ef57fa24d9a4ab02eba811ef4f00"
                        ],
                        "inputs": [
                            "aee4af7e06c24bccc2f87b16d0708bfea68ac1b420f97914965f4a23ad9e11d6"
                        ],
                        "outputs": [
                            {
                                "uxid": "194cc596d2beda803d8142ddc455872082f84b09a5edd8085082b60d314c1e29",
                                "dst": "qxmeHkwgAMfwXyaQrwv9jq3qt228xMuoT5",
                                "coins": "23000.000000",
                                "hours": 87673
                            }
                        ]
                    }
                ]
            },
            "size": 183
        },
        {
            "header": {
                "seq": 101,
                "block_hash": "8156057fc823589288f66c91edb60c11ff004465bcbe3a402b1328be7f0d6ce0",
                "previous_block_hash": "725e76907998485d367a847b0fb49f08536c592247762279fcdbd9907fee5607",
                "timestamp": 1429274666,
                "fee": 720335,
                "version": 0,
                "tx_body_hash": "e8fe5290afba3933389fd5860dca2cbcc81821028be9c65d0bb7cf4e8d2c4c18"
            },
            "body": {
                "txns": [
                    {
                        "length": 183,
                        "type": 0,
                        "txid": "e8fe5290afba3933389fd5860dca2cbcc81821028be9c65d0bb7cf4e8d2c4c18",
                        "inner_hash": "45da31b68748eafdb08ef8bf1ebd1c07c0f14fcb0d66759d6cf4642adc956d06",
                        "sigs": [
                            "09bce2c888ceceeb19999005cceb1efdee254cacb60edee118b51ffd740ff6503a8f9cbd60a16c7581bfd64f7529b649d0ecc8adbe913686da97fe8c6543189001"
                        ],
                        "inputs": [
                            "6002f3afc7054c0e1161bcf2b4c1d4d1009440751bc1fe806e0eae33291399f4"
                        ],
                        "outputs": [
                            {
                                "uxid": "f9bffdcbe252acb1c3a8a1e8c99829342ba1963860d5692eebaeb9bcfbcaf274",
                                "dst": "R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ",
                                "coins": "27000.000000",
                                "hours": 102905
                            }
                        ]
                    }
                ]
            },
            "size": 183
        }
    ]
}
Get last N blocks
URI: /last_blocks
Method: GET
Args:
    num: number of most recent blocks to return

Example:

curl http://127.0.0.1:8620/last_blocks?num=2

Result:

{
    "blocks": [
        {
            "header": {
                "seq": 21182,
                "block_hash": "a9045e524ff3bef82955198f274a5538ccec3958b3045c396a4b2a591fa1d99c",
                "previous_block_hash": "819b3f83afef7be9c37ab7819e193ad3a55439fb3cda52cb8691aab62bfc3936",
                "timestamp": 1523174576,
                "fee": 34572,
                "version": 0,
                "tx_body_hash": "99548cd7cc0091ce2d324647c20d22616e44424961f098c7fc81be9e9dc90c62"
            },
            "body": {
                "txns": [
                    {
                        "length": 220,
                        "type": 0,
                        "txid": "99548cd7cc0091ce2d324647c20d22616e44424961f098c7fc81be9e9dc90c62",
                        "inner_hash": "b283e783a3055c5b9e89449434ebd4f63c88450d48bc0eccd274c39c347a498a",
                        "sigs": [
                            "c0e8e1b6252cc9a5e0de3ded8a63f291781cc5866956b4409e1afa165b56245e5adb87dd29e10c73038389a056667ebba76545e0e931d261444da5e09cf4b7d901"
                        ],
                        "inputs": [
                            "0973f15386bbf39ad530c704bcfa3e768ec6515a3798455feaa89a7f00beb276"
                        ],
                        "outputs": [
                            {
                                "uxid": "7c061ba81dedcf9046d6f964efea99860dfa0b07a2de80dd24f658b8c12d2ffc",
                                "dst": "2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv",
                                "coins": "648.000000",
                                "hours": 2
                            },
                            {
                                "uxid": "89835a170bf7b1d5067c77b84c15ddc9b7d62da213eef34d8c4dbe40ab2b3158",
                                "dst": "2QzAjmkm9UZoYodZLDrDUjEuFCjU3uoNoEm",
                                "coins": "283.000000",
                                "hours": 2
                            }
                        ]
                    }
                ]
            },
            "size": 220
        },
        {
            "header": {
                "seq": 21183,
                "block_hash": "96a2f810e56545bf819ad76123609e16e4c82b5d14911b0b18368e4347e8b1b5",
                "previous_block_hash": "a9045e524ff3bef82955198f274a5538ccec3958b3045c396a4b2a591fa1d99c",
                "timestamp": 1523174636,
                "fee": 108118,
                "version": 0,
                "tx_body_hash": "c3052a92828873a0594a95a44051a9962f3794b0bcd4948d2d616496f1e06cd7"
            },
            "body": {
                "txns": [
                    {
                        "length": 220,
                        "type": 0,
                        "txid": "c3052a92828873a0594a95a44051a9962f3794b0bcd4948d2d616496f1e06cd7",
                        "inner_hash": "a81ae47fdf0a09933576da113ed098b1f8e62b7fdddf318fd5cc70420bad2228",
                        "sigs": [
                            "6bb47b0ac89cc3b0bf7b276c98dcf553f6f8980ced386cccca927d439f7cfb9c56cf6019a299f917ce62c4ab3277b7b624a351808513400d1f240f1b900d65b701"
                        ],
                        "inputs": [
                            "898d42774d3cd9910691630fb7c22f786d3ee99a6616bc5bc1b8b813e1499b06"
                        ],
                        "outputs": [
                            {
                                "uxid": "96f14e7e9d024aa49ad7e3e7b55d98bef8601ce9696f09581391eb07cda42ffe",
                                "dst": "2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv",
                                "coins": "921.000000",
                                "hours": 98
                            },
                            {
                                "uxid": "5cd59f80656e92961f824a9c65b30f61badd9265069f0a504f5c73a2bea54990",
                                "dst": "CP7tbttW82zNdygJ1UBFhzbhu9bbz8Rcez",
                                "coins": "10.000000",
                                "hours": 98
                            }
                        ]
                    }
                ]
            },
            "size": 220
        }
    ]
}

Explorer APIs

Get address affected transactions
URI: /explorer/address
Method: GET
Args:
    address

Example:

curl http://127.0.0.1:8620/explorer/address?address=2NfNKsaGJEndpSajJ6TsKJfsdDjW2gFsjXg

Result:

[
    {
        "status": {
            "confirmed": true,
            "unconfirmed": false,
            "height": 1268,
            "block_seq": 15493,
            "unknown": false
        },
        "length": 183,
        "type": 0,
        "txid": "6d8e2f8b436a2f38d604b3aa1196ef2176779c5e11e33fbdd09f993fe659c39f",
        "inner_hash": "8da7c64dcedeeb6aa1e0d21fb84a0028dcd68e6801f1a3cc0224fdd50682046f",
        "timestamp": 1518878675,
        "sigs": [
            "c60e43980497daad59b4c72a2eac053b1584f960c57a5e6ac8337118dccfcee4045da3f60d9be674867862a13fdd87af90f4b85cbf39913bde13674e0a039b7800"
        ],
        "inputs": [
            {
                "uxid": "349b06e5707f633fd2d8f048b687b40462d875d968b246831434fb5ab5dcac38",
                "owner": "WzPDgdfL1NzSbX96tscUNXUqtCRLjaBugC",
                "coins": "125.000000",
                "hours": 34596
            }
        ],
        "outputs": [
            {
                "uxid": "5b4a79c7de2e9099e083bbc8096619ae76ba6fbe34875c61bbe2d3bfa6b18b99",
                "dst": "2NfNKsaGJEndpSajJ6TsKJfsdDjW2gFsjXg",
                "coins": "125.000000",
                "hours": 51925
            }
        ]
    }
]

Uxout APIs

Get uxout
URI: /uxout
Method: GET
Args:
    uxid

Example:

curl http://127.0.0.1:8620/uxout?uxid=8b64d9b058e10472b9457fd2d05a1d89cbbbd78ce1d97b16587d43379271bed1

Result:

{
    "uxid": "8b64d9b058e10472b9457fd2d05a1d89cbbbd78ce1d97b16587d43379271bed1",
    "time": 1502870712,
    "src_block_seq": 2545,
    "src_tx": "ded9e671510ab300a4ea3ee126fe8e2d50b995021e2db4589c6fb4ac000fe7bb",
    "owner_address": "c9zyTYwgR4n89KyzknpmGaaDarUCPEs9mV",
    "coins": 2000000,
    "hours": 5039,
    "spent_block_seq": 2556,
    "spent_tx": "b51e1933f286c4f03d73e8966186bafb25f64053db8514327291e690ae8aafa5"
}
Get address affected uxouts
URI: /address_uxouts
Method: GET
Args:
    address

Example:

curl http://127.0.0.1:8620/address_uxouts?address=6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY

Result:

[
    {
        "uxid": "7669ff7350d2c70a88093431a7b30d3e69dda2319dcb048aa80fa0d19e12ebe0",
        "time": 1502936862,
        "src_block_seq": 2556,
        "src_tx": "b51e1933f286c4f03d73e8966186bafb25f64053db8514327291e690ae8aafa5",
        "owner_address": "6dkVxyKFbFKg9Vdg6HPg1UANLByYRqkrdY",
        "coins": 2000000,
        "hours": 633,
        "spent_block_seq": 0,
        "spent_tx": "0000000000000000000000000000000000000000000000000000000000000000"
    }
]
Coin supply
URI: /coinSupply
Method: GET

Example:

curl http://127.0.0.1:8620/coinSupply

Result:

{
    "current_supply": "7187500.000000",
    "total_supply": "25000000.000000",
    "max_supply": "100000000.000000",
    "current_coinhour_supply": "23499025077",
    "total_coinhour_supply": "93679828577",
    "unlocked_distribution_addresses": [
        "R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ",
        "2EYM4WFHe4Dgz6kjAdUkM6Etep7ruz2ia6h",
        "25aGyzypSA3T9K6rgPUv1ouR13efNPtWP5m",
        "ix44h3cojvN6nqGcdpy62X7Rw6Ahnr3Thk",
        "AYV8KEBEAPCg8a59cHgqHMqYHP9nVgQDyW",
        "2Nu5Jv5Wp3RYGJU1EkjWFFHnebxMx1GjfkF",
        "2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf",
        "tWZ11Nvor9parjg4FkwxNVcby59WVTw2iL",
        "m2joQiJRZnj3jN6NsoKNxaxzUTijkdRoSR",
        "8yf8PAQqU2cDj8Yzgz3LgBEyDqjvCh2xR7",
        "sgB3n11ZPUYHToju6TWMpUZTUcKvQnoFMJ",
        "2UYPbDBnHUEc67e7qD4eXtQQ6zfU2cyvAvk",
        "wybwGC9rhm8ZssBuzpy5goXrAdE31MPdsj",
        "JbM25o7kY7hqJZt3WGYu9pHZFCpA9TCR6t",
        "2efrft5Lnwjtk7F1p9d7BnPd72zko2hQWNi",
        "Syzmb3MiMoiNVpqFdQ38hWgffHg86D2J4e",
        "2g3GUmTQooLrNHaRDhKtLU8rWLz36Beow7F",
        "D3phtGr9iv6238b3zYXq6VgwrzwvfRzWZQ",
        "gpqsFSuMCZmsjPc6Rtgy1FmLx424tH86My",
        "2EUF3GPEUmfocnUc1w6YPtqXVCy3UZA4rAq",
        "TtAaxB3qGz5zEAhhiGkBY9VPV7cekhvRYS",
        "2fM5gVpi7XaiMPm4i29zddTNkmrKe6TzhVZ",
        "ix3NDKgxfYYANKAb5kbmwBYXPrkAsha7uG",
        "2RkPshpFFrkuaP98GprLtgHFTGvPY5e6wCK",
        "Ak1qCDNudRxZVvcW6YDAdD9jpYNNStAVqm"
    ],
    "locked_distribution_addresses": [
        "2eZYSbzBKJ7QCL4kd5LSqV478rJQGb4UNkf",
        "KPfqM6S96WtRLMuSy4XLfVwymVqivdcDoM",
        "5B98bU1nsedGJBdRD5wLtq7Z8t8ZXio8u5",
        "2iZWk5tmBynWxj2PpAFyiZzEws9qSnG3a6n",
        "XUGdPaVnMh7jtzPe3zkrf9FKh5nztFnQU5",
        "hSNgHgewJme8uaHrEuKubHYtYSDckD6hpf",
        "2DeK765jLgnMweYrMp1NaYHfzxumfR1PaQN",
        "orrAssY5V2HuQAbW9K6WktFrGieq2m23pr",
        "4Ebf4PkG9QEnQTm4MVvaZvJV6Y9av3jhgb",
        "7Uf5xJ3GkiEKaLxC2WmJ1t6SeekJeBdJfu",
        "oz4ytDKbCqpgjW3LPc52pW2CaK2gxCcWmL",
        "2ex5Z7TufQ5Z8xv5mXe53fSQRfUr35SSo7Q",
        "WV2ap7ZubTxeDdmEZ1Xo7ufGMkekLWikJu",
        "ckCTV4r1pNuz6j2VBRHhaJN9HsCLY7muLV",
        "MXJx96ZJVSjktgeYZpVK8vn1H3xWP8ooq5",
        "wyQVmno9aBJZmQ99nDSLoYWwp7YDJCWsrH",
        "2cc9wKxCsFNRkoAQDAoHke3ZoyL1mSV14cj",
        "29k9g3F5AYfVaa1joE1PpZjBED6hQXes8Mm",
        "2XPLzz4ZLf1A9ykyTCjW5gEmVjnWa8CuatH",
        "iH7DqqojTgUn2JxmY9hgFp165Nk7wKfan9",
        "RJzzwUs3c9C8Y7NFYzNfFoqiUKeBhBfPki",
        "2W2cGyiCRM4nwmmiGPgMuGaPGeBzEm7VZPn",
        "ALJVNKYL7WGxFBSriiZuwZKWD4b7fbV1od",
        "tBaeg9zE2sgmw5ZQENaPPYd6jfwpVpGTzS",
        "2hdTw5Hk3rsgpZjvk8TyKcCZoRVXU5QVrUt",
        "A1QU6jKq8YgTP79M8fwZNHUZc7hConFKmy",
        "q9RkXoty3X1fuaypDDRUi78rWgJWYJMmpJ",
        "2Xvm6is5cAPA85xnSYXDuAqiRyoXiky5RaD",
        "4CW2CPJEzxhn2PS4JoSLoWGL5QQ7dL2eji",
        "24EG6uTzL7DHNzcwsygYGRR1nfu5kco7AZ1",
        "KghGnWw5fppTrqHSERXZf61yf7GkuQdCnV",
        "2WojewRA3LbpyXTP9ANy8CZqJMgmyNm3MDr",
        "2BsMfywmGV3M2CoDA112Rs7ZBkiMHfy9X11",
        "kK1Q4gPyYfVVMzQtAPRzL8qXMqJ67Y7tKs",
        "28J4mx8xfUtM92DbQ6i2Jmqw5J7dNivfroN",
        "gQvgyG1djgtftoCVrSZmsRxr7okD4LheKw",
        "3iFGBKapAWWzbiGFSr5ScbhrEPm6Esyvia",
        "NFW2akQH2vu7AqkQXxFz2P5vkXTWkSqrSm",
        "2MQJjLnWRp9eHh6MpCwpiUeshhtmri12mci",
        "2QjRQUMyL6iodtHP9zKmxCNYZ7k3jxtk49C",
        "USdfKy7B6oFNoauHWMmoCA7ND9rHqYw2Mf",
        "cA49et9WtptYHf6wA1F8qqVgH3kS5jJ9vK",
        "qaJT9TjcMi46sTKcgwRQU8o5Lw2Ea1gC4N",
        "22pyn5RyhqtTQu4obYjuWYRNNw4i54L8xVr",
        "22dkmukC6iH4FFLBmHne6modJZZQ3MC9BAT",
        "z6CJZfYLvmd41GRVE8HASjRcy5hqbpHZvE",
        "GEBWJ2KpRQDBTCCtvnaAJV2cYurgXS8pta",
        "oS8fbEm82cprmAeineBeDkaKd7QownDZQh",
        "rQpAs1LVQdphyj9ipEAuukAoj9kNpSP8cM",
        "6NSJKsPxmqipGAfFFhUKbkopjrvEESTX3j",
        "cuC68ycVXmD2EBzYFNYQ6akhKGrh3FGjSf",
        "bw4wtYU8toepomrhWP2p8UFYfHBbvEV425",
        "HvgNmDz5jD39Gwmi9VfDY1iYMhZUpZ8GKz",
        "SbApuZAYquWP3Q6iD51BcMBQjuApYEkRVf",
        "2Ugii5yxJgLzC59jV1vF8GK7UBZdvxwobeJ",
        "21N2iJ1qnQRiJWcEqNRxXwfNp8QcmiyhtPy",
        "9TC4RGs6AtFUsbcVWnSoCdoCpSfM66ALAc",
        "oQzn55UWG4iMcY9bTNb27aTnRdfiGHAwbD",
        "2GCdwsRpQhcf8SQcynFrMVDM26Bbj6sgv9M",
        "2NRFe7REtSmaM2qAgZeG45hC8EtVGV2QjeB",
        "25RGnhN7VojHUTvQBJA9nBT5y1qTQGULMzR",
        "26uCBDfF8E2PJU2Dzz2ysgKwv9m4BhodTz9",
        "Wkvima5cF7DDFdmJQqcdq8Syaq9DuAJJRD",
        "286hSoJYxvENFSHwG51ZbmKaochLJyq4ERQ",
        "FEGxF3HPoM2HCWHn82tyeh9o7vEQq5ySGE",
        "h38DxNxGhWGTq9p5tJnN5r4Fwnn85Krrb6",
        "2c1UU8J6Y3kL4cmQh21Tj8wkzidCiZxwdwd",
        "2bJ32KuGmjmwKyAtzWdLFpXNM6t83CCPLq5",
        "2fi8oLC9zfVVGnzzQtu3Y3rffS65Hiz6QHo",
        "TKD93RxFr2Am44TntLiJQus4qcEwTtvEEQ",
        "zMDywYdGEDtTSvWnCyc3qsYHWwj9ogws74",
        "25NbotTka7TwtbXUpSCQD8RMgHKspyDubXJ",
        "2ayCELBERubQWH5QxUr3cTxrYpidvUAzsSw",
        "RMTCwLiYDKEAiJu5ekHL1NQ8UKHi5ozCPg",
        "ejJjiCwp86ykmFr5iTJ8LxQXJ2wJPTYmkm"
    ]
}
Richlist show top N addresses by uxouts
URI: /richlist
Method: GET
Args:
    n: top N addresses, [default 20, returns all if <= 0].
    include-distribution: include distribution addresses or not, default false.

Example:

curl "http://127.0.0.1:8620/richlist?n=4&include-distribution=true"

Result:

{
    "richlist": [
        {
            "address": "zMDywYdGEDtTSvWnCyc3qsYHWwj9ogws74",
            "coins": "1000000.000000",
            "locked": true
        },
        {
            "address": "z6CJZfYLvmd41GRVE8HASjRcy5hqbpHZvE",
            "coins": "1000000.000000",
            "locked": true
        },
        {
            "address": "wyQVmno9aBJZmQ99nDSLoYWwp7YDJCWsrH",
            "coins": "1000000.000000",
            "locked": true
        },
        {
            "address": "tBaeg9zE2sgmw5ZQENaPPYd6jfwpVpGTzS",
            "coins": "1000000.000000",
            "locked": true
        }
    ]
}
Count unique addresses
URI: /addresscount
Method: GET

Example:

curl "http://127.0.0.1:8620/addresscount"

Result:

{
    "count": 10103
}

Network status

Get information for a specific connection
URI: /network/connection
Method: GET
Args:
    addr: ip:port address of a known connection

Example:

curl 'http://127.0.0.1:8620/network/connection?addr=176.9.84.75:6000'

Result:

{
    "id": 109548,
    "address": "176.9.84.75:6000",
    "last_sent": 1520675817,
    "last_received": 1520675817,
    "outgoing": false,
    "introduced": true,
    "mirror": 719118746,
    "listen_port": 6000
}
Get a list of all connections
URI: /network/connections
Method: GET

Example:

curl 'http://127.0.0.1:8620/network/connections'

Result:

{
    "connections": [
        {
            "id": 99107,
            "address": "139.162.161.41:20002",
            "last_sent": 1520675750,
            "last_received": 1520675750,
            "outgoing": false,
            "introduced": true,
            "mirror": 1338939619,
            "listen_port": 20002
        },
        {
            "id": 109548,
            "address": "176.9.84.75:6000",
            "last_sent": 1520675751,
            "last_received": 1520675751,
            "outgoing": false,
            "introduced": true,
            "mirror": 719118746,
            "listen_port": 6000
        },
        {
            "id": 99115,
            "address": "185.120.34.60:6000",
            "last_sent": 1520675754,
            "last_received": 1520675754,
            "outgoing": false,
            "introduced": true,
            "mirror": 1931713869,
            "listen_port": 6000
        }
    ]
}
Get a list of all default connections
URI: /network/defaultConnections
Method: GET

Example:

curl 'http://127.0.0.1:8620/network/defaultConnections'

Result:

[
    "104.237.142.206:6000",
    "118.178.135.93:6000",
    "120.77.69.188:6000",
    "121.41.103.148:6000",
    "139.162.7.132:6000",
    "172.104.85.6:6000",
    "176.58.126.224:6000",
    "47.88.33.156:6000"
]
Get a list of all trusted connections
URI: /network/connections/trust
Method: GET

Example:

curl 'http://127.0.0.1:8620/network/connections/trust'

Result:

[
    "104.237.142.206:6000",
    "118.178.135.93:6000",
    "120.77.69.188:6000",
    "121.41.103.148:6000",
    "139.162.7.132:6000",
    "172.104.85.6:6000",
    "176.58.126.224:6000",
    "47.88.33.156:6000"
]
Get a list of all connections discovered through peer exchange
URI: /network/connections/exchange
Method: GET

Example:

curl 'http://127.0.0.1:8620/network/connections/exchange'

Result:

[
    "104.237.142.206:6000",
    "116.62.220.158:7200",
    "118.237.210.163:6000",
    "120.77.69.188:6000",
    "121.41.103.148:6000",
    "121.41.103.148:7200",
    "139.162.161.41:20000",
    "139.162.161.41:20001",
    "139.162.161.41:20002",
    "139.162.33.154:6000",
    "139.162.7.132:6000",
    "155.94.137.34:6000",
    "164.132.108.92:6000",
    "165.227.199.63:6000",
    "172.104.145.6:6000",
    "172.104.52.230:7200",
    "172.104.85.6:6000",
    "173.212.205.184:6000",
    "173.249.30.221:6000",
    "176.58.126.224:6000",
    "176.9.84.75:6000",
    "185.120.34.60:6000",
    "35.201.160.163:6000",
    "47.88.33.156:6000"
]

Documentation

Index

Constants

View Source
const (
	// CSRFHeaderName is the name of the CSRF header
	CSRFHeaderName = "X-CSRF-Token"

	// CSRFMaxAge is the lifetime of a CSRF token in seconds
	CSRFMaxAge = time.Second * 30
)
View Source
const HTTP401AuthHeader = "SkycoinWallet"

HTTP401AuthHeader WWW-Authenticate value

Variables

This section is empty.

Functions

func CSRFCheck

func CSRFCheck(store *CSRFStore, handler http.Handler) http.Handler

CSRFCheck verifies X-CSRF-Token header value

func OriginRefererCheck

func OriginRefererCheck(host string, handler http.Handler) http.Handler

OriginRefererCheck checks the Origin header if present, falling back on Referer. The Origin or Referer hostname must match the configured host. If neither are present, the request is allowed. All major browsers will set at least one of these values. If neither are set, assume it is a request from curl/wget.

Types

type APIError

type APIError struct {
	Status     string
	StatusCode int
	Message    string
}

APIError is used for non-200 API responses

func (APIError) Error

func (e APIError) Error() string

type BlockchainMetadata

type BlockchainMetadata struct {
	*visor.BlockchainMetadata
	TimeSinceLastBlock wh.Duration `json:"time_since_last_block"`
}

BlockchainMetadata extends visor.BlockchainMetadata to include the time since the last block

type CSRFStore

type CSRFStore struct {
	Enabled bool
	sync.RWMutex
	// contains filtered or unexported fields
}

CSRFStore encapsulates a single CSRFToken

type CSRFToken

type CSRFToken struct {
	Value     []byte
	ExpiresAt time.Time
}

CSRFToken csrf token

func (*CSRFToken) String

func (c *CSRFToken) String() string

String returns the token in base64 URL-safe encoded format

type Client

type Client struct {
	HTTPClient *http.Client
	Addr       string
}

Client provides an interface to a remote node's HTTP API

func NewClient

func NewClient(addr string) *Client

NewClient creates a Client

func (*Client) AddressCount

func (c *Client) AddressCount() (uint64, error)

AddressCount makes a request to /addresscount

func (*Client) AddressTransactions

func (c *Client) AddressTransactions(addr string) ([]ReadableTransaction, error)

AddressTransactions makes a request to /explorer/address

func (*Client) AddressUxOuts

func (c *Client) AddressUxOuts(addr string) ([]*historydb.UxOutJSON, error)

AddressUxOuts makes a request to /address_uxouts

func (*Client) Balance

func (c *Client) Balance(addrs []string) (*wallet.BalancePair, error)

Balance makes a request to /balance?addrs=xxx

func (*Client) BlockByHash

func (c *Client) BlockByHash(hash string) (*visor.ReadableBlock, error)

BlockByHash makes a request to /block?hash=xxx

func (*Client) BlockBySeq

func (c *Client) BlockBySeq(seq uint64) (*visor.ReadableBlock, error)

BlockBySeq makes a request to /block?seq=xxx

func (*Client) BlockchainMetadata

func (c *Client) BlockchainMetadata() (*visor.BlockchainMetadata, error)

BlockchainMetadata makes a request to /blockchain/metadata

func (*Client) BlockchainProgress

func (c *Client) BlockchainProgress() (*daemon.BlockchainProgress, error)

BlockchainProgress makes a request to /blockchain/progress

func (*Client) Blocks

func (c *Client) Blocks(start, end int) (*visor.ReadableBlocks, error)

Blocks makes a request to /blocks

func (*Client) CSRF

func (c *Client) CSRF() (string, error)

CSRF returns a CSRF token. If CSRF is disabled on the node, returns an empty string and nil error.

func (*Client) CoinSupply

func (c *Client) CoinSupply() (*CoinSupply, error)

CoinSupply makes a request to /coinSupply

func (*Client) ConfirmedTransactions

func (c *Client) ConfirmedTransactions(addrs []string) (*[]visor.TransactionResult, error)

ConfirmedTransactions makes a request to /transactions?confirmed=true

func (*Client) CreateEncryptedWallet

func (c *Client) CreateEncryptedWallet(seed, label, password string, scanN int) (*WalletResponse, error)

CreateEncryptedWallet makes a request to /wallet/create and try to create a wallet with encryption. If scanN is <= 0, the scan number defaults to 1

func (*Client) CreateTransaction

func (c *Client) CreateTransaction(req CreateTransactionRequest) (*CreateTransactionResponse, error)

CreateTransaction makes a request to POST /wallet/transaction

func (*Client) CreateUnencryptedWallet

func (c *Client) CreateUnencryptedWallet(seed, label string, scanN int) (*WalletResponse, error)

CreateUnencryptedWallet makes a request to /wallet/create and create a wallet without no encryption If scanN is <= 0, the scan number defaults to 1

func (*Client) DecryptWallet

func (c *Client) DecryptWallet(id string, password string) (*WalletResponse, error)

DecryptWallet decrypts wallet by making a request to /wallet/decrypt

func (*Client) EncryptWallet

func (c *Client) EncryptWallet(id string, password string) (*WalletResponse, error)

EncryptWallet encrypts specific wallet with given password

func (*Client) Get

func (c *Client) Get(endpoint string, obj interface{}) error

Get makes a GET request to an endpoint and unmarshals the response to obj. If the response is not 200 OK, returns an error

func (*Client) GetWalletSeed

func (c *Client) GetWalletSeed(id string, password string) (string, error)

GetWalletSeed makes a request to /wallet/seed

func (*Client) Health

func (c *Client) Health() (*HealthResponse, error)

Health makes a request to /health

func (*Client) InjectTransaction

func (c *Client) InjectTransaction(rawTx string) (string, error)

InjectTransaction makes a request to /injectTransaction

func (*Client) LastBlocks

func (c *Client) LastBlocks(n int) (*visor.ReadableBlocks, error)

LastBlocks makes a request to /last_blocks

func (*Client) NetworkConnection

func (c *Client) NetworkConnection(addr string) (*daemon.Connection, error)

NetworkConnection makes a request to /network/connection

func (*Client) NetworkConnections

func (c *Client) NetworkConnections() (*daemon.Connections, error)

NetworkConnections makes a request to /network/connections

func (*Client) NetworkDefaultConnections

func (c *Client) NetworkDefaultConnections() ([]string, error)

NetworkDefaultConnections makes a request to /network/defaultConnections

func (*Client) NetworkExchangeableConnections

func (c *Client) NetworkExchangeableConnections() ([]string, error)

NetworkExchangeableConnections makes a request to /network/connections/exchange

func (*Client) NetworkTrustedConnections

func (c *Client) NetworkTrustedConnections() ([]string, error)

NetworkTrustedConnections makes a request to /network/connections/trust

func (*Client) NewSeed

func (c *Client) NewSeed(entropy int) (string, error)

NewSeed makes a request to /wallet/newSeed entropy must be 128 or 256

func (*Client) NewWalletAddress

func (c *Client) NewWalletAddress(id string, n int, password string) ([]string, error)

NewWalletAddress makes a request to /wallet/newAddress if n is <= 0, defaults to 1

func (*Client) Outputs

func (c *Client) Outputs() (*visor.ReadableOutputSet, error)

Outputs makes a request to /outputs

func (*Client) OutputsForAddresses

func (c *Client) OutputsForAddresses(addrs []string) (*visor.ReadableOutputSet, error)

OutputsForAddresses makes a request to /outputs?addrs=xxx

func (*Client) OutputsForHashes

func (c *Client) OutputsForHashes(hashes []string) (*visor.ReadableOutputSet, error)

OutputsForHashes makes a request to /outputs?hashes=zzz

func (*Client) PendingTransactions

func (c *Client) PendingTransactions() ([]*visor.ReadableUnconfirmedTxn, error)

PendingTransactions makes a request to /pendingTxs

func (*Client) PostForm

func (c *Client) PostForm(endpoints string, body io.Reader, obj interface{}) error

PostForm makes a POST request to an endpoint with body of "application/x-www-form-urlencoded" formated data.

func (*Client) PostJSON

func (c *Client) PostJSON(endpoints string, reqObj, respObj interface{}) error

PostJSON makes a POST request to an endpoint with body of json data.

func (*Client) RawTransaction

func (c *Client) RawTransaction(txid string) (string, error)

RawTransaction makes a request to /rawtx

func (*Client) ResendUnconfirmedTransactions

func (c *Client) ResendUnconfirmedTransactions() (*daemon.ResendResult, error)

ResendUnconfirmedTransactions makes a request to /resendUnconfirmedTxns

func (*Client) Richlist

func (c *Client) Richlist(params *RichlistParams) (*Richlist, error)

Richlist makes a request to /richlist

func (*Client) Spend

func (c *Client) Spend(id, dst string, coins uint64, password string) (*SpendResult, error)

Spend makes a request to /wallet/spend

func (*Client) Transaction

func (c *Client) Transaction(txid string) (*visor.TransactionResult, error)

Transaction makes a request to /transaction

func (*Client) Transactions

func (c *Client) Transactions(addrs []string) (*[]visor.TransactionResult, error)

Transactions makes a request to /transactions

func (*Client) UnconfirmedTransactions

func (c *Client) UnconfirmedTransactions(addrs []string) (*[]visor.TransactionResult, error)

UnconfirmedTransactions makes a request to /transactions?confirmed=false

func (*Client) UnloadWallet

func (c *Client) UnloadWallet(id string) error

UnloadWallet makes a request to /wallet/unload

func (*Client) UpdateWallet

func (c *Client) UpdateWallet(id, label string) error

UpdateWallet makes a request to /wallet/update

func (*Client) UxOut

func (c *Client) UxOut(uxID string) (*historydb.UxOutJSON, error)

UxOut makes a request to /uxout?uxid=xxx

func (*Client) Version

func (c *Client) Version() (*visor.BuildInfo, error)

Version makes a request to /version

func (*Client) Wallet

func (c *Client) Wallet(id string) (*WalletResponse, error)

Wallet makes a request to /wallet

func (*Client) WalletBalance

func (c *Client) WalletBalance(id string) (*wallet.BalancePair, error)

WalletBalance makes a request to /wallet/balance

func (*Client) WalletFolderName

func (c *Client) WalletFolderName() (*WalletFolder, error)

WalletFolderName makes a request to /wallets/folderName

func (*Client) WalletTransactions

func (c *Client) WalletTransactions(id string) (*UnconfirmedTxnsResponse, error)

WalletTransactions makes a request to /wallet/transactions

func (*Client) Wallets

func (c *Client) Wallets() ([]*WalletResponse, error)

Wallets makes a request to /wallets

type CoinSupply

type CoinSupply struct {
	// Coins distributed beyond the project:
	CurrentSupply string `json:"current_supply"`
	// TotalSupply is CurrentSupply plus coins held by the distribution addresses that are spendable
	TotalSupply string `json:"total_supply"`
	// MaxSupply is the maximum number of coins to be distributed ever
	MaxSupply string `json:"max_supply"`
	// CurrentCoinHourSupply is coins hours in non distribution addresses
	CurrentCoinHourSupply string `json:"current_coinhour_supply"`
	// TotalCoinHourSupply is coin hours in all addresses including unlocked distribution addresses
	TotalCoinHourSupply string `json:"total_coinhour_supply"`
	// Distribution addresses which count towards total supply
	UnlockedAddresses []string `json:"unlocked_distribution_addresses"`
	// Distribution addresses which are locked and do not count towards total supply
	LockedAddresses []string `json:"locked_distribution_addresses"`
}

CoinSupply records the coin supply info

type Config

type Config struct {
	StaticDir       string
	DisableCSRF     bool
	EnableWalletAPI bool
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	IdleTimeout     time.Duration
}

Config configures Server

type CreateTransactionRequest

type CreateTransactionRequest struct {
	HoursSelection HoursSelection                 `json:"hours_selection"`
	Wallet         CreateTransactionRequestWallet `json:"wallet"`
	ChangeAddress  string                         `json:"change_address"`
	To             []Receiver                     `json:"to"`
}

CreateTransactionRequest is sent to /wallet/transaction

type CreateTransactionRequestWallet

type CreateTransactionRequestWallet struct {
	ID        string   `json:"id"`
	Addresses []string `json:"addresses,omitempty"`
	Password  string   `json:"password"`
}

CreateTransactionRequestWallet defines a wallet to spend from and optionally which addresses in the wallet

type CreateTransactionResponse

type CreateTransactionResponse struct {
	Transaction        CreatedTransaction `json:"transaction"`
	EncodedTransaction string             `json:"encoded_transaction"`
}

CreateTransactionResponse is returned by /wallet/transaction

func NewCreateTransactionResponse

func NewCreateTransactionResponse(txn *coin.Transaction, inputs []wallet.UxBalance) (*CreateTransactionResponse, error)

NewCreateTransactionResponse creates a CreateTransactionResponse

type CreatedTransaction

type CreatedTransaction struct {
	Length    uint32 `json:"length"`
	Type      uint8  `json:"type"`
	TxID      string `json:"txid"`
	InnerHash string `json:"inner_hash"`
	Fee       string `json:"fee"`

	Sigs []string                   `json:"sigs"`
	In   []CreatedTransactionInput  `json:"inputs"`
	Out  []CreatedTransactionOutput `json:"outputs"`
}

CreatedTransaction represents a transaction created by /wallet/transaction

func NewCreatedTransaction

func NewCreatedTransaction(txn *coin.Transaction, inputs []wallet.UxBalance) (*CreatedTransaction, error)

NewCreatedTransaction returns a CreatedTransaction

func (*CreatedTransaction) ToTransaction

func (r *CreatedTransaction) ToTransaction() (*coin.Transaction, error)

ToTransaction converts a CreatedTransaction back to a coin.Transaction

type CreatedTransactionInput

type CreatedTransactionInput struct {
	UxID            string `json:"uxid"`
	Address         string `json:"address"`
	Coins           string `json:"coins"`
	Hours           string `json:"hours"`
	CalculatedHours string `json:"calculated_hours"`
	Time            uint64 `json:"timestamp"`
	Block           uint64 `json:"block"`
	TxID            string `json:"txid"`
}

CreatedTransactionInput is a verbose transaction input

func NewCreatedTransactionInput

func NewCreatedTransactionInput(out wallet.UxBalance) (*CreatedTransactionInput, error)

NewCreatedTransactionInput creates CreatedTransactionInput

type CreatedTransactionOutput

type CreatedTransactionOutput struct {
	UxID    string `json:"uxid"`
	Address string `json:"address"`
	Coins   string `json:"coins"`
	Hours   string `json:"hours"`
}

CreatedTransactionOutput is a transaction output

func NewCreatedTransactionOutput

func NewCreatedTransactionOutput(out coin.TransactionOutput, txid cipher.SHA256) (*CreatedTransactionOutput, error)

NewCreatedTransactionOutput creates CreatedTransactionOutput

type Gatewayer

type Gatewayer interface {
	Spend(wltID string, password []byte, coins uint64, dest cipher.Address) (*coin.Transaction, error)
	CreateTransaction(w wallet.CreateTransactionParams) (*coin.Transaction, []wallet.UxBalance, error)
	GetWalletBalance(wltID string) (wallet.BalancePair, error)
	GetWallet(wltID string) (*wallet.Wallet, error)
	GetWallets() (wallet.Wallets, error)
	UpdateWalletLabel(wltID, label string) error
	GetWalletUnconfirmedTxns(wltID string) ([]visor.UnconfirmedTxn, error)
	CreateWallet(wltName string, options wallet.Options) (*wallet.Wallet, error)
	NewAddresses(wltID string, password []byte, n uint64) ([]cipher.Address, error)
	GetWalletDir() (string, error)
	IsWalletAPIEnabled() bool
	EncryptWallet(wltID string, password []byte) (*wallet.Wallet, error)
	DecryptWallet(wltID string, password []byte) (*wallet.Wallet, error)
	GetWalletSeed(wltID string, password []byte) (string, error)
	GetBlockByHash(hash cipher.SHA256) (block coin.SignedBlock, ok bool)
	GetBlockBySeq(seq uint64) (block coin.SignedBlock, ok bool)
	GetBlocks(start, end uint64) (*visor.ReadableBlocks, error)
	GetLastBlocks(num uint64) (*visor.ReadableBlocks, error)
	GetBuildInfo() visor.BuildInfo
	GetUnspentOutputs(filters ...daemon.OutputsFilter) (*visor.ReadableOutputSet, error)
	GetBalanceOfAddrs(addrs []cipher.Address) ([]wallet.BalancePair, error)
	GetBlockchainMetadata() (*visor.BlockchainMetadata, error)
	GetBlockchainProgress() *daemon.BlockchainProgress
	GetConnection(addr string) *daemon.Connection
	GetConnections() *daemon.Connections
	GetDefaultConnections() []string
	GetTrustConnections() []string
	GetExchgConnection() []string
	GetAllUnconfirmedTxns() []visor.UnconfirmedTxn
	GetTransaction(txid cipher.SHA256) (*visor.Transaction, error)
	GetTransactions(flts ...visor.TxFilter) ([]visor.Transaction, error)
	InjectBroadcastTransaction(txn coin.Transaction) error
	ResendUnconfirmedTxns() *daemon.ResendResult
	GetUxOutByID(id cipher.SHA256) (*historydb.UxOut, error)
	GetAddrUxOuts(addr []cipher.Address) ([]*historydb.UxOut, error)
	GetAddressTxns(a cipher.Address) (*visor.TransactionResults, error)
	GetRichlist(includeDistribution bool) (visor.Richlist, error)
	GetAddressCount() (uint64, error)
	GetHealth() (*daemon.Health, error)
	UnloadWallet(id string) error
}

Gatewayer interface for Gateway methods

type HealthResponse

type HealthResponse struct {
	BlockchainMetadata BlockchainMetadata `json:"blockchain"`
	Version            visor.BuildInfo    `json:"version"`
	OpenConnections    int                `json:"open_connections"`
	Uptime             wh.Duration        `json:"uptime"`
}

HealthResponse is returned by the /health endpoint

type HoursSelection

type HoursSelection struct {
	Type        string `json:"type"`
	Mode        string `json:"mode"`
	ShareFactor string `json:"share_factor,omitempty"`
}

HoursSelection defines options for hours distribution

type ReadableTransaction

type ReadableTransaction struct {
	Status    visor.TransactionStatus `json:"status"`
	Length    uint32                  `json:"length"`
	Type      uint8                   `json:"type"`
	Hash      string                  `json:"txid"`
	InnerHash string                  `json:"inner_hash"`
	Timestamp uint64                  `json:"timestamp,omitempty"`

	Sigs []string                          `json:"sigs"`
	In   []visor.ReadableTransactionInput  `json:"inputs"`
	Out  []visor.ReadableTransactionOutput `json:"outputs"`
}

ReadableTransaction represents readable address transaction

func NewReadableTransaction

func NewReadableTransaction(t visor.TransactionResult, inputs []visor.ReadableTransactionInput) ReadableTransaction

NewReadableTransaction creates readable address transaction

type Receiver

type Receiver struct {
	Address string `json:"address"`
	Coins   string `json:"coins"`
	Hours   string `json:"hours,omitempty"`
}

Receiver specifies a spend destination

type Richlist

type Richlist struct {
	Richlist visor.Richlist `json:"richlist"`
}

Richlist is the API response for /richlist, contains top address balances

type RichlistParams

type RichlistParams struct {
	N                   int
	IncludeDistribution bool
}

RichlistParams are arguments to the /richlist endpoint

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server exposes an HTTP API

func Create

func Create(host string, c Config, daemon *daemon.Daemon) (*Server, error)

Create creates a new Server instance that listens on HTTP

func CreateHTTPS

func CreateHTTPS(host string, c Config, daemon *daemon.Daemon, certFile, keyFile string) (*Server, error)

CreateHTTPS creates a new Server instance that listens on HTTPS

func (*Server) Serve

func (s *Server) Serve() error

Serve serves the web interface on the configured host

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown closes the HTTP service. This can only be called after Serve or ServeHTTPS has been called.

type SpendResult

type SpendResult struct {
	Balance     *wallet.BalancePair        `json:"balance,omitempty"`
	Transaction *visor.ReadableTransaction `json:"txn,omitempty"`
	Error       string                     `json:"error,omitempty"`
}

SpendResult represents the result of spending

type UnconfirmedTxnsResponse

type UnconfirmedTxnsResponse struct {
	Transactions []visor.ReadableUnconfirmedTxn `json:"transactions"`
}

UnconfirmedTxnsResponse contains unconfirmed transaction data

type WalletEntry

type WalletEntry struct {
	Address string `json:"address"`
	Public  string `json:"public_key"`
}

WalletEntry the wallet entry struct

type WalletFolder

type WalletFolder struct {
	Address string `json:"address"`
}

WalletFolder struct

type WalletMeta

type WalletMeta struct {
	Coin       string `json:"coin"`
	Filename   string `json:"filename"`
	Label      string `json:"label"`
	Type       string `json:"type"`
	Version    string `json:"version"`
	CryptoType string `json:"crypto_type"`
	Timestamp  int64  `json:"timestamp"`
	Encrypted  bool   `json:"encrypted"`
}

WalletMeta the wallet meta struct

type WalletResponse

type WalletResponse struct {
	Meta    WalletMeta    `json:"meta"`
	Entries []WalletEntry `json:"entries"`
}

WalletResponse wallet response struct for http apis

func NewWalletResponse

func NewWalletResponse(w *wallet.Wallet) (*WalletResponse, error)

NewWalletResponse creates WalletResponse struct from *wallet.Wallet

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL