Difference between revisions of "Cryptonite API"

From Mini-blockchain Project
Jump to: navigation, search
m (small visual fix)
m (small formatting fix)
Line 1: Line 1:
 
__TOC__
 
__TOC__
  
The [[Cryptonite]] API is similar to the [https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list Bitcoin API], containing a few additions and subtractions, some changed arguments, and some use restrictions. Almost all commands returning anything more than a hash will return different JSON objects as compared to bitcoin.
+
The [[Cryptonite]] API is similar to the [https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list Bitcoin API], containing a few additions and subtractions, some changed arguments, and some use restrictions. Almost all commands returning anything more than a hash will return different JSON objects as compared to bitcoin. You can use the help command to get more information about any command.
  
 
===New commands:===
 
===New commands:===
Line 7: Line 7:
 
* addmultisigaddress - Generates a multisig destination address from a list of signers
 
* addmultisigaddress - Generates a multisig destination address from a list of signers
 
* getblockheader - Gets header component of block only
 
* getblockheader - Gets header component of block only
* setlimit - set withdrawal limit for an address
+
* setlimit - set [[Withdrawal_limits | withdrawal limit]] for an address
  
 
===Modified commands:===
 
===Modified commands:===
Line 28: Line 28:
 
* listlockedunspent
 
* listlockedunspent
  
You can use the help command to get more information about any command.
+
==A note about EP amounts==
 
+
==A note about EP amounts:==
+
  
 
Since Cryptonite uses 64-bit's worth of coin units, it is not safe to treat amounts as double precision floating point values unless they are smaller than about 32 million XCN. To prevent old code designed for use with bitcoin daemon from trying to parse Cryptonite amounts, all RPC calls use strings to represent amounts. We call this encoding the extended-precision encoding, or EP for short.
 
Since Cryptonite uses 64-bit's worth of coin units, it is not safe to treat amounts as double precision floating point values unless they are smaller than about 32 million XCN. To prevent old code designed for use with bitcoin daemon from trying to parse Cryptonite amounts, all RPC calls use strings to represent amounts. We call this encoding the extended-precision encoding, or EP for short.

Revision as of 15:10, 24 July 2014

The Cryptonite API is similar to the Bitcoin API, containing a few additions and subtractions, some changed arguments, and some use restrictions. Almost all commands returning anything more than a hash will return different JSON objects as compared to bitcoin. You can use the help command to get more information about any command.

New commands:

  • addmultisigaddress - Generates a multisig destination address from a list of signers
  • getblockheader - Gets header component of block only
  • setlimit - set withdrawal limit for an address

Modified commands:

  • listunspent is now listbalances
  • decoderawtransaction - Now has optional arguments to support successful decoding of partially signed multisignature transactions
  • sendtoaddress,sendmany,sendfrom - The two comment fields have been replaced by a single message field that is actually included in the transaction
  • signrawtransaction - Extra parameters allowed to help with signing of partially unsigned multisignature addresses

Restricted commands:

  • getblock - May fail if block is more than 10k blocks from tip.
  • gettransaction/getrawtransaction - Transactions older then 10k blocks may not be locatable.

Removed commands:

  • getrawchangeaddress
  • decodescript
  • lockunspent
  • listlockedunspent

A note about EP amounts

Since Cryptonite uses 64-bit's worth of coin units, it is not safe to treat amounts as double precision floating point values unless they are smaller than about 32 million XCN. To prevent old code designed for use with bitcoin daemon from trying to parse Cryptonite amounts, all RPC calls use strings to represent amounts. We call this encoding the extended-precision encoding, or EP for short.

EP numbers are strings in JSON, and must always have 8 digits after the decimal point followed by "ep". An example of a valid RPC command using an ep number would be:

./cryptonited sendtoaddress mvqH4czVQg2HdGpkV7PWVZJpRXVwLnMXpN "0.01000000ep"

All amounts returned in RPC results are also EP numbers, and you must take care to parse them, do not use floating point to represent them unless you are really sure of what you are doing.