By default the API is reachable under the port 12303. It is a REST API using JSON encoding.
For security reasons every request is required to send a header parameter apiKey
that contains your API KEY that you can find in ~/ubic/config.ini
returns basic information regarding the node status.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/status/
Example response:
{
"bestBlock": {
"hash": "2467bb2e591cff6eda451f03eca10cf771ee5a04be031ec403c0c5dbdd74eb5c",
"height": "274453"
},
"synced": "true",
"peersCount": "11"
}
currencies
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/currencies/
Example response:
{
"currencyCodes": {
"1": "UCH",
"2": "UDE",
"3": "UAT",
"4": "UUK",
"5": "UIR",
"6": "UUS",
"7": "UAU",
"8": "UCN",
"9": "USE",
"10": "UFR",
"11": "UCA",
"12": "UJP",
"13": "UTH",
"14": "UNZ",
"15": "UAE",
"16": "UFI",
"17": "ULU",
"18": "USG",
"19": "UHU",
"20": "UCZ",
"21": "UMY",
"22": "UUA",
"23": "UES",
"24": "UMC",
"25": "ULI",
"26": "UIS",
"27": "UHK",
"28": "UES"
}
}
A transaction in progress
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/incoming/
Example response:
{
"transactions": [
{
"txId": "a3f339fd676848f6d2bfb2ba7ee6bf55155a8e2e1d27582e9a0299cdb778e208",
"txHash": "564b0ab6abc690f7a3556987badd9392e5e865e3cade479bff8445b1ee4151c1",
"network": "1",
"fee": {
"2": "9570000"
},
"txIn": [
{
"inAddress": "62a95d5f3ba8a551384aa85f14d6c4a1d1821770",
"scriptType": "2",
"script": "0021020637a211d682d1402557be5407336c9958cf11809952835d7ce91eef8976b848473045022100c3394ac5369f2cedc31eeac8d83c083c4306759acec402e62ea4a8566ada753902207de5eb584543b1eba6a678d614bf5280272cb80cbd613de0b95e31df57e367e3",
"amount": {
"2": "1009570000"
},
"nonce": "34",
"isMine": "false"
}
],
"txOut": [
{
"scriptType": "2",
"script": "fc5892311282ed287f50a2553936824bacbac30e",
"amount": {
"2": "1000000000"
},
"isMine": "true"
}
],
"timestamp": "1589167942"
}
]
}
returns all addresses contained in the wallet.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/wallet/
Example response:
{
"addresses": [
{
"readable": "qbAnMsiGXXPFSFvjBpRwYgZbuc2a6ibAV",
"addressLink": "7ce3318301bad5fbdb58f8d034bac2d8453ffc46",
"hexscript": "fc5892311282ed287f50a2553936824bacbac30e",
"pubKey": "02bf863cb4e2493773d957587d019bbfe4730ec351a371962db752c9a08cafa464",
"amount": {
"2": "890150078"
}
},
{
"readable": "qW4TQapcRRFJsBraQVa3Jrs1Sg3mfhvXh",
"addressLink": "dca85fc8579a9cf7ca9161e699ceb9147f235e40",
"hexscript": "04fc1e8999f350c7656cc33e448ad5309488cd55",
"pubKey": "03dcc5d5a3146459972c172b33e2a2ea894e0b1aa15d0e2ee3b380908bbba42f5e",
"amount": ""
},
{
"readable": "qYr6b2sNtEY4vwRWEcRsNqvhHytf7Aztb",
"addressLink": "13185d602c9ec6f3d378646d7ca2a59ede532342",
"hexscript": "8bea7de8cd2b64aaf6b26a51c99c71b024c586d2",
"pubKey": "0370664c41eeb152b0c317211a7a8c933588201bc7bf2437d1ae64e589d627c355",
"amount": ""
},
"total": ""
}
Create a Transaction
Request:
curl 'http://127.0.0.1:12303/wallet/createTransaction' \
-H 'apiKey: xxxxxx' \
--data 'json={"qYqo3LsVmyusiZHSqAEndcLnNSgEqNUah":{"2":100000000}}' \
--compressed \
--insecure
{"qYqo3LsVmyusiZHSqAEndcLnNSgEqNUah":{"2":100000000}}
address:qYqo3LsVmyusiZHSqAEndcLnNSgEqNUah
currencies: 2
amount: 100000000
Example response:
{
"success": "true",
"transaction": {
"txId": "e3fca4300a58e04406858a4140f54344e26a367c7e9f762ca9f1834117f013c5",
"txHash": "0d26ea9953bbf95dcfb626669525e513f1925f69b7cce3578c61e7b352c9a355",
"network": "1",
"fee": {
"2": "9849922"
},
"txIn": [
{
"inAddress": "7ce3318301bad5fbdb58f8d034bac2d8453ffc46",
"scriptType": "2",
"script": "002102bf863cb4e2493773d957587d019bbfe4730ec351a371962db752c9a08cafa464473045022021fc32ae9ea8c8206663cd305dfc392a09c9337da6ce9db7221c3907b4730a3a022100b6611d94dfed8083651495ac618a05b0f64b27b1d3674f3a25627c4192096adf",
"amount": {
"2": "109849922"
},
"nonce": "0"
}
],
"txOut": [
{
"scriptType": "2",
"script": "8ba9d7d6a74303a79548500aca0423968431a030",
"amount": {
"2": "100000000"
}
}
]
},
"base64": "AQEBAgAAAAAGjC1CFHzjMYMButX721j40DS6wthFP\/xGAAAAAAJrACECv4Y8tOJJN3PZV1h9AZu\/5HMOw1GjcZYtt1LJoIyvpGRHMEUCICH8Mq6eqMggZmPNMF38OSoJyTN9ps6dtyIcOQe0cwo6AiEAtmEdlN\/tgINlFJWsYYoFsPZLJ7HTZ086JWJ8QZIJat8BAQIAAAAABfXhAAIUi6nX1qdDA6eVSFAKygQjloQxoDAAAA=="
}
Send a Transaction
Request:
curl 'http://127.0.0.1:12303/wallet/send' \
-H 'apiKey: xxxxxx' \
--data 'json={"base64":"AQEBAgAAAAAGjC1CFHzjMYMButX721j40DS6wthFP/xGAAAAAAJrACECv4Y8tOJJN3PZV1h9AZu/5HMOw1GjcZYtt1LJoIyvpGRHMEUCICH8Mq6eqMggZmPNMF38OSoJyTN9ps6dtyIcOQe0cwo6AiEAtmEdlN/tgINlFJWsYYoFsPZLJ7HTZ086JWJ8QZIJat8BAQIAAAAABfXhAAIUi6nX1qdDA6eVSFAKygQjloQxoDAAAA=="}' \
--compressed \
--insecure
json data for createTransaction base64
Example response:
{"success": true}
Local transaction data
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/wallet/transactions/
Example response:
{
"transactions": [
{
"txId": "e3fca4300a58e04406858a4140f54344e26a367c7e9f762ca9f1834117f013c5",
"txHash": "0d26ea9953bbf95dcfb626669525e513f1925f69b7cce3578c61e7b352c9a355",
"network": "1",
"fee": {
"2": "9849922"
},
"txIn": [
{
"inAddress": "7ce3318301bad5fbdb58f8d034bac2d8453ffc46",
"scriptType": "2",
"script": "002102bf863cb4e2493773d957587d019bbfe4730ec351a371962db752c9a08cafa464473045022021fc32ae9ea8c8206663cd305dfc392a09c9337da6ce9db7221c3907b4730a3a022100b6611d94dfed8083651495ac618a05b0f64b27b1d3674f3a25627c4192096adf",
"amount": {
"2": "109849922"
},
"nonce": "0",
"isMine": "true"
}
],
"txOut": [
{
"scriptType": "2",
"script": "8ba9d7d6a74303a79548500aca0423968431a030",
"amount": {
"2": "100000000"
},
"isMine": "false"
}
],
"isInMainChain": "true",
"confirmations": "3"
},
{
"txId": "a3f339fd676848f6d2bfb2ba7ee6bf55155a8e2e1d27582e9a0299cdb778e208",
"txHash": "564b0ab6abc690f7a3556987badd9392e5e865e3cade479bff8445b1ee4151c1",
"network": "1",
"fee": {
"2": "9570000"
},
"txIn": [
{
"inAddress": "62a95d5f3ba8a551384aa85f14d6c4a1d1821770",
"scriptType": "2",
"script": "0021020637a211d682d1402557be5407336c9958cf11809952835d7ce91eef8976b848473045022100c3394ac5369f2cedc31eeac8d83c083c4306759acec402e62ea4a8566ada753902207de5eb584543b1eba6a678d614bf5280272cb80cbd613de0b95e31df57e367e3",
"amount": {
"2": "1009570000"
},
"nonce": "34",
"isMine": "false"
}
],
"txOut": [
{
"scriptType": "2",
"script": "fc5892311282ed287f50a2553936824bacbac30e",
"amount": {
"2": "1000000000"
},
"isMine": "true"
}
],
"isInMainChain": "true",
"confirmations": "4"
}
]
}
Generate an address that contains the private key,this key is not stored in the UBIC wallet
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/wallet/generate-key-pair
Example response:
{
"warning": "this key is not stored in the UBIC wallet",
"privateKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"readableAddress": "qXvua5m8hJ5JDbtyym5edyrL2CDYxxxxx"
}
Query the address
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/address/{addressLink}
Example response:
{
"address": {
"nonce": "0",
"scriptType": "2",
"script": "00de042c56f08b77f4304d3374cce334fa3c9069",
"amountWithUBI": {
"8": "500000000"
},
"amountWithoutUBI": {
"8": "500000000"
},
"UBIdebit": "",
"dsc": ""
}
}
returns all connected peers.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/peers/
Example response:
{
"peers": [
{
"ip": "101.133.143.192",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "163.172.182.123",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "192.161.49.152",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "195.154.106.30",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "219.152.54.247",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "27.155.101.114",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "47.240.160.37",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "47.57.122.73",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "47.75.13.236",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "51.15.99.155",
"blockHeight": "274454",
"donationAddress": ""
},
{
"ip": "91.200.242.115",
"blockHeight": "274454",
"donationAddress": ""
}
]
}
add peer
Request:
curl 'http://127.0.0.1:12303/wallet/add' \
-H 'apiKey: xxxxxx' \
--data 'json={"ip": "47.240.160.37"}' \
--compressed \
--insecure
Example response:
{"success": true}
remove peer
Request:
curl 'http://127.0.0.1:12303/wallet/send' \
-H 'apiKey: xxxxxx' \
--data 'json={"ip": "47.240.160.37"}' \
--compressed \
--insecure
Example response:
{"success": true}
returns all connected peers.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/peers/
Example response:
{
"transactions": ""
}
returns all known delegates.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/peers/
Example response:
{
"delegates": [
{
"pubKey": "026b84273f8a385c0858995daae91002cbcc341381cbeb5ff0cd66e29f9ae751ed",
"nonce": "0",
"totalVote": "14",
"votes": "14",
"unVotes": "0",
"lastVotedInBlock": "",
"isActive": "true",
"isCurrent": "false",
"isMe": "false",
"votes": ""
}
]
}
returns the content of a block.
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/blocks/{height or hash}
Example response:
{
"blockHeader": {
"headerHash": "0af7d525a40b93cdb9873ff953731b09e341056981ea1689b890fb745bdd0a92",
"previousHeaderHash": "nullptr",
"merkleRootHash": "nullptr",
"blockHeight": "1",
"timestamp": "1519606896",
"issuerPubKey": "03193ad92191b376ddfb70d5a6ab5f41a5197644fdd39d1d9dffcbc6cc18dbec19",
"issuerSignature": "304502202608ec61f10341af5ffe94a7087bfb34a78bebcc340a85328051119aee5bcbf4022100c5bc34dd1f629ea960916a09eb4b849f39010c8f74efa2897220130054fb476a",
"payout": "",
"payoutRemainder": "",
"ubiReceiverCount": {
"1": "0",
"2": "0",
"3": "0",
"4": "0",
"5": "0",
"6": "0",
"7": "0",
"8": "0",
"9": "0",
"10": "0",
"11": "0",
"12": "0",
"13": "0",
"14": "0",
"15": "0",
"16": "0",
"17": "0",
"18": "0",
"19": "0",
"20": "0",
"21": "0",
"22": "0",
"23": "0",
"24": "0",
"25": "0"
},
"votes": ""
},
"transactions": ""
}
Node score
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/bans
Example response:
{
"bans": [
{
"ip": "195.154.106.30",
"score": "0"
}
]
}
Transfer formalities rate query
Request:
curl -s -H "apiKey:xxxxxxx" http://127.0.0.1:12303/fees
Example response:
{
"description": "Fees for 1MB (1000 bytes)",
"fees": {
"1": "4850000",
"2": "47850000",
"3": "5050000",
"4": "37975000",
"5": "2750000",
"6": "186975000",
"7": "13900000",
"8": "77478000",
"9": "5725000",
"10": "38875000",
"11": "21000000",
"12": "73500000",
"13": "38775000",
"14": "2650000",
"15": "5375000",
"16": "3175000",
"17": "250000",
"18": "3250000",
"19": "5675000",
"20": "6125000",
"21": "18400000",
"22": "26050000",
"23": "800000",
"24": "25000",
"25": "25000",
"26": "200000",
"27": "4275000",
"28": "27000000"
}
}