Kevacoin API Tutorial
Start Kevacoin client
Start the command line client:
kevacoind
Or start the GUI client:
kevacoin-qt
If it is the first time the client is launched, it will take a while to sync with other peers, please be patient.
Create a namespace
This will create a namespace in which we can later add key-value pairs.
kevacoin-cli keva_namespace "my first namespace"
[
{
"txid": "244fcb0f30e26b0fbf346e82494a7ae5e8c3d7e3e70974105e9a19d1b92cb4f5",
"namespaceId": "NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC"
}
]
Add key-value pair
Add the first key-value pair in the newly created namespace.
kevacoin-cli keva_put NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC "first key" "first value" eb6eb57259b5468a156bbca77d56b4863349e1b4bcf7795a6037aef39530b319
Get key-value pair
Retrieve the value we just added.
kevacoin-cli keva_get NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC "first key" first value
Get pending changes
It will take up to two minutes for the transaction to be confirmed and add to the blockchain.
Use the keva_pending command to list the pending operations.
kevacoin-cli keva_pending
[
{
"op": "keva_namespace",
"namespace": "NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC",
"display name": "my first namespace",
"txid": "244fcb0f30e26b0fbf346e82494a7ae5e8c3d7e3e70974105e9a19d1b92cb4f5"
},
{
"op": "keva_put",
"namespace": "NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC",
"key": "first key",
"value": "first value",
"txid": "eb6eb57259b5468a156bbca77d56b4863349e1b4bcf7795a6037aef39530b319"
}
]
Search for keys
Search for keys that are in the blockchain using regular expression. The values will not be shown if the operations are still pending.
kevacoin-cli keva_filter NfjHmcWxHndbfMRG7FeXWtmBEaRp896wBC "first*"
[
{
"name": "first key",
"value": "first value",
"txid": "7620f6b81997f99c47d478157cbe8129b9841afa0337cb9a80a78d9d9d2bf27f",
"vout": 0,
"address": "K9ATguB1UJjTKgYmySGWf7sHBVMf9ME2zM",
"height": 650
}
]