Description
The LibreMoney API allows interaction with LibreMoney nodes using HTTP GET requests (Except for a few calls that need to be POST). Responses are returned as JSON objects.
API calls are made by communicating with LibreMoney nodes on port 7876. In all the examples here, the node is represented as "localhost". Examples and responses are all formatted for easy reading; line breaks and spaces are not actually used in requests or responses.
Many API calls make reference to the Genesis block. FYI, the genesis block's ID is 2680262203532249785
All the API calls can be seen and tested at http://localhost:7876/test Specific API calls can be seen and tested at http://localhost:7876/test?requestType=<specificRequestType> where <specificRequestType> is the name of specific API call you are looking for
General Notes
All http API requests that create a new transaction will accept either a secretPhrase or a publicKey parameter:
- If secretPhrase is supplied, a transaction is created, signed at the server, and broadcast by the server as usual.
- If a publicKey parameter is supplied as a hex-encoded byte array, the transaction will be prepared by the server and returned in the JSON response as transactionBytes. This byte array can now be signed by the client, and then sent back to the server for broadcasting using the broadcastTransaction API.
All API calls that require an account numbers can have the account number as either account id's or Reed-Solomon addresses
Alias operations
Create/assign alias
Allows you to create an alias with a single request. If the alias has already been created, this request will assign a new URI to the alias.
Request
http://localhost:1400/api? requestType=setAlias& secretPhrase=SECRET& aliasName=ALIAS& aliasURI=URI& fee=FEE& deadline=DEADLINE& publicKey=PUBKEY& referencedTransactionFullHash=TRANSFULLHASH& broadcast=BROAD
Where:
- SECRET is the secret passphrase for the sending account
- ALIAS is the alias you'd like to create
- URI is the alias text (e.g. http://www.google.com/)
- FEE is the fee (in MilliLm) for the transaction
- DEADLINE is the deadline for the transaction, in minutes
- PUBKEY is the 64-byte public key associated with the account. (optional)
- TRANSFULLHASH If you want to reference another transaction(optional)
- BROAD true or false if it should be broadcasted (optional)
Response
{ "transactionId": "TXID" } { "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Example
Request:
http://localhost:1400/api? requestType=setAlias& secretPhrase=123& aliasName=Google& aliasURI=http://google.com& fee=100000000& deadline=1440
Response:
{ "fullHash": "645853ddc55daa2c948f46520b0630d964ce0f40c0ee03515faffce6259d0bae", "signatureHash": "1e622a64292f8b1fcb1ccf155a42a37a99b89cbcaa725f1200ab55b5ec5f1ca8", "transactionBytes": "0101fe21d700a005668683e673274c671802492d6f54cdc33d247aa426e7ce...", "hash": "580c1bb70d7bcb1eb967c4e86c6c9bfc481641dcce84300a579caf35840e662a", "transaction": "3218487988112808036", "broadcasted": true, "unsignedTransactionBytes": "0101fe21d700a005668683e673274c671802492d6f54cdc33d247a..." }
Verified 5/20/14
Get alias
Retries information about the alias id or alias name that is provided
Request
https://localhost:1400/api? requestType=getAlias& alias=ALIAS_ID& aliasName=ALIAS_NAME
Where:
- ALIAS_ID is the alias id you want to look up
- ALIAS_NAME is the name of the alias you want to look up
Response
{ "timestamp": TIMESTAMP, "aliasName": "ALIAS", "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "aliasURI": "URI", "alias": "ALIAS_ID" }
Where:
- TIMESTAMP is the time when the alias was created. This is expressed in seconds since the timestamp of the genesis block
- ALIAS is the name of the alias with the id
- ACCOUNT is the account that own the alias
- ACCOUNTRS is the Reed-Solomon address of the account
- URI is the address the alias points to
- ALIAS_ID is the alias's id
Example
Request:
https://localhost:1400/api? requestType=getAlias& alias=15515279700680480368
Response:
{ "timestamp": 2409343, "aliasName": "google", "account": "5629477397208681336", "accountRS": "LMA-FLVS-VRBV-LDPD-6DZ9W", "aliasURI": "http://google.com", "alias": "15515279700680480368" }
Verified 5/22/14
Get aliases
Retries information on all alias for a given account (since timestamp if provided)
Request
https://localhost:1400/api? requestType=getAliases& account=ACCOUNT& timestamp=TIMESTAMP
Where:
- ACCOUNT is the account you want to lookup aliases for
- TIMESTAMP is the time you want to see aliases since. This is expressed in seconds since the timestamp of the genesis block (optional)
Response
{ "aliases": [ { "timestamp": TIMESTAMP, "aliasName": "ALIAS", "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "aliasURI": "URI", "alias": "ALIAS_ID" }, { ... }] }
Where:
- TIMESTAMP is the time when the alias was created. This is expressed in seconds since the timestamp of the genesis block
- ALIAS is the name of the alias
- ACCOUNT is the account that own the alias
- ACCOUNTRS is the Reed-Solomon address of the account
- URI is the address the alias points to
- ALIAS_ID is the alias's id
Example
Request:
https://localhost:1400/api? requestType=getAliases& account=5629477397208681336
Response:
{ "aliases": [ { "timestamp": 2409602, "aliasName": "promotion", "alias": "11086300057073013586", "aliasURI": "", "accountRS": "LMA-FLVS-VRBV-LDPD-6DZ9W", "account": "5629477397208681336" }, { ... }] }
Verified 5/22/14
Get alias ID (Depreciated)
Retries the alias ID for a specific alias. Implemented in version 0.5.4e. Depreciated in version 1.1.4
Request
https://localhost:1400/api? requestType=getAliasId& alias=ALIAS
Where:
- ALIAS is the alias you want to look up
Response
{ "id": "ALIAS_ID" }
Example
Request:
https://localhost:1400/api? requestType=getAliasId& alias=google
Response:
{ "id": "15515279700680480368" }
Verified 5/20/14
Get alias IDs (Depreciated)
Tells you all transactionIDs of aliases after a specified time in the blockchain. Depreciated in version 1.1.4.
Request
https://localhost:1400/api? requestType=getAliasIds& timestamp=TIMESTAMP
Where:
- TIMESTAMP is the time from which you'd like to see defined aliases. This is expressed in seconds since the timestamp of the genesis block
Response
{ "aliasIds": [ARRAY_OF_ALIAS_IDs] }
Example
Request:
https://localhost:1400/api? requestType=getAliasIds& timestamp=30000
Response:
{ "aliasIds": ["12219820415480193342", "2284413548488744428", "6882945328050210195"...] }
Verified 5/20/14
Get alias URI (Depreciated)
Tells you the target URI of an alias. Depreciated in version 1.1.4.
Request
http://localhost:1400/api? requestType=getAliasURI& alias=ALIAS
Where:
- ALIAS is the alias whose target you'd like to see
Response
{ "uri": "URI_ASSIGNED_TO_ALIAS" }
Note: Returned URIs will be escaped!
Example
Request:
http://localhost:1400/api? requestType=getAliasURI& alias=Google
Response:
{ "uri": "http:\/\/google.com" }
Verified 5/20/14
List Aliases (Depreciated)
Gives you a list of aliases owned by an account. Depreciated in version 1.1.4.
Request
http://localhost:1400/api? requestType=listAccountAliases& account=ACCOUNT
Where:
- ACCOUNT is an account number
Response
{ "aliases": [ { "alias": "ALIAS", "uri": "URI", "account": "ACCOUNT", "timestamp": "TIMESTAMP" } ] }
Example
Request:
http://localhost:1400/api? requestType=listAccountAliases& account=17157779854388545959
Response:
{ "aliases": [ { "alias": "testalias", "uri": "1337", "account": "17157779854388545959", "timestamp": 2920016 } ] }
Verified 5/20/14
Arbitrary Message System Operations
Send Message
Creates an Arbitrary Message transaction.
Request
http://localhost:1400/api? requestType=sendMessage& secretPhrase=SECRET& recipient=RECIP_ACCOUNT& fee=FEE& message=HEX_STRING& deadline=DEADLINE& referencedTransaction=REFTXID& broadcast=BROAD
Where:
- SECRET is the secret passphrase for the sending account
- RECIP_ACCOUNT is the account number of the receiver account
- HEX_STRING is the hex-encoded message. The content and encryption method for this string are not predefined; this is up to the developer. The message size is currently capped at 1000 Bytes.
- FEE is the fee (in MilliLm) for the transaction
- DEADLINE is the transaction deadline, in minutes
- REFTXID is a previous transaction ID that you want to reference. This creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed. (optional)
- BROAD is if you want the transaction broadcasted or not (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where:
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=sendMessage& secretPhrase=MySuperSecretPasswordThatYouDoNotKnow& recipient=501860284368& message= 6602b1611f921092bdf2a89fc97148ec9684066776b83fd3& deadline=720& referencedTransaction=8815617645011985536
Response:
{ "fullHash": "d56ade2c322083d76ebcdb9f9ef18d7d52c6d105f67be040cc423c7a41a47aea", "signatureHash": "458514e72f4272c789f99201c27cff611460de10fe484b474166c1199c23e754", "transactionBytes": "0100471ddb00a005668683e673274c671802492d6f54cdc33d247aa426e7cef...", "hash": "36a0dc90736d95ad5302f078d5db6fc48e5c087b76da65944f7fe2836b73abcd", "transaction": "15529291339976829653", "broadcasted": true, "unsignedTransactionBytes": "0100471ddb00a005668683e673274c671802492d6f54cdc33d247aa4..." }
Verified 5/9/14
Block operations
Get Block
Retrieves block data.
Request
http://localhost:1400/api? requestType=getBlock& block=BLOCKADDRESS
Where:
- BLOCKADDRESS is the LibreMoney block address
Response
{ "generatorRS": "ACCOUNTRS", "previousBlockHash":"32BytesRepresentedInHexadecimalForm", "payloadLength":PAYLOADLEN, "totalAmount":TOTAL, "generationSignature":"64BytesRepresentedInHexadecimalForm", "generator":"ACCOUNT", "baseTarget":"BASETARGET", "payloadHash":"32BytesRepresentedInHexadecimalForm", "nextBlock":"NEXTBLOCK", "numberOfTransactions":NUMTX, "blockSignature":"64BytesRepresentedInHexadecimalForm", "transactions": [ "TRANSACTION1", "TRANSACTION2" ], "version":VERSION, "totalFee":"FEE", "previousBlock":"PREVBLOCK", "height":HEIGHT, "timestamp":TIME }
Where:
- HEIGHT is the block height
- ACCOUNTRS is the Reed-Solomon address of the account
- "generator" is the account that generated the block.
- ACCOUNT is an account number
- TIME is the time in seconds that the block was generated; 0 is the time of creation of the genesis block timestamp.
- NUMTX is the number of transactions in the block
- TOTAL is the total MilliLm in the block
- FEE is the MilliLm fee for the block
- VERSION is the block version
- BASETARGET is the hash target for the block generation
- PAYLOADLEN = "numberOfTransactions" * 128 Bytes.
- "previousBlock" is the previous block address. Empty for the genesis block.
- PREVBLOCK is the previous block address
- "nextBlock" is the next block address. Blank for the last block in the blockchain.
- NEXTBLOCK is the next block address
- "transactions" is an array of transaction ids, representing the transactions in the block.
- TRANSACTIONX are ID numbers of transactions in the block
Example
Request:
http://localhost:1400/api? requestType=getBlock& block=3081264592726137683
Response:
{ "generatorRS": "LMA-25TQ-G377-8TJ9-EVPAD", "previousBlockHash":"d2df42de82c3fbc808715ce9738630b31bece282864fafd164b0d4cf5b0e9e3e", "payloadLength":256, "totalAmount":"16400300000000", "generationSignature":"5beac191d5a20b443b9fdd83cfeb3abddfb31294c1999a85c75955a4c99b3f3c", "generator":"14241151062656421686", "baseTarget":"191236740", "payloadHash":"fc153c1f3d18af9e5a60be42bee896b19089a4b1e391179c98c2a9d2d383275f", "nextBlock":"5728643978405745233", "numberOfTransactions":2, "blockSignature":"5bf8d6f39c6303815dbf591667d613175e916520052f21ffaddec818e2e4ab0cca07f17b0dea8352e837aa89e774cd95dbeb5a2bdab1f1f50f5955d1a3718375", "transactions": [ "10431005438877942947", "16244324356084723003" ], "version":2, "totalFee":"200000000", "previousBlock":"14482383993582051282", "height":115147, "timestamp":12439666 }
Verified 5/1/14
Asset exchange operations
Issue asset
Creates an asset on the exchange
Request
http://localhost:1400/api? requestType=issueAsset& secretPhrase=SECRET& name=ASSETNAME& description=DESCRIPTION& quantityQNT=QTY& decimals=DECIMALS& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTX& broadcast=BROAD
Where:
- SECRET is the secret passphrase of the account issuing the asset.
- ASSETNAME is the name you'd like the asset to have
- DESCRIPTION is a description of the asset. This text should be URL-encoded, but can contain any Unicode characters, and has a maximum length of 1000. (optional)
- QTY is the amount
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- FEE is the fee (in MilliLm) associated with the transaction. Currently the minimum fee for issuing an asset is 1000 LibreMoney
- DEADLINE is the deadline for the transaction to get a confirmation, expressed in minutes
- REFTX is a previous transaction ID that you want to reference. This creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed. (optional)
- BROAD is if you want the transaction broadcasted or not (optional)
Response
The response returns a transaction ID, which is also the asset ID.
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where:
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=issueAsset& secretPhrase=123& name=turtleCoin& description=This+is+Turtlecoin+issued+by+Tommy-Turtle& quantityQNT=500& deadline=1440& fee=1000
Response:
{ "fullHash": "ebccb29dc4286a4a55ad9f0a4334cd3b0df75c26fcaf4a6ee3b62832f8f1a403", "signatureHash": "adb63682ac9598b7ea951df09535ee662b4b2f977e4f8a3f1a1aa0fd1f3e3da1", "transactionBytes": "0200701fdb00a005668683e673274c671802492d6f54cdc33d247aa426e7cef83776...", "hash": "f1fa3f7b8ca5dd38d529e9f9a052aac0f96a7e5a4ef57cdabb0e4633cb4fcd89", "transaction": "5362143131262438635", "broadcasted": true, "unsignedTransactionBytes": "0200701fdb00a005668683e673274c671802492d6f54cdc33d247aa426e7ce..." }
Verified 5/9/14
Get asset IDs
Obtain a list of all of the asset IDs on the exchange
Request
http://localhost:1400/api? requestType=getAssetIds
Response
{ "assetIds": [ARRAY_OF_ASSET_IDs] }
Example
Request:
http://localhost:1400/api? requestType=getAssetIds
Response:
{ "assetIds": [ "923860986719836", "46556984592384756298", "87918658237693184156", ... ] }
Verified 5/6/14
Get asset
Obtain information associated with an asset ID
Request
http://localhost:1400/api? requestType=getAsset& asset=ASSETID
Where:
- ASSETID is the asset ID you want to look up
Response
{ "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "name": "NAME", "description": "DESCRIPTION", "quantityQNT": QTY, "asset": ASSETID, "decimals": DECIMALS, "numberOfTrades": NUMTRADES }
Where:
- ACCOUNT is the account that issued the asset
- ACCOUNTRS is the Reed-Solomon address of the account.
- NAME is the asset name
- DESCRIPTION is the asset description. Will not be returned if the description is equal to 0.
- QTY is the asset quantity
- ASSETID is the asset ID you want to look up
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- NUMTRADES is the number of trades of this asset
Example
Request:
http://localhost:1400/api? requestType=getAsset& asset=46556984592384756298
Response:
{ "account": "334765832685676", "accountRS": "LMA-DE2F-W76R-GL25-HMFPR", "name": "cfbBTCx1", "description": "This is BTC issued by Come-from-Beyond", "quantityQNT": 500, "asset": 46556984592384756298, "decimals": 6, "numberOfTrades": 0 }
Verified 5/13/14
Get assets
Obtain information associated with some asset IDs
Request
http://localhost:1400/api? requestType=getAssets& assets=ASSETID& assets=ASSETID& ...
Where:
- ASSETID is the asset ID you want to look up
Response
{ "assets": [ { "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "name": "NAME", "description": "DESCRIPTION", "quantityQNT": QTY, "asset": ASSETID, "decimals": DECIMALS, "numberOfTrades": NUMTRADES }, { ... }] }
Where:
- ACCOUNT is the account that issued the asset
- ACCOUNTRS is the Reed-Solomon address of the account.
- NAME is the asset name
- DESCRIPTION is the asset description. Will not be returned if the description is equal to 0.
- QTY is the asset quantity
- ASSETID is the asset ID you want to look up
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- NUMTRADES is the number of trades of this asset
Example
Request:
http://localhost:1400/api? requestType=getAssets& assets=46556984592384756298
Response:
{ "assets": [ { "account": "334765832685676", "accountRS": "LMA-DE2F-W76R-GL25-HMFPR", "name": "cfbBTCx1", "description": "This is BTC issued by Come-from-Beyond", "quantityQNT": 500, "asset": 46556984592384756298, "decimals": 6, "numberOfTrades": 0 } ] }
Verified 5/13/14
Get all assets
Obtain information associated with all the assets in the exchange
Request
http://localhost:1400/api? requestType=getAllAssets
Response
{ "assets": [ { "account": "ACCOUNT", "accountRS": "ACCOUNTRS" "name": "NAME", "description": "DESCRIPTION", "quantityQNT": QTY, "asset": ASSETID, "decimals": DECIMALS, "numberOfTrades": NUMTRADES } ] }
Where:
- ACCOUNT is the account that issued the asset
- ACCOUNTRS is the Reed-Solomon address of the account
- NAME is the asset name
- DESCRIPTION is the asset description. Will not be returned if the description is equal to 0.
- QTY is the asset quantity
- ASSETID is the asset ID you want to look up
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- NUMTRADES is the number of trades of this asset
Example
Request:
http://localhost:1400/api? requestType=getAllAssets
Response:
{ "assets": [ { "decimals": 7, "numberOfTrades": 0, "asset": "3283533989023503499", "quantityQNT": "132249500000000", "description": "CCGGUQMJKOMUCLBIEGGTKCQVSBSJAZSE", "name": "GZSHFQY", "account": "14136559604731496960", "accountRS": "LMA-KRDB-ZFA3-RNDV-AALNT" }, { "decimals": 6, "numberOfTrades": 0, "asset": "5008310702202713285", "quantityQNT": "994512000000000", "description": "QESZUYEJCGBGHBVXIRC", "name": "GWNU", "account": "14136559604731496960", "accountRS": "LMA-UWKJ-GFEV-AGY4-5C4YS" }, ... ] }
Verified 5/13/14
Get assets by name (Depreciated)
Obtain information associated with an asset name. Depreciated in version 1.1.4
Request
http://localhost:1400/api? requestType=getAssetsByName& assetName=ASSET
Where:
- ASSET is the asset name you want to look up
Response
{ "assets": [ { "account": "ACCOUNT", "accountRS": "ACCOUNTRS" "name": "NAME", "description": "DESCRIPTION", "quantityQNT": QTY, "asset": ASSETID, "decimals": DECIMALS, "numberOfTrades": NUMTRADES } ] }
Where:
- ACCOUNT is the account that issued the asset
- ACCOUNTRS is the Reed-Solomon address of the account
- NAME is the asset name
- DESCRIPTION is the asset description. Will not be returned if the description is equal to 0.
- QTY is the asset quantity
- ASSETID is the asset ID you want to look up
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- NUMTRADES is the number of trades of this asset
Example
Request:
http://localhost:1400/api? requestType=getAssetsByName& assetName=GZSHFQY
Response:
{ "assets": [ { "decimals": 7, "numberOfTrades": 0, "asset": "3283533989023503499", "quantityQNT": "132249500000000", "description": "CCGGUQMJKOMUCLBIEGGTKCQVSBSJAZSE", "name": "GZSHFQY", "account": "14136559604731496960", "accountRS": "LMA-UWKJ-GFEV-AGY4-5C4YS" } ] }
Verified 5/20/14
Get assets by issuer
Get all assets that a specified account has created
Request
http://localhost:1400/api? requestType=getAssetsByIssuer& account=ACCOUNT
Where:
- ACCOUNT is the account that issued the asset
Response
{ "assets": [ { "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "name": "NAME", "description": "DESCRIPTION", "quantityQNT": QTY, "asset": ASSETID, "decimals": DECIMALS, "numberOfTrades": NUMTRADES } ] }
Where:
- ACCOUNT is the account that issued the asset
- ACCOUNTRS is the Reed-Solomon address of the account
- NAME is the asset name
- DESCRIPTION is the asset description. Will not be returned if the description is equal to 0.
- QTY is the asset quantity
- ASSETID is the asset ID you want to look up
- DECIMALS is the number of digits after the decimal point for such an asset (i.e. for USD it will be 2, for Bitcoin it will be 8)
- NUMTRADES is the number of trades of this asset
Example
Request:
http://localhost:1400/api? requestType=getAssetsByIssuer& account=1562462127635514638
Response:
{ "assets": [ { "decimals": 7, "numberOfTrades": 0, "asset": "3283533989023503499", "quantityQNT": "132249500000000", "description": "CCGGUQMJKOMUCLBIEGGTKCQVSBSJAZSE", "name": "GZSHFQY", "accountRS": "LMA-GKAG-2VGD-U473-3VRDD", "account": "1562462127635514638" } ] }
Verified 5/9/14
Get all trades
Obtain all trades starting from a specified time
Request
http://localhost:1400/api? requestType=getAllTrades& timestamp=TIME
Where:
- TIME is expressed in seconds since the genesis block. Setting this to 0 will give you all of the trades (optional)
Response
{ "trades": [ { "timestamp": TIME, "price": "PRICE", "asset": "ASSETID", "quantityQNT": "QTY", "block": "BLOCK", "askOrder": "ASK", "bidOrder": "BID" }, { ... } ] }
Where:
- TIME is the time expressed in seconds since the genesis block of the trade
- ASSETID is the ID of the asset
- QTY is the order quantity
- PRICE is the price, expressed in MilliLm
- BLOCK is the block of the trade
- ASK is the ask order ID
- BID is the bid order ID
Example
Request:
http://localhost:1400/api? requestType=getAllTrades
Response:
{ "trades": [ { "timestamp": 13530463, "price": "2500000000", "asset": "13920592454636198263", "quantityQNT": "2", "block": "1942829179466651543", "askOrder": "16791208091984728819", "bidOrder": "12730658526877674075" }, { ... } ] }
Verified 5/8/14
Get trades
Obtain trade information associated with a specified asset ID
Request
http://localhost:1400/api? requestType=getTrades& asset=ASSETID& firstIndex=RANGE_START lastIndex=RANGE_END
Where:
- ASSETID is the asset ID you want to look up
- RANGE_START is the index number of the earliest trade you want to list. If omitted, the default is 0
- RANGE_END is the index number of the most recent trade you want to list. If omitted, the default is 232-1
Response
{ "trades": [ { "timestamp": TIME, "price": "PRICE", "asset": "ASSETID", "quantityQNT": "QTY", "block": "BLOCK", "askOrder": "ASK", "bidOrder": "BID" }, { ... } ] }
Where:
- TIME is the time expressed in seconds since the genesis block of the trade
- ASSETID is the ID of the asset
- QTY is the order quantity
- PRICE is the price, expressed in MilliLm
- BLOCK is the block of the trade
- ASK is the ask order ID
- BID is the bid order ID
Example
Request:
http://localhost:1400/api? requestType=getTrades& asset=14269709746849295412& firstIndex=0
Response:
{ "trades": [ { "timestamp": 13386268, "price": "100000000", "asset": "13388701969217905199", "quantityQNT": "12", "block": "15363991879367428772", "askOrder": "9028610672087970547", "bidOrder": "7785235474459518056" }, { ... } ] }
Verified 5/9/14
Transfer asset
Used to transfer a quantity of asset from one account to another
Request
http://localhost:1400/api? requestType=transferAsset& secretPhrase=SECRET& recipient=RECIPIENT& asset=ASSETID& comment=COMMENT& quantityQNT=QTY& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTXID& broadcast=BROAD
Where:
- SECRET is the secret passphrase of the account transferring the asset
- RECIPIENT is the recipient account number
- ASSETID is the ID for the asset being transferred
- COMMENT is a comment for the transfer (optional)
- QTY is the amount of the asset being transferred
- FEE is the fee for the transaction in MilliLm
- DEADLINE is the deadline for the transaction to get a confirmation, expressed in minutes
- REFTXID is a previous transaction ID that you want to reference. This creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed. (optional)
- BROAD is if you want the transaction broadcasted or not (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=transferAsset& secretPhrase=123& recipient=81623458239475& asset=46556984592384756298& quantityQNT=45& fee=100000000& deadline=1440
Response:
{ "fullHash": "9bd14e7a93d228a85e82a98071f1bd96c158dda856311722e6feafb1a36e71e2", "signatureHash": "540a2963aac95e63c5e4d13b452be02160e5ecd9cb1c3e8306eed4b47975b9ba", "transactionBytes": "0201f120db00a005668683e673274c671802492d6f54cdc33d247a...", "hash": "8633ca65458bb9895ef53c3875ff59dd4b85ddf922dcaae3f276796932d33731", "transaction": "12117166328294330779", "broadcasted": true, "unsignedTransactionBytes": "0201f120db00a005668683e673274c671802492d6f54cdc33d2..." }
Verified 5/9/14
Place order
Places an "ask" or "bid" order for an asset onto the exchange.
Request
http://localhost:1400/api? requestType=BID_OR_ASK& secretPhrase=SECRET& asset=ASSETID& quantityQNT=QTY& price=PRICE& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTXID& broadcast=BROAD
Where:
- BID_OR_ASK is either "placeAskOrder" or "placeBidOrder"
- SECRET is the secret passphrase of the account issuing the transaction
- ASSETID is the assetID of the asset being ordered
- QTY is the amount of the asset being ordered
- PRICE is the bid/ask price, expressed in MilliLm
- FEE is the fee for the transaction in MilliLm
- DEADLINE is the deadline for the transaction to get a confirmation, expressed in minutes
- REFTXID is a previous transaction ID that you want to reference. This creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed. (optional)
- BROAD is if you want the transaction broadcasted or not (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=placeBidOrder& secretPhrase=123& asset=46556984592384756298& quantityQNT=70& price=145& fee=100000000& deadline=1440& referencedTransaction=65374835678
Response:
{ "fullHash": "a797ff58c5ed5c6f53c708dbe137812495c6af0eb280a3d001bb1917eb6a5561", "signatureHash": "751c9df738e1894ef550bf9e0725188168d4febf48a4da51b1efafaaa840dbcb", "transactionBytes": "02035d0fdb00a005668683e673274c671802492d6f54cdc33d247aa426e7cef83776...", "hash": "4785247b3238fda4fe53d47bc8a97a2b3acf974a02854792b59b092f3473eecd", "transaction": "8024550067924866983", "broadcasted": true, "unsignedTransactionBytes": "02035d0fdb00a005668683e673274c671802492d6f54cdc33d247aa426e7cef..." }
Verified 5/9/14
Get order IDs
Obtain order IDs for a specified asset's bid/ask orders
Request
http://localhost:1400/api? requestType=GET_BID_OR_ASK& asset=ASSETID
Where:
- GET_BID_OR_ASK is either "getAskOrderIds" or "getBidOrderIds"
- ASSETID is the ID of the asset whose orders you want to see
Response
Returns an array of all ask/bid orders:
{ "GET_BID_OR_ASK": [ARRAY_OF_ORDER_IDs] }
Where:
- GET_BID_OR_ASK is either "getAskOrderIds" or "getBidOrderIds"
Example
Request:
http://localhost:1400/api? requestType=getAskOrderIds& asset=14269709746849295412
Response:
{ "askOrderIds": [ "3467356724512", "824756987236452" ] }
Verified 5/8/14
Get orders
Obtain orders for a specified asset's bid/ask orders
Request
http://localhost:1400/api? requestType=GET_BID_OR_ASK& asset=ASSETID& limit=LIMIT
Where:
- GET_BID_OR_ASK is either "getBidOrders" or "getAskOrders"
- ASSETID is the ID of the asset whose orders you want to see
- LIMIT defines how many orders to get, if not provided it will show all of them
Response
Returns an array of all ask/bid orders:
{ "GET_BID_OR_ASK": [ARRAY_OF_ORDERs] }
Example
Request:
http://localhost:1400/api? requestType=getAskOrders asset=15680163033397272955
Response:
{ "askOrders": [ { "height": 90703, "price": "78932342", "asset": "15680163033397272955", "order": "4529944714996630823", "quantityQNT": "20", "accountRS": "LMA-JNYK-TP3W-VDBB-9FRVB", "account": "8425933418718057425", "type": "ask" }, { "height": 77415, "price": "99000000", "asset": "15680163033397272955", "order": "3158651792442050495", "quantityQNT": "39", "accountRS": "LMA-AMPQ-B6ZZ-S8TL-EFDBH", "account": "14386024746077933238", "type": "ask" }, { "height": 78822, "price": "150000000", "asset": "15680163033397272955", "order": "954178876942447633", "quantityQNT": "1", "accountRS": "LMA-FVXE-SLB6-KL5V-A2Q75", "account": "9337862827899547564", "type": "ask" } ] }
Verified 5/12/14
Get current account order IDs
Obtain current order IDs for bid or ask orders for a specific account, optionally filtered by an an assetID. Implemented in version 0.5.9.
Request
http://localhost:1400/api? requestType=GET_BID_OR_ASK& account=ACCOUNT& asset=ASSETID
Where:
- GET_BID_OR_ASK is either "getAccountCurrentAskOrderIds" or "getAccountCurrentBidOrderIds"
- ACCOUNT is the account number whose orders you want to display.
- ASSETID is the ID of a specific asset whose orders you want to display.
Response
Returns an array of all ask/bid order IDs:
{ "GET_BID_OR_ASK_IDs": [ARRAY_OF_ORDER_IDs] }
Where:
- GET_BID_OR_ASK_IDs is either "askOrderIds" or "bidOrderIds"
Example
Request:
http://localhost:1400/api? requestType=getAccountCurrentAskOrderIds& account=1189524830352486657& asset=2438729719254516952
Response:
{ "askOrderIds": [ "3467356725412", "824756987456452 ] }
Verified 5/18/14
Get order
Obtain a specific bid or ask order
Request
http://localhost:1400/api? requestType=GET_BID_OR_ASK& order=ORDERID
Where:
- GET_BID_OR_ASK is either "getAskOrder" or "getBidOrder"
- ORDERID is the Order ID you are looking up
Response
{ "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "height": HEIGHT, "asset": "ASSETID", "quantityQNT": QTY, "price": PRICE, "order": "ORDER", "type": "TYPE" }
Where:
- ACCOUNT is the account number associated with the order
- ACCOUNTRS is the Reed-Solomon address of the account.
- ASSETID is the ID of the asset being ordered
- QTY is the order quantity
- PRICE is the price, expressed in MilliLm
- HEIGHT is the block height
- ORDER is the ID of the order
- TYPE is the type of order (ask, bid)
Example
Request:
http://localhost:1400/api? requestType=getBidOrder& order=17936094171153028796
Response:
{ "height": 90703, "price": "78932342", "asset": "15680163033397272955", "order": "17936094171153028796", "quantityQNT": "20", "account": "8425933418718057425", "accountRS": "LMA-7HL4-WMNR-XGFL-ASVHV", "type": "ask" }
Verified 5/13/14
Get all open orders
Obtain information on all open orders
Request
http://localhost:1400/api? requestType=getAllOpenOrders
Response
{ "height": HEIGHT, "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "asset": "ASSETID", "order": "ORDER", "quantityQNT": QTY, "price": PRICE, "type": TYPE }
Where:
- ACCOUNT is the account number associated with the order
- ACCOUNTRS is the Reed-Solomon address of the account
- ASSETID is the ID of the asset
- QTY is the order quantity
- PRICE is the price, expressed in MilliLm
- TYPE is the type of order (i.e. ask, bid)
- HEIGHT is the block height
Example
Request:
http://localhost:1400/api? requestType=getAllOpenOrders
Response:
{ "openOrders": [ { "height": 90703, "price": "78932342", "asset": "15680163033397272955", "order": "17936094171153028796", "quantityQNT": "20", "account": "8425933418718057425", "accountRS": "LMA-2UKS-7VYN-Q73Y-EKE8Y", "type": "ask" }, { ... } ] }
Verified 5/13/14
Cancel order
Issue a cancel for an existing order
Request
http://localhost:1400/api? requestType=BID_OR_ASK& secretPhrase=SECRET& order=ORDERID& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTXID& broadcast=BROAD
Where:
- BID_OR_ASK is either "cancelAskOrder" or "cancelBidOrder"
- SECRET is the secret passphrase of the account issuing the transaction
- ORDERID is the order ID number of the order being canceled
- FEE is the fee for the transaction in MilliLm
- DEADLINE is the deadline for the transaction to get a confirmation, expressed in minutes
- REFTXID is a previous transaction ID that you want to reference. This creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed. (optional)
- BROAD is if you want the transaction broadcasted or not (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=cancelAskOrder& secretPhrase=123& order=3467356724512& fee=100000000& deadline=1440
Response:
{ "fullHash": "e9c821547e851998f05ef39a39dc196b27f5e3069c1bf516fffaf53359304cc4", "signatureHash": "a5bf7481f5ad02be69f5fff7cd73c3dd7e443a4335721511e9e79198bc6f0324", "transactionBytes": "02051316db00a005668683e673274c671802492d6f54cdc33d247aa...", "hash": "10ffcff771db618ca243b561943e09fd4098ade100efb2dc68f7861705f6262d", "transaction": "10959937945806686441", "broadcasted": true, "unsignedTransactionBytes": "02051316db00a005668683e673274c671802492d6f54cdc33d247aa426e7c..." }
Verified 5/9/14
Poll operations
Create Poll
Create a new poll
Request
http://localhost:1400/api? requestType=createPoll& name=NAME& description=DESCRIP& minNumberOfOptions=MINOPTIONS& maxNumberOfOptions=MAXOPTIONS& optionsAreBinary=BINARY& option1=OPTION1& option2=OPTION2& option3=OPTION3& secretPhrase=SECRET& fee=FEE& deadline=DEADLINE& referencedTransactionFullHash=REFTXHASH& broadcast=BROAD
Where:
- DESCRIP is the description of the poll
- NAME is the name of the poll
- MINOPTIONS is the minimal number of options for the poll
- MAXOPTIONS is the maximum number of options for the poll
- OPTION1 is the name of the first option (OPTIONS 2 & 3 are optional)
- SECRET the secret passphrase (private key) for the account
- DEADLINE is the deadline for transaction, expressed in minutes
- FEE is the fee for the transaction (in MilliLm)
- BINARY is if the options are binary (optional)
- REFTXHASH is the ID of a transaction referenced by this one (optional)
- BROAD true or false if it should be broadcasted (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where:
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=createPoll& name=Testing123& description=Testing& minNumberOfOptions=1& maxNumberOfOptions=1& option1=yes& option2=no& secretPhrase=MySuperSecretPasswordThatIsNotActuallyPostedHereOrIsEvenRealSoDoNotEvenTryIt& fee=100000000& deadline=1440
Response:
{ "fullHash": "7ef9e19d0c7943002fd98a7ae08f1b4a1d473c67796f89225b167fd4913ce73f", "signatureHash": "a76722be0652d5c88cb7292d1cb04ea299eaea74c35ad726e868d08799946c38", "transactionBytes": "010234fbda00a005668683e673274c671802492d6f54cdc33d247aa426e...", "hash": "940383ff1bf177d4e4fee05c78865b12ace2570152c64570219dfc0aa10c246b", "transaction": "18991918535014782", "broadcasted": true, "unsignedTransactionBytes": "010234fbda00a005668683e673274c671802492d6f54cdc33d247..." }
Verified 5/9/14
Get Poll
Gets information about requested poll
Request
http://localhost:1400/api? requestType=getPoll& poll=POLL
Where:
- POLL is the id of the poll that is requested
Response
{ "description": "DESCRIP", "name": "NAME", "maxNumberOfOptions": MAXOPTIONS, "optionsAreBinary": BINARY, "voters": [VOTERS], "minNumberOfOptions": MINOPTIONS, "options": [OPTIONS] }
Where:
- DESCRIP is the description of the poll
- NAME is the name of the poll
- MAXOPTIONS is the maximum number of options for the poll
- BINARY is if the options are binary
- VOTERS is the number of voters of the poll
- MINOPTIONS is the minimal number of options for the poll
- OPTIONS is the list of options
Example
Request:
http://localhost:1400/api? requestType=getPoll& poll=15826354927269615782
Response:
{ "description": "Does this work?", "name": "Test", "maxNumberOfOptions": 1, "optionsAreBinary": false, "voters": [], "minNumberOfOptions": 1, "options": [ "Yes", "No", "I don't know" ] }
Verified 5/8/14
Get Poll IDs
Returns the IDs of all the polls
Request
http://localhost:1400/api? requestType=getPollIds
Response
{ "pollIds": [ "POLLID", ... ] }
Where:
- POLLID is the ID of each poll
Example
Request:
http://localhost:1400/api? requestType=getPollIds
Response:
{ "pollIds": [ "15826354927269615782", "8883605113950920958" ] }
Verified 5/8/14
Cast Vote
Cast your vote on a poll
Request
http://localhost:1400/api? requestType=castVote& poll=NAME& vote1=VOTE1& vote2=VOTE2& vote3=VOTE3& secretPhrase=SECRET& fee=FEE& deadline=DEADLINE& referencedTransactionFullHash=REFTXHASH& broadcast=BROAD
Where:
- NAME is the name of the poll you are voting on
- VOTE1 is your vote (VOTE 2 & 3 are optional if the poll allows multiple options)
- SECRET the secret passphrase (private key) for the account
- DEADLINE is the deadline for transaction, expressed in minutes
- FEE is the fee for the transaction (in MilliLm)
- REFTXHASH is the ID of a transaction referenced by this one (optional)
- BROAD true or false if it should be broadcasted (optional)
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "hash": "HASH", "transaction": "TX", "broadcasted": BROAD, "unsignedTransactionBytes": "UNTXBYTES" }
Where:
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- HASH is hash of all transaction fields excluding the signature
- TX is the ID of the transaction
- BROAD is if the transaction was broadcasted or not
- UNTXBYTES is the transaction bytes with the signature part being replaced with zeros
Example
Request:
http://localhost:1400/api? requestType=castVote& poll=18991918535014782& vote1=yes& secretPhrase=MySuperSecretPasswordThatIsNotActuallyPostedHereOrIsEvenRealSoDoNotEvenTryIt& fee=100000000& deadline=1440
Response:
{ "fullHash": "637ea3215258adef61f7fc5a90eff6435d1a7ad8c3790d5855c6943b9aff1daf", "signatureHash": "a6745e26165e9c7870c85bd174348e4e72c825378cfb71760e04f08e30879fa6", "transactionBytes": "010314feda00a005668683e673274c671802492d6f54cdc33...", "hash": "10ee68836162f6a8e2559a6dbcbc41c4db4b7441e6ff321f01b268d761c6916d", "transaction": "17270557255810645603", "broadcasted": true, "unsignedTransactionBytes": "010314feda00a005668683e673274c671802492d6f54cdc33d247aa426e7..." }
Verified 5/9/14
Server software operations
Get Constants
Returns all of the constant values used by a server.
Request
http://localhost:1400/api? requestType=getConstants
Response
{ "maxBlockPayloadLength":40800, "genesisAccountId":"GENESISACC", "genesisBlockId":"GENESISBLK", "transactionTypes": [ { "description":"Payment","value":0,"subtypes": [ {"description":"Ordinary payment","value":0} ] }, { "description":"Messaging","value":1,"subtypes": [ {"description":"Arbitrary message","value":0}, {"description":"Alias assignment","value":1}, {"description":"Poll creation","value":2}, {"description":"Vote casting","value":3}, {"description":"Hub terminal announcement","value":4}, {"description":"Account info","value":5} ] }, { "description":"Colored coins","value":2,"subtypes": [ {"description":"Asset issuance","value":0}, {"description":"Asset transfer","value":1}, {"description":"Ask order placement","value":2}, {"description":"Bid order placement","value":3}, {"description":"Ask order cancellation","value":4}, {"description":"Bid order cancellation","value":5} ] }, { "description":"Digital goods","value":3,"subtypes": [ {"description":"Listing","value":0}, {"description":"Delisting","value":1}, {"description":"Price change","value":2}, {"description":"Quantity change","value":3}, {"description":"Purchase","value":4}, {"description":"Delivery","value":5}, {"description":"Feedback","value":6}, {"description":"Refund","value":7} ] }, { "description":"Account Control","value":4,"subtypes": [ {"description":"Effective balance leasing","value":0} ] } ], "peerStates": [ {"description":"Non-connected","value":0}, {"description":"Connected","value":1}, {"description":"Disconnected","value":2} ] }
Where:
- GENESISACC is the genesis account
- GENESISBLK is the genesis block
Example
Request:
http://localhost:1400/api? requestType=getConstants
Response:
{ "maxBlockPayloadLength":40800, "genesisAccountId":"1739068987193023818", "genesisBlockId":"2680262203532249785", "transactionTypes": [ { "description":"Payment","value":0,"subtypes": [ {"description":"Ordinary payment","value":0} ] }, { "description":"Messaging","value":1,"subtypes": [ {"description":"Arbitrary message","value":0}, {"description":"Alias assignment","value":1}, {"description":"Poll creation","value":2}, {"description":"Vote casting","value":3}, {"description":"Hub terminal announcement","value":4}, {"description":"Account info","value":5} ] }, { "description":"Colored coins","value":2,"subtypes": [ {"description":"Asset issuance","value":0}, {"description":"Asset transfer","value":1}, {"description":"Ask order placement","value":2}, {"description":"Bid order placement","value":3}, {"description":"Ask order cancellation","value":4}, {"description":"Bid order cancellation","value":5} ] }, { "description":"Digital goods","value":3,"subtypes": [ {"description":"Listing","value":0}, {"description":"Delisting","value":1}, {"description":"Price change","value":2}, {"description":"Quantity change","value":3}, {"description":"Purchase","value":4}, {"description":"Delivery","value":5}, {"description":"Feedback","value":6}, {"description":"Refund","value":7} ] }, { "description":"Account Control","value":4,"subtypes": [ {"description":"Effective balance leasing","value":0} ] } ], "peerStates": [ {"description":"Non-connected","value":0}, {"description":"Connected","value":1}, {"description":"Disconnected","value":2} ], "maxArbitraryMessageLength":1000 }
Verified 5/1/14
Get My Info
Returns server host and address information.
Request
http://localhost:1400/api? requestType=getMyInfo
Response
{ "host": "HOSTNAME", "address": "ADDRESS" }
Where:
- HOSTNAME is the server hostname
- ADDRESS is the server address
Example
Request:
http://localhost:1400/api? requestType=getMyInfo
Response:
{ "host": "127.0.0.1", "address": "127.0.0.1" }
Verified 5/1/14
Get Peer
Retrieves information on a specific peer.
Request
http://localhost:1400/api? requestType=getPeer& peer=PEERNAME
Where:
- PEERNAME is the name of the peer whose information you want to retrieve.
Response:
{ "platform": "PLATFORM", "blacklisted": BLACKLIST, "shareAddress": SHAREADD "application": "LIBREMONEY", "weight": WEIGHT, "hallmark": "HALLMARK", "state": STATE, "announcedAddress": "ANNOUNCED", "downloadedVolume": DLBYTES, "version": "VERSION", "uploadedVolume": ULBYTES }
Where:
- PLATFORM is a string representing the server's platform
- WEIGHT is the node's weight value
- BLACKLIST is if the peer is blacklisted or not
- SHAREADD is if the address is shared
- HALLMARK is the hex string of the node's hallmark, if it is defined
- STATE defines the state of the peer. 1 is active; 0 is known
- ANNOUNCED is the name that the node is announcing to the network (could be a DNS name, IP address, or any other string)
- VERSION is the version of the software running on the node
- DLBYTES and ULBYTES are the number of bytes downloaded and uploaded by the node
Example
Request:
http://localhost:1400/api? requestType=getPeer& peer=23.88.104.217
Response:
{ "hallmark": "ea53f569819ad8c40d62dd7e4c1f4895b2a3...", "downloadedVolume": 115001, "blacklisted": false, "announcedAddress": "node.libremoney.com", "application": "LIBREMONEY", "weight": 911527, "uploadedVolume": 4707, "state": 1, "version": "0.9.9", "platform": "lm.now.im", "shareAddress": true }
Verified 5/1/14
Get Peers
Retrieves a list of all peers known to the server. Returns ALL peers, regardless of state.
Request
http://localhost:1400/api? requestType=getPeers
Response:
An array of peer names/addresses:
{ "peers": [ "PEER", "PEER", "PEER"... ] }
Example
Request:
http://localhost:1400/api? requestType=getPeers
Response:
{ "peers": [ "188.226.176.151", "88.202.37.38", "87.211.164.253"... ] }
Verified 5/1/14
Get State
Returns information on the status of the server being queried.
Request
http://localhost:1400/api? requestType=getState
Response
{ "numberOfPolls": NUMPOLLS, "numberOfVotes": NUMVOTES, "numberOfTrades": NUMTRADES, "lastBlock": "LASTBLOCKID", "numberOfAliases": NUMALIASES, "lastBlockchainFeeder": "FEEDERPEER", "numberOfBlocks": HEIGHT, "numberOfPeers": NUMPEERS "totalMemory": CURMEMORY, "freeMemory": FREEMEMORY, "maxMemory": MAXMEMORY, "numberOfTransactions": NUMTRANS, "numberOfUnlockedAccounts": NUMUSERS, "version": "VERSION", "numberOfOrders": NUMORDERS, "totalEffectiveBalance": EFFECTIVEBALANCE "time": TIME, "availableProcessors": NUMPROCESSORS, "numberOfAssets": NUMASSETS, "cumulativeDifficulty": "CUMEDIFF" "numberOfAccounts": NUMACCOUNTS }
Where:
- LASTBLOCKID is the last block address
- NUMALIASES is the number of aliases on the network
- FEEDERPEER is the published hostname of the feeder of the last block
- HEIGHT is the block height
- NUMPEERS is the number of peers on the network
- CURMEMORY is the amount of memory the node is using (in Bytes)
- FREEMEMORY is the amount of free memory on the node (in Bytes)
- MAXMEMORY is the maximum amount of memory the node may use (in Bytes)
- NUMTRANS is the number of transactions in the blockchain
- NUMUSERS is the number of unlocked accounts on this node
- NUMPOLLS is the number of polls on this node
- NUMTRADES is the number of trades on this node
- NUMVOTES is the number of votes on this node
- NUMORDERS is the number of orders on the node
- EFFECTIVEBALANCE is the effective balance active on the network, expressed in MilliLm
- NUMPROCESSORS is the number of processors on the node
- NUMASSETS is the number of assets on the node
- CUMEDIFF is the current cumulative forging difficulty
- NUMACCOUNTS is the number of accounts in the blockchain
Example
Request:
http://localhost:1400/api? requestType=getState
Response:
{ "numberOfPeers":868, "numberOfPolls":0, "numberOfVotes":0, "availableProcessors":4, "totalEffectiveBalance":991634266, "numberOfAccounts":33172, "numberOfUnlockedAccounts":0, "numberOfBlocks":126493, "numberOfOrders":0, "numberOfTransactions":182379, "version":"1.0.0", "maxMemory":477626368, "lastBlock":"4329081735143326181", "totalMemory":466092032, "numberOfAliases":85657, "cumulativeDifficulty":"3936422822105943", "numberOfTrades":0, "time":13671770, "numberOfAssets":0, "lastBlockchainFeeder":"cubie-solar.mjke.de", "freeMemory":135007384 }
Verified 5/1/14
Get Time
Retrieves the current time. In LibreMoney, time is measured in seconds since the genesis block.
Request
http://localhost:1400/api? requestType=getTime
Response
{ "time": TIME }
Where:
- TIME is number of seconds since the genesis block timestamp.
Example
Request:
http://localhost:1400/api? requestType=getTime
Response:
{ "time": 417 }
Verified 5/1/14
Get Blockchain Status
Retrieves the current status of the blockchain
Request
http://localhost:1400/api? requestType=getBlockchainStatus
Response
{ "lastBlock": "LASTBLK", "lastBlockchainFeederHeight": LASTHEIGHT, "time": TIME, "lastBlockchainFeeder": "FEEDERPEER", "numberOfBlocks": NUMBLKS, "isScanning": SCAN, "cumulativeDifficulty": "CUMDIF", "version": "VER" }
Where:
- LASTBLK is the latest block in the blockchain
- LASTHEIGHT is the latest block's height
- TIME is number of seconds since the genesis block timestamp.
- FEEDERPEER is the published hostname of the feeder of the last block
- NUMBLKS is the total number of blocks
- SCAN is if the blockchain is currently being scanned
- CUMDIF is the current forging difficulty
- VER is the version of the software that is running
Example
Request:
http://localhost:1400/api? requestType=getBlockchainStatus
Response:
{ "lastBlock": "3153685344875873318", "lastBlockchainFeederHeight": 95337, "time": 14604616, "lastBlockchainFeeder": "192.241.223.132", "numberOfBlocks": 95339, "isScanning": false, "cumulativeDifficulty": "2406110597084752", "version": "1.1.0" }
Verified 5/12/14
Hallmark operations
Decode Hallmark
Decodes a node hallmark.
Request
http://localhost:1400/api? requestType=decodeHallmark& hallmark=HEXSTRING
Where:
- HEXSTRING is the hallmark value
Response
{ "valid": VALID, "weight": WEIGHT, "host": "HOSTIP", "account": "ACCOUNT", "accountRS": "ACCOUNTRS", "date": "DATE" }
Where:
- VALID is either true or false
- WEIGHT is the weight assigned to the hallmark
- HOSTIP is the IP address or domain name associated with the hallmark
- ACCOUNT is the account number associated with the hallmark
- ACCOUNTRS is the Reed-Solomon address of the account
- DATE is the date the hallmark was created, in yyyy-mm-dd
Example
Request:
http://127.0.0.1:1400/api? requestType=decodeHallmark& hallmark=d67f03a47cd91fc...8b9e30f371a9fcc8f
Response:
{ "valid": true, "weight": 1000, "host": "162.23.47.189", "account": "123124126674545462232", "accountRS": "LMA-5EGB-HKFP-NQUT-DKYFH", "date": "2013-12-09" }
Verified 5/13/14
Generate Hallmark
Generates a node hallmark.
Request
http://localhost:1400/api? requestType=markHost& secretPhrase=MY_SECRET& host=MY_HOST& weight=WEIGHT& date=CURRENT_DATE
Where:
- MY_SECRET is the secret passphrase for the account that will be hallmarked on the node. Should be URL-encoded.
- MY_HOST is the host name for the node you want to hallmark
- WEIGHT is the weight you'd like to assign to the node. If more than one node is hallmarked by the same account, this nodes weight will be determined as (this_weight/sum_of_all_weights)
- CURRENT_DATE is today's date, in yyyy-mm-dd format
Response
{ "hallmark": "HEXSTRING" }
Where:
- HEXSTRING is the encoded hallmark string (1856 Bytes)
Example
Request:
http://localhost:1400/api? requestType=markHost& secretPhrase=MySuperSecretPasswordThatIsNotEasy& host=node23.nodesrus.com& weight=100& date=2014-01-01
Response:
{ "hallmark": "d67f03a47cd91fc1...fd49f66b462daa1f14ae8" }
Verified 5/5/14
Token operations
Decode Token
Decodes an authorization token. This is used to authorize an account on a specific web site without requiring the transmission of a secret passphrase.
Request
http://localhost:1400/api? requestType=decodeToken& website=WEBSITE& token=AUTHSTRING
Where:
- WEBSITE is the URL for the web site where authorization was granted. By convention this does not include the "http://" portion of the URL.
- AUTHSTRING is the encoded authorization string
Response
{ "account": "ACCOUNT", "timestamp": TIME, "valid": BOOLEAN }
Where:
- ACCOUNT is the LibreMoney account number associated with the token
- TIME is the time in seconds since the Genesis block timestamp, representing the creation time of the token
- BOOLEAN will be "true" or "false", indicating whether or not the token is valid
Example
Request:
http://localhost:1400/api? requestType=decodeToken& website=www.domain.com& token=StringOf160Chars
Response:
{ "account": "398532577100249608", "timestamp": 622, "valid": true }
Verified 5/9/14
Generate Token
Creates an authorization token. Tokens can be used to authorize an account on a specific web site without requiring the transmission of a secret passphrase.
Request
http://localhost:1400/api? requestType=generateToken& secretPhrase=SECRET& website=WEBSITE
Where:
- SECRET is the passphrase (private key) for the account that will generate the token.
- WEBSITE is the URL for the web site for which authorization should be granted. By convention this does not include the "http://" portion of the URL.
Response
{ "token": StringOf160Chars }
Example
Request:
http://localhost:1400/api? requestType=generateToken& secretPhrase=ItWasABrightColdDayInAprilAndTheClocksWereStrikingThirteen& website=www.genesisblock.com
Response:
{ "token": "7dstcbs4fnbq614faea405ga3dj...etb0n9f0k6uvlku4d751kftqlb128t4" }
Verified 5/9/14
Transaction operations
Broadcast Transaction
Broadcasts a transaction to the network
Request
http://localhost:1400/api? requestType=broadcastTransaction& transactionBytes=TX_BYTECODE
Where:
- TX_BYTECODE is the bytecode of a transaction
Response
{ "transaction": "TRANSACTION_ID" }
Example
Request:
http://localhost:1400/api? requestType=broadcastTransaction& transactionBytes= 000022e22800e8036653833f4272604d...
Response:
{ "transaction": "17484500871708980634" }
- Note: You will get '"error": "Double spending transaction"' if the transaction has already been broadcasted
Verified 5/6/14
Calculate Full Hash
Calculates the full hash of a transaction
Request
http://localhost:1400/api? requestType=calculateFullHash& unsignedTransactionBytes=UNTXBYTES& signatureHash=SIGHASH
Where:
- UNTXBYTES is the unsigned bytes contained in a transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
Response
{ "fullHash": "FULLHASH" }
Example
Request:
http://localhost:1400/api? requestType=calculateFullHash& unsignedTransactionBytes=01016e23d700a005668683e673274c67...& signatureHash=07afbcfb72b4fa91d8e22f8f47950404270edc1d250d2c6edad7a58679fbe1cf
Response:
{ "fullHash": "cc98e57a065610d17c6ba6a6406e4930b9a740bf1737847ab2e96e3733233984" }
Verified 5/6/14
Get Account Transaction IDs
Retrieves a list of transaction IDs associated with a LibreMoney account
Request
http://localhost:1400/api? requestType=getAccountTransactionIds& account=ACCOUNT& timestamp=TIME
Where:
- ACCOUNT is the account number for which transaction IDs are being requested
- TIME is the time (in seconds) since the generation of the genesis block
Response
{ "transactionIds": [ARRAY_OF_IDs] }
Where:
- ARRAY_OF_IDs is an array of transaction IDs associated with the account
Example
Request:
http://localhost:1400/api? requestType=getAccountTransactionIds& account=6331110009135084386& timestamp=0
Response:
{ "transactionIds": [ "17484500871708980634" ] }
Get Unconfirmed Account Transaction IDs
Retrieves a list of unconfirmed transaction IDs associated with a LibreMoney account
Request
http://localhost:1400/api? requestType=getUnconfirmedTransactionIds& account=ACCOUNT
Where:
- ACCOUNT is the account number for which unconfirmed transaction IDs are being requested
Response
{ "unconfirmedTransactionIds": [ARRAY_OF_IDs] }
Where:
- ARRAY_OF_IDs is an array of unconfirmed transaction IDs associated with the account
Example
Request:
http://localhost:1400/api? requestType=getUnconfirmedTransactionIds& account=6331110009135084386
Response:
{ "unconfirmedTransactionIds": [ "17484500871708980634" ] }
Verified 5/5/14
Get Transaction
Retrieves transaction data. Can provide either the transaction ID, hash, or full hash of the transaction.
Request
http://localhost:1400/api? requestType=getTransaction& transaction=TRANSID& hash=HASH& fullHash=FULLHASH
Where:
- TRANSID is the LibreMoney transaction ID
- HASH is the hash of the transaction
- FULLHASH is the full hash of the transaction
Response
{ "sender": "SENDERACCOUNT", "senderRS": "SENDERACCOUNTRS", "fee": "FEE", "amount": "AMOUNT", "timestamp": TIME, "referencedTransaction": REFTX, "confirmations": CONFIRMS, "subtype": SUBTYPE, "block": "BLOCKID", "senderPublicKey": "PUBKEY", "type": TYPE, "deadline": DEADLINE, "signature": "SIGNATURE", "recipient": "RECIPACCOUNT", "recipientRS": "RECIPACCOUNTRS", "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "hash": "HASH", "transaction": "TRANSID", "attachment": { ATTACHMENT } }
Where:
- SENDERACCOUNT is the account number of the sender
- SENDERACCOUNTRS is the Reed-Solomon address of the sender
- FEE is the fee (in MilliLm) for the transaction
- AMOUNT is the amount of MilliLm in the transaction
- TIME is the time of the transaction, measured in the number of seconds since the genesis block timestamp
- REFTX is the ID of a transaction referenced by this one. Will be "0" if no previous transaction is referenced.
- CONFIRMS is the number of confirmations for the transaction
- TYPE is the transaction type:
- 0 is an ordinary transaction
- 1 is an alias or arbitrary message assignment transaction
- 2 is an asset exchange transaction
- SUBTYPE is the transaction subtype:
- For alias/arbitrary messages:
- 0 is an arbitrary message transaction
- 1 is an alias transaction
- For asset exchange transactions:
- 0 is an asset issuance
- 1 is an asset transfer
- 2 is an ask order placement
- 3 is a bid order placement
- 4 is an ask order cancellation
- 5 is a bid order cancellation
- For alias/arbitrary messages:
- BLOCKID is the ID of the block containing the transaction
- ATTACHMENT is a sub-object representing any additional data needed for the transaction. Will only be present if applicable.
- PUBKEY is the public key of the sending account for the transaction
- DEADLINE is the deadline for transaction, expressed in minutes
- SIGNATURE is the digital signature of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- RECIPACCOUNT is the account number of the recipient
- RECIPACCOUNTRS is the Reed-Solomon address of the recipient
Note: Data from an unconfirmed transaction does not contain "block" or "confirmations" parameters. Double-spending transactions are not retrieved.
Example
Request:
http://localhost:1400/api? requestType=getTransaction& transaction=16244659048134841060
Response:
{ "sender": "14336428216306750617", "senderRS": "LMA-6DWM-GFYD-A7PS-72P3P", "fee": "100000000", "amount": "0", "timestamp": 7376798, "referencedTransaction": "0", "confirmations": 6, "subtype": 1, "block": "16385359704305994802", "blockTimestamp": 7376860, "attachment": { "alias":"LmApi", "uri":"http:\/\/libremoney.org/" }, "senderPublicKey": "64f103fbf0cc41045b1544cda6624eecfb8212b021fba22029a461c4b40c5d79", "type": 1, "deadline": 1, "signature": "0cdf64cb06ea21396180a6f201b6a...", "recipient": "1739068987193023818", "recipientRS": "LMA-BK2J-ZMY4-93UY-8EM9V", "fullHash": "a3c47c4a2e60c2907efc9c4b9310066cabdf3e2137e67814aa57cb960ad2dfe1", "signatureHash": "95cc276d1608dc0c14942a5efc82ccc701a56e873746ef1bfd37995c37ef5991", "hash": "15a86f71e1ac267dce35791cefafb71460f458920784ea0d10894844f05894b0", "transaction": "10431005438877942947" }
Verified 5/13/14
Parse Transaction
Retrieves transaction data.
Request
http://localhost:1400/api? requestType=parseTransaction& transactionBytes=TRANSBYTES
Where:
- TRANSBYTES bytes of the LibreMoney transaction
Response
{ "sender": "SENDERACCOUNT", "senderRS": "SENDERACCOUNTRS", "fee": "FEE", "amount": "AMOUNT", "timestamp": TIME, "referencedTransaction": REFTX, "confirmations": CONFIRMS, "subtype": SUBTYPE, "block": "BLOCKID", "senderPublicKey": "PUBKEY", "type": TYPE, "deadline": DEADLINE, "signature": "SIGNATURE", "recipient": "RECIPACCOUNT", "recipientRS": "RECIPACCOUNTRS", "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "hash": "HASH", "transaction": "TRANSID", "attachment": { ATTACHMENT } }
Where:
- SENDERACCOUNT is the account number of the sender
- SENDERACCOUNTRS is the Reed-Solomon address of the sender
- FEE is the fee (in MilliLm) for the transaction
- AMOUNT is the amount of MilliLm in the transaction
- TIME is the time of the transaction, measured in the number of seconds since the genesis block timestamp
- REFTX is the ID of a transaction referenced by this one. Will be "0" if no previous transaction is referenced.
- CONFIRMS is the number of confirmations for the transaction
- TYPE is the transaction type:
- 0 is an ordinary transaction
- 1 is an alias or arbitrary message assignment transaction
- 2 is an asset exchange transaction
- SUBTYPE is the transaction subtype:
- For alias/arbitrary messages:
- 0 is an arbitrary message transaction
- 1 is an alias transaction
- For asset exchange transactions:
- 0 is an asset issuance
- 1 is an asset transfer
- 2 is an ask order placement
- 3 is a bid order placement
- 4 is an ask order cancellation
- 5 is a bid order cancellation
- For alias/arbitrary messages:
- BLOCKID is the ID of the block containing the transaction
- ATTACHMENT is a sub-object representing any additional data needed for the transaction. Will only be present if applicable.
- PUBKEY is the public key of the sending account for the transaction
- DEADLINE is the deadline for transaction, expressed in minutes
- SIGNATURE is the digital signature of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- RECIPACCOUNT is the account number of the recipient
- RECIPACCOUNTRS is the Reed-Solomon address of the recipient
Note: Data from an unconfirmed transaction does not contain "block" or "confirmations" parameters. Double-spending transactions are not retrieved.
Example
Request:
http://localhost:1400/api? requestType=parseTransaction& transactionBytes=000022e22800e8036653833f4272604d5d3ef39...
Response:
{ "sender": "14336428216306750617", "senderRS": "LMA-6DWM-GFYD-A7PS-72P3P", "fee": "100000000", "amount": "0", "timestamp": 7376798, "referencedTransaction": "0", "confirmations": 6, "subtype": 1, "block": "16385359704305994802", "blockTimestamp": 7376860, "senderPublicKey": "64f103fbf0cc41045b1544cda6624eecfb8212b021fba22029a461c4b40c5d79", "type": 1, "deadline": 1, "signature": "0cdf64cb06ea21396180a6f201b6a...", "recipient": "1739068987193023818", "recipientRS": "LMA-BK2J-ZMY4-93UY-8EM9V", "fullHash": "a3c47c4a2e60c2907efc9c4b9310066cabdf3e2137e67814aa57cb960ad2dfe1", "signatureHash": "95cc276d1608dc0c14942a5efc82ccc701a56e873746ef1bfd37995c37ef5991", "hash": "15a86f71e1ac267dce35791cefafb71460f458920784ea0d10894844f05894b0", "transaction": "10431005438877942947" }
Verified 5/13/14
Get Transaction Bytes
Retrieves bytecode of a transaction.
Request
http://localhost:1400/api? requestType=getTransactionBytes& transaction=TXID
Where:
- TXID is a transaction ID
Response
{ "confirmations": CONFS, "transactionBytes": "BYTECODE", "unsignedTransactionBytes": "UNBYTECODE" }
Where:
- CONFS is the number of confirmations for the transaction
- BYTECODE is the bytes contained in a transaction
- BYTECODE is the unsigned bytes contained in a transaction
Example
Request:
http://localhost:1400/api? requestType=getTransactionBytes& transaction=17484500871708980634
Response:
{ "confirmations": 4462, "transactionBytes": "000022e22800e8036653833f4272604d5...", "unsignedTransactionBytes": "000022e22800e8036653833f42..." }
Verified 5/5/14
Send Lm
Sends LibreMoney to an account.
Request
http://localhost:1400/api? requestType=sendMoney& secretPhrase=SECRET& recipient=RECIPACCOUNT& amount=AMOUNT& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTRANSACTION& publicKey=PUBKEY
Where:
- SECRET is the secret passphrase for the sending account
- RECIPACCOUNT is the account number of the recipient
- AMOUNT is the amount of MilliLm in the transaction
- FEE is the fee (in MilliLm) for the transaction
- DEADLINE is the deadline for the transaction, in minutes
- REFTRANSACTION is an optional reference to a previous LibreMoney transaction ID
- PUBKEY is the 64-byte public key associated with the account and is optional with the SECRET field
Response
{ "transaction": "TRANSACTIONID" }
Where:
- TRANSACTIONID is the ID of the newly-completed transaction
Note: "deadline" is specified in minutes. "referencedTransaction" can be omitted.
Example
Request:
http://localhost:1400/api? requestType=sendMoney& secretPhrase=IWontTellYou& recipient=398532577100249608& amount=1500& fee=5& deadline=900& referencedTransaction=13689168149259791567
Response:
{ "transaction": "16244659048134841060" }
Verified 5/5/14
Sign Transation
Calculates the full hash, signature hash, and transaction from the unsigned transaction
Request
http://localhost:1400/api? requestType=signTransaction& unsignedTransactionBytes=UNTXBYTES& secretPhrase=SECRET
Where:
- UNTXBYTES is the unsigned bytes contained in a transaction
- SECRET is the secret passphrase for the sending account
Response
{ "fullHash": "FULLHASH", "signatureHash": "SIGHASH", "transactionBytes": "TXBYTES", "transaction": "TX", "verify": "VERIFY" }
Where:
- FULLHASH is the full hash of the transaction
- SIGHASH is a sha256 hash of the transaction signature. Useful for escrow transactions
- TXBYTES is the bytecode of a transaction
- TX is the ID of the transaction
- VERIFY is if it is verified (true/false)
Example
Request:
http://localhost:1400/api? requestType=signTransaction& unsignedTransactionBytes=01016e23d700a005668683e673274c67...& secretPhrase=0123456789
Response:
{ "fullHash": "d56ade2c322083d76ebcdb9f9ef18d7d52c6d105f67be040cc423c7a41a47aea", "signatureHash": "458514e72f4272c789f99201c27cff611460de10fe484b474166c1199c23e754", "transactionBytes": "0100471ddb00a005668683e673274c67180240...", "transaction": "15529291339976829653", "verify": true }
Verified 5/9/14
Error Codes
- 1 - Incorrect request
- 2 - Blockchain not up to date
- 3 - Parameter not specified
- 4 - Incorrect parameter
- 5 - Unknown object (block, transaction, etc.)
- In the case of accounts, this error means that no transaction has ever been sent to or from the account. This likely means the account is "unclaimed"/unused.
- 6 - Not enough funds
- 7 - Not allowed