Difference between revisions of "Cryptonite API"

From Mini-blockchain Project
Jump to: navigation, search
(Added page to wiki)
 
m (added info on recent rpc changes)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
The [[Cryptonite]] API call list is essentially the same as the [https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list Bitcoin API call list] with a few small changes.
+
__TOC__
  
listunspent is now listbalances and we have a new command: setlimit<br>
+
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.
You can use the help command to get information about setlimit or anything else.
+
  
The following API commands have been removed:<br>
+
===New commands:===
getrawchangeaddress,decodescript,lockunspent,listlockedunspent
+
  
All coin values should include all 8 decimal places, end with ep, and be encapsulated in quotes like so:<br>
+
* addmultisigaddress - Generates a multisig destination address from a list of signers
<code>./cryptonited sendtoaddress mvqH4czVQg2HdGpkV7PWVZJpRXVwLnMXpN "0.01000000ep"</code>
+
* getblockheader - Gets header component of block only
 +
* setlimit - set [[Withdrawal_limits | 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
 +
* createrawtransaction - Added an optional parameter after all other arguments, used for setting message field like sendtoaddress
 +
* setaccount - Added an optional parameter after all other arguments, used to disable the automatic generation of new 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 10 digits after the decimal point followed by "ep". An example of a valid RPC command using an ep number would be:
 +
<pre>./cryptonited sendtoaddress mvqH4czVQg2HdGpkV7PWVZJpRXVwLnMXpN "0.0100000000ep"</pre>
 +
 
 +
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.

Latest revision as of 11:39, 3 September 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
  • createrawtransaction - Added an optional parameter after all other arguments, used for setting message field like sendtoaddress
  • setaccount - Added an optional parameter after all other arguments, used to disable the automatic generation of new 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 10 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.0100000000ep"

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.