kryptokrona-service
The kryptokrona RPC Wallet is a HTTP server which provides JSON 2.0 RPC interface for kryptokrona payment operations and address management.
Currently we support the following official client bindings:
Note: Eventually, kryptokrona-service will be deprecated. It is suggested to use wallet-api for new applications.
Installation
Interacting with the API
API endpoint example
Configuration and instantiation
To make a JSON RPC request to your kryptokrona RPC Wallet you should use a GET request that looks like this:
http://<service address>:<service port>/json_rpc
Parameter | Description |
---|---|
| IP of kryptokrona RPC Wallet, if RPC Wallet is located on local machine it is either 127.0.0.1 or localhost |
| kryptokrona RPC Wallet port, by default it is bound to 8070 port, but it can be manually bound to any port you want |
reset
reset()
method allows you to re-sync your wallet.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
scanHeight | No | The height to begin scanning for transactions at. This can greatly speed up wallet syncing time. | int |
Expected Output:
No output in case of success.
Note: If the
viewSecretKey
argument is not provided, thereset()
method resets the wallet and re-syncs it. If theviewSecretKey
argument is provided, thereset()
method substitutes the existing wallet with a new one with the specified key.
save
save()
method allows you to save your wallet by request.
No input. No output in case of success.
Expected Output:
getViewKey
getViewKey()
method returns your view key.
No input.
Output
Argument | Description | Format |
---|---|---|
viewSecretKey | Private view key | string |
Expected Output:
getSpendKeys
getSpendKeys()
method returns your spend keys.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
address | Yes | Valid address that exists in this container | string |
Output
Argument | Description | Format |
---|---|---|
spendSecretKey | Private spend key | string |
spendPublicKey | Public spend key | string |
Expected Output:
getMnemonicSeed
getMnemonicSeed()
method returns the mnemonic seed for the given deterministic address. A mnemonic seed is a list of words which can be used to recover a wallet.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
address | Yes | Valid deterministic address that exists in this container | string |
Output
Argument | Description | Format |
---|---|---|
mnemonicSeed | Mnemonic seed | string |
Note: The first wallet address that is generated when the container is created is the deterministic address. Only one wallet from a multi-wallet container can be deterministic. If a non-deterministic address is given, the RPC response will be an error with the message: "Keys not deterministic."
Expected Output:
getStatus
getStatus()
method returns information about the current RPC Wallet state: block count, known block count, last block hash and peer count.
No input.
Output
Argument | Description | Format |
---|---|---|
blockCount | Node's known number of blocks | int |
knownBlockCount | Maximum known number of blocks of all seeds that are connected to the node | int |
lastBlockHash | Hash of the last known block | string |
peerCount | Connected peers number | int |
Expected Output:
getAddresses
getAddresses()
method returns an array of your RPC Wallet's addresses.
No input.
Output
Argument | Description | Format |
---|---|---|
addresses | Array of strings, where each string is an address | array |
Expected Output:
createAddress
createAddress()
method creates an additional address in your wallet.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
spendSecretKey | No | Private spend key. If | string |
spendPublicKey | No | Public spend key. If | string |
newAddress | No | Is this a new address being created? If so, blocks before the creation timestamp will not be scanned. Defaults to true if neither keys are given, as it is guaranteed to be a new address. | bool |
scanHeight | No | The height to begin scanning for transactions at. Only applies if a public/secret key is supplied. This can greatly speed up wallet syncing time. | int |
Expected Output:
deleteAddress
deleteAddress()
method deletes a specified address.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
address | Yes | An address to be deleted | string |
Output
In case of success returns an empty JSON object.
Expected Output:
getBalance
getBalance()
method returns a balance for a specified address.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
address | No | Valid address that exists in this container | string |
Output
Argument | Description | Format |
---|---|---|
availableBalance | Available balance of the specified address in shells | int |
lockedAmount | Locked amount of the specified address in shells | int |
Note: If an address is not specified,
getBalance()
returns a cumulative balance of all RPC Wallet's addresses.
Note: Balances are expressed in shells, so a balance of 10000 is equal to 100.00 SEKR
Expected Output:
getBlockHashes
getBlockHashes()
method returns an array of block hashes for a specified block range.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
firstBlockIndex | Yes | Starting height | int |
blockCount | Yes | Number of blocks to process | int |
Output
Argument | Description | Format |
---|---|---|
blockHashes | Array of strings, where each element is a block hash | array |
Expected Output:
getTransactionHashes
getTransactionHashes()
method returns an array of block and transaction hashes. A transaction consists of transfers. A transfer is an amount-address pair. There could be several transfers in a single transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
addresses | No | Array of strings, where each string is an address | array |
blockHash | Only one of these parameters (blockHash or firstBlockIndex) is allowed | Hash of the starting block | string |
firstBlockIndex | Only one of these parameters (blockHash or firstBlockIndex) is allowed | Starting height | int |
blockCount | Yes | Number of blocks to return transaction hashes from | int |
paymentId | No | Valid payment ID (64char hex string) | string |
If
paymentId
parameter is set,getTransactionHashes()
method returns transaction hashes of transactions that contain specified payment ID in the given block range.If
addresses
parameter is set,getTransactionHashes()
method returns transaction hashes of transactions that contain transfer from at least one of specified addresses.If both above mentioned parameters are set,
getTransactionHashes()
method returns transaction hashes of transactions that contain both specified payment ID and transfer from at least one of specified addresses.
Output
Argument | Description | ||
---|---|---|---|
items | Array of |
Expected Output:
getTransactions
getTransactions()
method returns an array of block and transaction hashes. A transaction consists of transfers. A transfer is an amount-address pair. There could be several transfers in a single transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
addresses | No | Array of strings, where each string is an address | array |
blockHash | Only one of these parameters ( | Hash of the starting block | string |
firstBlockIndex | Only one of these parameters ( | Starting height >0 (1,2,3...) | int |
blockCount | Yes | Number of blocks to return transaction hashes from | int |
paymentId | No | Valid payment ID (64char hex string) | string |
If
paymentId
parameter is set,getTransactions()
method returns transactions that contain specified payment ID in the given block range.If
addresses
parameter is set,getTransactions()
method returns transactions that contain transfer from at least one of specified addresses.If both above mentioned parameters are set,
getTransactions()
method returns transactions that contain both specified payment ID and transfer from at least one of specified addresses.
Output
Argument | Description | Format | |
---|---|---|---|
items | Array of |
Transaction attributes:
Argument | Description | Format |
---|---|---|
transactionHash | Hash of the transaction | string |
blockIndex | Number of the block that contains a transaction | int |
timestamp | Timestamp of the transaction | int |
isBase | Shows if the transaction is a CoinBase transaction or not | boolean |
unlockTime | Height of the block when transaction is going to be available for spending | int |
amount | Amount of the transaction | int |
fee | Transaction fee | int |
extra | Hash of the transaction | string |
paymentId | Payment ID of the transaction (optional) (64char hex string) | string |
transfers | Array of address (string), amount (int) | array |
Expected Output:
getUnconfirmedTransactionHashes
getUnconfirmedTransactionHashes()
method returns information about the current unconfirmed transaction pool or for a specified addresses.
Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
addresses | No | Array of strings, where each string is a valid address | array |
Note: If addresses parameter is set, transactions that contain transfer from at least one of specified addresses are returned.
Output
Argument | Description | Format |
---|---|---|
transactionHashes | Array of strings, where each string is a hash of an unconfirmed transaction | array |
Expected Output:
getTransaction
getTransaction()
method returns information about a particular transaction.
Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
transactionHash | Yes | Hash of the requested transaction | string |
Output
Argument | Description |
---|---|
transaction | see below |
Transaction attributes:
Argument | Description | Format |
---|---|---|
transactionHash | Hash of the transaction | string |
blockIndex | Number of the block that contains a transaction | int |
timestamp | Timestamp of the transaction | int |
isBase | Shows if the transaction is a CoinBase transaction or not | boolean |
unlockTime | Height of the block when transaction is going to be available for spending | int |
amount | Amount of the transaction | int |
fee | Transaction fee | int |
extra | Hash of the transaction | string |
paymentId | Payment ID of the transaction (optional) (64char hex string) | string |
transfers | Array of addresses (string), amount (int) | array |
Expected Output:
sendTransaction
sendTransaction()
method allows you to send transaction(s) to one or several addresses. Also, it allows you to use a payment ID for a transaction to a single address.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
addresses | No | Array of strings, where each string is an address to take the funds from | array |
transfers | Yes | Array of objects, address: (string address), amount: (int amount) | array |
fee | No | Transaction fee. Should be given in atomic units. Leave blank to use the minimum fee possible. | int |
feePerByte | No | Fee to pay per byte of the transaction. Should be given in atomic units. If given, should be greater than 1.953125, the minimum network fee per byte. | float |
unlockTime | No | The block height at which the transaction will be unlocked for spending. | int |
anonymity | Yes | Privacy (mixin) level from block 800,000 three (3) | int |
extra | No | String of variable length. Can contain A-Z, 0-9 characters. | string |
paymentId | No | Payment ID (64char hex string) | string |
changeAddress | No | Valid and existing address in this container. | string |
If container contains only 1 address,
changeAddress
field can be left empty and the change is going to be sent to this address.If addresses field contains only 1 address,
changeAddress
can be left empty and the change is going to be sent to this address.In the rest of the cases,
changeAddress
field is mandatory and must contain an address.
Output
Argument | Description | Format |
---|---|---|
transactionHash | Hash of the sent transaction | string |
fee | The fee of the send transaction | int |
Expected Output:
createDelayedTransaction
createDelayedTransaction()
method creates a delayed transaction. Such transactions are not sent into the network automatically and should be pushed using sendDelayedTransaction
method.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
addresses | No | Array of strings, where each string is an address | array |
transfers | Yes | Array of address (string), amount (int) | array |
fee | No | Transaction fee. Should be given in atomic units. Leave blank to use the minimum fee possible. | int |
feePerByte | No | Fee to pay per byte of the transaction. Should be given in atomic units. If given, should be greater than 1.953125, the minimum network fee per byte. | float |
unlockTime | No | Height of the block until which transaction is going to be locked for spending. | int |
anonymity | Yes | Privacy (mixin) level from block 800,000 three (3) | int |
extra | No | String of variable length. Can contain A-Z, 0-9 characters. | string |
paymentId | No | Payment ID (64char hex string) | string |
changeAddress | No | Valid and existing in this container address. | string |
If container contains only 1 address,
changeAddress
field can be left empty and the change is going to be sent to this addressIf addresses field contains only 1 address,
changeAddress
can be left empty and the change is going to be sent to this addressIn the rest of the cases,
changeAddress
field is mandatory and must contain an address.Outputs that were used for this transactions will be locked until the transaction is sent or cancelled
Output
Argument | Description | Format |
---|---|---|
transactionHash | Hash of the sent transaction | string |
fee | The fee of the send transaction | int |
Expected Output:
getDelayedTransactionHashes
getDelayedTransactionHashes()
method returns hashes of delayed transactions.
No input.
Output
Argument | Description | Format |
---|---|---|
transactionHashes | Array of strings, where each string is a transaction hash | array |
Expected Output:
deleteDelayedTransaction
deleteDelayedTransaction()
method deletes a specified delayed transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
transactionHash | Yes | Valid, existing delayed transaction | string |
Output
In case of success returns an empty JSON object.
Expected Output:
sendDelayedTransaction
sendDelayedTransaction()
method sends a specified delayed transaction.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
transactionHash | Yes | Valid, existing delayed transaction | string |
Output
In case of success returns an empty JSON object.
Expected Output:
sendFusionTransaction
sendFusionTransaction()
method allows you to send a fusion transaction, by taking funds from selected addresses and transferring them to the destination address. If there aren't any outputs that can be optimized, sendFusionTransaction()
will return an error. You can use estimateFusion
to check the outputs, available for the optimization.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
threshold | Yes | Value that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction. | int |
anonymity | Yes | Privacy (mixin) level from block 800,000 three (3) | int |
addresses | No | Array of strings, where each string is an address to take the funds from. | array |
destinationAddress | No | An address that the optimized funds will be sent to. Valid and existing in this container address. | string |
If container contains only 1 address,
destinationAddress
field can be left empty and the funds are going to be sent to this address.If addresses field contains only 1 address,
destinationAddress
can be left empty and the funds are going to be sent to this address.In the rest of the cases,
destinationAddress
field is mandatory and must contain an address.
Output
Argument | Description | Format |
---|---|---|
transactionHash | Hash of the sent transaction | string |
Expected Output:
estimateFusion
estimateFusion()
method counts the number of unspent outputs of the specified addresses and returns how many of those outputs can be optimized. This method is used to understand if a fusion transaction can be created. If fusionReadyCount
returns a value = 0, then a fusion transaction cannot be created.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
threshold | Yes | Value that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction. | int |
addresses | No | Array of strings, where each string is an address to take the funds from. | string |
Output
Argument | Description | Format |
---|---|---|
totalOutputCount | Total number of unspent outputs of the specified addresses. | int |
fusionReadyCount | Number of outputs that can be optimized. | int |
Expected Output:
createIntegratedAddress
createIntegratedAddress()
method allows you to create a combined address, containing a standard address and a paymentId, to be used in sendTransaction() or for supplying to a user, instead of using an address and paymentId as separate parameters. This is helpful to ensure users cannot forget to supply a payment Id.
Input
Argument | Mandatory | Description | Format |
---|---|---|---|
address | Yes | A valid address | string |
paymentId | Yes | A valid paymentId (64char hex string) | string |
Output
Argument | Description | Format |
---|---|---|
integratedAddress | The created integrated address | string |
Expected Output:
getFeeInfo
getFeeInfo()
method retrieves the fee and address (if any) that that kryptokronad walletd is connecting to is using. This fee will automatically be added to any transactions sent by sendTransaction() or sendDelayedTransaction(). Note it does not apply to sendFusionTransaction().
No input.
Output
Argument | Description | Format |
---|---|---|
address | The address of the node owner | string |
amount | The fee that will be sent to the node owners address with each transaction | int |
Expected Output:
validateAddress
validateAddress()
method takes an address as it's only argument and returns isValid: true/false, depending on the validity of the address provided.
Input
Argument | Description | Format |
---|---|---|
address | The address to validate | string |
Output
Argument | Description | Format |
---|---|---|
isValid | The result, i.e. wheter the provided address is valid or not | boolean |
Expected Output:
License
The content in this document was originally written by the Bytecoin (BCN) Developers. It is licensed under the CC BY SA 3.0 license. The source material can be found at the Bytecoin Wiki.
Also of note, kryptokrona developers have altered and adapted the content to suit our implementation of the API. This was done independently of the Bytecoin development team. They neither endorse or acknowledge our changes. Feel free to adopt or change our content as per the CC BY SA 3.0 license requirements.
Last updated