Account operations API
- 3.1 Get Account
- 3.2 Get Account ID
- 3.3 Get Account Block IDs
- 3.4 Get Account Public Key
- 3.5 Get Account Transaction IDs
- 3.6 Get Balance
- 3.7 Get Guaranteed Balance
- 3.8 Lease Balance
- 3.9 Start / Stop / Get Forging
- 3.10 Set Account Information
Get Account
Retrieves the account information associated with a supplied account number.
Request
http://localhost:1400/api? requestType=getAccount& account=ACCOUNTNUM
Where:
- ACCOUNTNUM is the account ID you want to check.
Response
{ "publicKey": "PUBKEY", "assetBalances": [ { [ARRAY_OF_ASSETs] } ], "balance": "BALANCE", "accountRS": "ACCOUNTRS", "unconfirmedAssetBalances": [ { [ARRAY_OF_UNCONFIRMED_ASSETs] } ], "account": "ACCOUNT", "effectiveBalance": EFFBALANCE, "unconfirmedBalance": "UNCONFBALANCE", "forgedBalance": "FORGEDBAL" }
Where:
- PUBKEY is the 64-byte public key associated with the account.
- ACCOUNTRS is the Reed-Solomon address of the account.
- BALANCE: amount of MilliLm you have regardless of the number of confirmations the transactions associated with that MilliLm have.
- ACCOUNT is the account that issued the asset
- EFFBALANCE: amount of MilliLm you have that is represented by at least 1440 confirmations. This is the balance that is used for forging.
- UNCONFBALANCE: balance (in MilliLm) minus all unconfirmed sent transactions. It doesn't include double-spending and unconfirmed received transactions. A user sees the unconfirmed balance in the client.
- FORGEDBAL is the balance of MilliLm that the account has forged in MilliLm
Example
Request:
http://localhost:1400/api? requestType=getAccount& account=7898870630272254992
Response:
{ "publicKey": "ce0fc0f2fed0645f7018e251493a8af1e1ecfb444a4603902e71bfd2a4b41558", "assetBalances": [ { "asset": "1013693125509851736", "balanceQNT": "48" } ], "balance": "1000700000000", "accountRS": "LMA-BK2J-ZMY4-93UY-8EM9V", "unconfirmedAssetBalances": [ { "unconfirmedBalanceQNT": "48", "asset": "1013693125509851736" } ], "account": "7898870630272254992", "effectiveBalance": 9932, "unconfirmedBalance": "1000700000000", "forgedBalance": "0" }
Verified 5/12/14
Get Account ID
Retrieves the account number associated with a supplied passphrase.
Request
http://localhost:1400/api? requestType=getAccountId& secretPhrase=PASSPHRASE
Where:
- PASSPHRASE is the passphrase whose account ID you want to check
Response
{ "accountId": "ACCOUNTNUM" "accountRS": "ACCOUNTRS" }
Where:
- ACCOUNTNUM is the associated account ID.
- ACCOUNTRS is the Reed-Solomon address of the account.
Example
Request:
http://localhost:1400/api? requestType=getAccountId& secretPhrase=mySuperSecretPassphraseThatYouCanNeverGuess
Response:
{ "accountId": "4357314498768237104" "accountRS": "LMA-UWKJ-GFEV-AGY4-5C4YS" }
Note: You will get errorCode:1 if you don't make this request through a POST
Verified 5/13/14
Get Account Block IDs
Retrieves the blockIDs for all blocks generated by a supplied account. Results are sorted chronologically.
Request
http://localhost:1400/api? requestType=getAccountBlockIds& account=ACCOUNT timestamp=TIME
Where:
- ACCOUNT is the account number you want to check
- TIME, expressed in seconds since the genesis block, determines the earliest block generation time you'd like to check. Setting this to 0 will give you all of the IDs of generated blocks for the supplied account.
Response
{ "blockIds": [ARRAY_OF_BLOCK_IDs] }
Note: Results are sorted chronologically (earlier block IDs are displayed first)
Example
Request:
http://localhost:1400/api? requestType=getAccountBlockIds& account=387977119245692429 timestamp=0
Response:
{ "blockIds": [ "932115710792099523" ] }
Verified 5/1/14
Get Account Public Key
Retrieves the public key associated with a supplied account number.
Request
http://localhost:1400/api? requestType=getAccountPublicKey& account=ACCOUNTNUM
Where:
- ACCOUNTNUM is the account number you want to check
Response
{ "publicKey": "PUBKEY" }
Where:
- PUBKEY is the 64-byte public key associated with the account.
Note: If the supplied account number is unknown, you will receive error code 5. If the account exists but no transaction has ever been sent from the account, you will receive an empty tuple: {}
Example
Request:
http://localhost:1400/api? requestType=getAccountPublicKey& account=6483973064837388393
Response:
{ "publicKey": "29592749cd26f5c1c4bf0225f8ab225f289449b4978495e6fec09d486ae2d217" }
Verified 5/1/14
Get Account Transaction IDs
Retrieves the transaction IDs associated with a supplied account number. The timestamp parameter determines how far back you'd like to go in the transaction list; a value of 0 will give you every transaction for the account since the genesis block.
Request
http://localhost:1400/api? requestType=getAccountTransactionIds& account=ACCOUNT& timestamp=TIME& type=TYPE& subtype=SUBTYPE
Where:
- ACCOUNT is the account number you want to check
- TIME, expressed in seconds since the genesis block, determines the earliest transaction time you'd like to check. Setting this to 0 will give you all of the transaction IDs for the supplied account.
- TYPE (Optional) is the type of transaction you want to check
- SUBTYPE (Optional) is the type of sub-transaction you want to check
Response
{ "transactionIds": [ARRAY_OF_IDs] }
Where:
- ARRAY_OF_IDs is the an array of transaction IDs.
Note: Results are sorted by timestamp (earliest transactionIDs are displayed first)
Example
Request:
http://localhost:1400/api? requestType=getAccountTransactionIds& account=25940420118693217452& timestamp=0
Response:
{ "transactionIds": [ "17484500871708980634", "51938275284739120529" ] }
Verified 5/5/14
Get Balance
Retrieves the balance of an account.
Request
http://localhost:1400/api? requestType=getBalance& account=ACCOUNT
Where:
- ACCOUNT is the LibreMoney account number
Response
{ "guaranteedBalance": "GUARANTEED_BALANCE", "balance": "BALANCE", "effectiveBalance": EFFBALANCE, "unconfirmedBalance": "UNCONFBALANCE", "forgedBalance": "FORGEDBAL" }
Where:
- GUARANTEED_BALANCE is the total balance of the account that meets a criteria. Result is expressed in MilliLm
- BALANCE is the amount of MilliLm you have, regardless of the number of confirmations the transactions associated with that MilliLm have.
- EFFBALANCE is the amount of MilliLm you have that is represented by at least 1440 confirmations. This is the balance that is used for forging.
- UNCONFBALANCE is the balance (in MilliLm) minus all unconfirmed sent transactions. It doesn't include double-spending and unconfirmed received transactions. A user sees the unconfirmed balance in the client.
- FORGEDBAL is the balance that the account has forged in MilliLm
Example
Request:
http://localhost:1400/api? requestType=getBalance& account=7898870630272254992
Response:
{ "guaranteedBalance": "0", "balance": "1000700000000", "effectiveBalance": 9932, "unconfirmedBalance": "1000700000000", "forgedBalance": "0" }
Verified 5/12/14
Get Guaranteed Balance
Retrieves the balance of an account that is confirmed at least a specified number of times. Implemented in software version 0.5.5
Request
http://localhost:1400/api? requestType=getGuaranteedBalance& account=ACCOUNT& numberOfConfirmations=CONFIRMATIONS
Where:
- ACCOUNT is the LibreMoney account number
- CONFIRMATIONS is the minimum number of confirmations for a transaction to appear as part of the guaranteed balance
Response
{ "guaranteedBalance": GUARANTEED_BALANCE }
Where:
- GUARANTEED_BALANCE is the total balance of the account that meets the CONFIRMATIONS criteria. Result is expressed in MilliLm
Example
Request:
http://localhost:1400/api? requestType=getGuaranteedBalance& account=3847997711292454692& numberOfConfirmations=15
Response:
{ "guaranteedBalance": 1303400000000 }
Verified 5/1/14
Lease Balance
Lease your balance of MilliLm to another account.
Request
http://localhost:1400/api? requestType=leaseBalance& period=PERIOD& recipient=REC& secretPhrase=SECRET& fee=FEE& deadline=DEADLINE& referencedTransaction=REFTXID& broadcast=BROAD
Where:
- PERIOD is how long the balance will be leased in number of blocks
- REC is the account you want to lease your balance to
- SECRET is the secret passphrase of the account issuing the transaction
- 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=leaseBalance& period=2880& recipient=1562462127635514638& secretPhrase=123& fee=100000000& deadline=1440
Response:
{ "fullHash": "e4d1f83e1cf26ee71d8566d00077510c4a641e04174e7ec3893d7e5aafc82e65", "signatureHash": "48cab5351b4c08ac2816b5e13e9d238fa910085a0d07a16e1c7d7986222fc444", "transactionBytes": "0400401adb00a005668683e673274c671802492d6f5...", "hash": "9b64d859cecdf63773d0696777c2783892616f3a793794544531e4fd7b8a66b2", "transaction": "16676532673329025508", "broadcasted": true, "unsignedTransactionBytes": "0400401adb00a005668683e673274c671802492d6f54cdc..." }
Verified 5/9/14
Start / Stop / Get Forging
Start or stop forging with an account, or check to see if an account is forging. An account will "forge" when its secret passphrase (private key) is supplied to a LibreMoney server/node.
Request
http://localhost:1400/api? requestType=START_OR_STOP_OR_GET& secretPhrase=SECRET
Where:
- START_OR_STOP_OR_GET is either startForging or stopForging or getForging
- SECRET the secret passphrase (private key) for the account whose forging you want to stop or start
Response
For "startForging" and "getForging":
{ "deadline": DEADLINE }
Where:
- DEADLINE is the estimated number of seconds until the forging account will generate the next block
For "stopForging":
{ "foundAndStopped": TRUE_OR_FALSE }
Example
Request:
http://localhost:1400/api? requestType=startForging& secretPhrase=MySuperSecretPasswordThatIsNotActuallyPostedHereOrIsEvenRealSoDoNotEvenTryIt
Response:
{ "deadline": 1036742 }
Verified 5/5/14
Set Account Information
Set your account information
Request
http://localhost:1400/api? requestType=setAccountInfo& secretPhrase=SECRET& name=NAME& description=DESCRIPT& publicKey=PUBKEY& fee=FEE& deadline=DEADLINE& referencedTransactionFullHash=REFTXHASH& broadcast=BROAD
Where:
- 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)
- PUBKEY is the public key of the sending account for the transaction (optional)
- NAME is the name you want to set for the account (optional)
- DESCIPT is the description you want to set for the account (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=setAccountInfo& secretPhrase=MySuperSecretPasswordThatIsNotActuallyPostedHereOrIsEvenRealSoDoNotEvenTryIt& fee=100000000& deadline=1440
Response:
{ "fullHash": "93e8bba270eed8693f62576e13b45b45a848dd475e510fdb1e4026712829b734", "signatureHash": "5487681f5a828d379864cbbdba9b1f4f2c6f7035c8cf2f272dc323147aea5eac", "transactionBytes": "0105c84ad700a005668683e673274c671802492d6f54cdc33d247aa426e7...", "hash": "6b6ec6ad2f06119493caca546b6561069cd5341b41884d5be068e0b1d9ce7748", "transaction": "7627108136485906579", "broadcasted": true, "unsignedTransactionBytes": "0105c84ad700a005668683e673274c671802492d6f54cdc33d247aa4..." }
Verified 5/6/14