instructions: cryptokernel k320

Cryptokernel K320

Cryptokernel K320

Welcome to the Cryptokernel K320 website - a MIT Media Lab Digital Currency Initiative (DCI) project.

Cryptokernel is a blockchain toolkit created by James Lovejoy, a researcher at the DCI.

K320 is an experimental digital currency implemented using the Cryptokernel software. K320 is up and running and this website has all the resources you need to participate.

Cryptokernel

Cryptokernel shares basic structural elements with Bitcoin but the software is designed for variation and experimentation. This is the best way to make progress. We want people to pick it up and tinker with it. To quote Anthony Hopkins’ character from Westworld, Dr Robert Ford:

“Evolution forged the entirety of sentient life on this planet using only one tool… The mistake.”

The rate of evolution in blockchain technology needs to increase. We want to get it into the hands of as many people as possible, to get experiments running because we know all the answers aren’t within the walls of MIT.

K320

We have used Cryptokernel to implement an experimental digital currency called K320. Its name derives from its monetary policy – Milton Friedman’s K% rule at a rate of 320 basis points or 3.2% growth per year. K320 is designed to build up the initial money supply relatively quickly then switch to the K% rule for monetary growth.

To get started with K320, you need to download and install our software. Please bear in mind Cryptokernel is experimental software and should be treated as such. The purpose of releasing K320 is to test the Cryptokernel software. As with Bitcoin Testnet, the coins are not intended to have value.

Downloads

We have K320 binaries for Linux, MacOS and Windows:

Install instructions

The commands in the courier new font below are case sensitive so please make sure you enter them exactly as typed.



Linux

  1. Download the binary for Linux (link above) and extract the contents to a location of your choice, use this location in place of the square bracket instructions in step 3 below
  2. Open terminal
  3. Enter the following commands:
    • cd [enter the path of download location chosen in step 1]
    • ./ckd
  4. Go to 'All OS' instructions section below

MacOS

  1. Download the .pkg file for MacOS (link above) and extract the contents to a location of your choice, use this location in place of the square bracket instructions in step 5 below
  2. To run the ckd app you may need to give access via security & privacy panel.
  3. Allow incoming connections for ckd if prompted.
  4. Open terminal
  5. Enter the following commands:
    • cd [enter the path of download location chosen in step 1]
    • ./ckd
  6. Go to 'All OS' instructions section below

Windows

  1. Download the zip file for windows (link above) and extract the contents to a location of your choice, use this location in place of the square bracket instructions in step 3 below
  2. Open command prompt
  3. Enter the following commands:
    • cd [enter the path of download location chosen in step 1]
    • ./ckd
  4. Go to 'All OS' instructions section below

All OS

Once you have entered ./ckd for the first time the program will start and you will be asked to create a passphrase to protect your private key. Once you have entered the passphrase and confirmed it the program will start running. Leave the terminal window running the background, you will need to open a new terminal window to do other actions such as sending coins.

Once Cryptokernel has successfully started, "ck daemon started" will be printed on the screen. Opening a new terminal window and issuing a "getinfo" command as described in the instructions section below will allow you to futher confirm that CK is running properly.

If you want to check your balance, make transactions etc. more instructions on how to use K320 are below.

You will need the passphrase to make transactions and it is only stored on your local computer so it cannot be reset. If the passphrase is lost, any balance associated with that account will also be lost.

If you encounter any problems with running the software, please use GitHub issues on the DCI Github for support.

Source code

The Cryptokernel K230 source code is available on the DCI Github.

Instructions

In the instructions below, you need to type the commands shown in the courier new font into the terminal.

Make sure you are in the cryptokernel directory when entering commands otherwise nothing will happen. Use the ls (list contents of directory) and cd (change directory) commands to navigate around your computer's file folders.

For Windows users, all references to terminal mean the command prompt. For Windows use the dir command to list the contents of the directory. The cd command to change directory is the same.

For instructions with commands in [square brackets] this means you have to enter the data requested e.g. an account name or an amount.


Receive coins

  1. Open terminal and navigate to the cryptokernel folder
  2. Enter the following command (you can make up any account name you like):
    ./ckd account [enter account name]
  3. Terminal will output:
    Please enter your wallet passphrase:
  4. Enter your passphrase (the one you set initially when you installed the software) and press enter
  5. Terminal will output a chunk of text including your pubKey address. It will look something like:
    "pubKey" : "BMxWTyk8tuu3XGzxY0YaWOuhjhjr3yhTSD3SAipNlJMyEaQfP/Mr/KtahoG0TOBRqREot7mcdtawHQN2pzTSy+w="
  6. Copy the long address inside the quotation marks, in the above example (make sure you include the = sign at the end, this is part of the address but the quotation marks are not):
    BMxWTyk8tuu3XGzxY0YaWOuhjhjr3yhTSD3SAipNlJMyEaQfP/Mr/KtahoG0TOBRqREot7mcdtawHQN2pzTSy+w=
  7. Send this address to whoever you want to receive coins from.
  8. To check if you have received the balance, use the get balance instructions below. Blocks are every 2.5 mins on average so you won't receive the coins as soon as they have been sent.

Send coins

  1. Open terminal and navigate to the cryptokernel folder
  2. Enter the following commands (the address is the long string of text the person requesting the money has sent to you - see step 6 of 'receive coins' instructions):
    ./ckd sendtoaddress [address] [amount]
  3. Terminal will output:
    Please enter your wallet passphrase:
  4. Enter your passphrase (the one you set initially when you installed the software) and press enter
  5. Terminal will output a chunk of text - this is the transaction ID for the money you just sent. It will look something like:
    7e2c71e33940fa5da5bf2f1d69d0983e2f7db5fcbb09a04ea6d3e820a4501d48
  6. Let the person you sent the money to know that it is on its way. As with receiving money, blocks are every 2.5 mins on average so they won't receive the coins immediately but it won't take long.

Get balance

  1. Open terminal and navigate to the cryptokernel folder
  2. Enter the following command:
    ./ckd getinfo
  3. Terminal will output (example - don't worry if it doesn't look exactly the same, the version numbers will change over time and the height will increase as new blocks are added):
    {
    "balance" : "15125.239",
    "ck_version" : "0.0.1-alpha-dev",
    "connections" : 4,
    "height" : 14455,
    "mempool" : {
    "count" : 0,
    "size" : "0 MB"
    },
    "rpc_version" : "2.0.0-dev"
    }

Restart miner

  1. Open terminal and navigate to the cryptokernel folder
  2. Enter the following command to stop miner (if it has already stopped for some reason - e.g. the computer was reset - then you don't have to do this step. Go straight to step 4):
    ./ckd stop
  3. Wait for miner to stop
  4. Enter the following command to restart miner:
    ./ckd -daemon

Get help

  1. Open terminal and navigate to the cryptokernel folder
  2. Enter the following command:
    ./ckd help
  3. The terminal will output a list of commands:
    CryptoKernel - Blockchain Development Toolkit - v0.0.1-alpha

    account [accountname]
    compilecontract [code]
    dumpprivkeys [accountname]
    getblockbyheight [height]
    getinfo
    getpeerinfo
    importprivkey [accountname] [privkey]
    listaccounts
    listtransactions
    listunspentoutputs [accountname]
    sendtoaddress [address] [amount]
    stop
  4. To use any of these commands you have to type in ./ckd then a space before entering the commands above. For example ./ckd getinfo to get your balance.

Contact

  • If you encounter any problems with running the software, please use GitHub issues on the DCI Github for support.

Advanced Instructions

Wallet Backup

  1. Cryptokernel stores your private keys in a directory called "addressesdb" located in the same directory as where you originally installed ckd. It is advised that you regularly back up this directory to another device to guard against data loss. First, make sure that ckd is not running:
    ./ckd stop
  2. If your device has a GUI, you can use the file explorer on your device to duplicate the "addressesdb" using copy and paste. Using the command line on Linux, the following command can be used to duplicate the "addressesdb" directory to a new directory called "wallet_backup":
    cp -r addressesdb wallet_backup

Configurable Options

  • Cryptokernel ships with a configuration file (config.json) which allows users to set various runtime options for ckd.
  • Log Verbosity - By default is set to false. When enabled by setting the "verbose" option to true, ckd prints logging information to the console instead of only writing output to the "CryptoKernel.log" file.
  • Mining - By default mining is enabled in ckd. Mining can be disabled by setting the "miner" option to false in the configuration file. At present, the built-in miner will only utilise one system core.
  • RPC Authentication - ckd will automatically set a random RPC password on first start, but the username and password can be customised by setting the "rpcuser" and "rpcpassword" options.
  • RPC SSL Encryption - The JSON-RPC HTTP server can be protected with an SSL certificate by specifying the "sslcert" and "sslkey" options. These should each be paths to the desired SSL public certficate and private key file respectively.

JSON-RPC Interface (as of version 0.0.1)

  • getinfo

    Parameters

    None

    Response

    {
     "balance" : "116607.67188166",
     "ck_version" : "0.0.1-alpha",
     "connections" : 8,
     "height" : 16761,
     "mempool" : {
      "count" : 0,
      "size" : "0.000 MB"
     },
     "rpc_version" : "2.0.0-dev"
    }
  • account

    Parameters

    {
     "account" : "my_account_name",
     "password" : "wallet_password"
    }

    Response

    {
     "balance" : "29721.599",
     "keys" : [
      {
       "privKey" : {
        "cipherText" : "rQ0DxnmP7KCG972HuvdRjlj5qe/dFDUZcrTAwaXrusyR68aaRfspe6ATtb/R8sBf",
        "iv" : "mFnG/E4MQ0fKtY+/kp/QHA==",
        "salt" : "frldLOsB5B9ZOtcGFq0hGThUkbrzn6+AW772VeWl3bA="
       },
       "pubKey" : "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw="
      }
     ],
     "name" : "my_account_name"
    }
  • sendtoaddress

    Parameters

    {
     "address" : "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw=",
     "amount" : 56.5745614,
     "password" : "wallet_password"
    }

    Response

    Transaction ID or error message as string

  • sendrawtransaction

    Parameters

    {
     "transaction" : {
      JSON CK transaction
     }
    }

    Response

    True or false boolean upon succcess or failure respectively

  • listaccounts

    Parameters

    None

    Response

    {
     "accounts" : [
      List of JSON CK accounts as described in the "account" RPC
     ]
    }
  • listunspentoutputs

    Parameters

    {
     "account" : "my_account_name"
    }

    Response

    {
     "outputs" : [
      {
       "data" : {
        "contract" : null,
        "publicKey" : "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw="
       },
       "id" : "fe629707560edca7a4f815130507f3e60ebe5aa15157a5b6d365c364e3b797f3",
       "nonce" : 174256406,
       "value" : 9867491919
      }
     ]
    }
  • compilecontract

    Parameters

    {
     "code" : "return true"
    }

    Response

    Cryptokernel format compressed Lua bytecode as string

  • calculateoutputid

    Parameters

    {
     "output" : {
      "data" : {
       "contract" : null,
       "publicKey" : "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw="
      },
      "nonce" : 174256406,
      "value" : 9867491919
     }
    }

    Response

    Output ID as a hexadecimal string

  • signtransaction

    Parameters

    {
     "transaction" : {
      "inputs" : [
       {
        "outputId" : "1fa734ea178465f19f74289a5fb4930f0715fd5551765aca07c8a3bedd960283"
       }
      ],
      "outputs" : [
       {
        "data" : {
         "contract" : null,
         "publicKey" : "BIRY3jEVuvPIfGj1S915zF9BlqKkYWCwxvSQlhbB3hoN6UA1GiWcSu6B5PJXb8gKUlnqWCIkWVpZW2jS3lWXF5o="
        },
        "nonce" : 4087638075676156377,
        "value" : 150000000
       },
       {
        "data" : {
         "contract" : null,
         "publicKey" : "BAz+SZCDZjRAr/NECLFZbG+YtYjy3shpcMUvIze44H9YUfW6RBszTIcaS//U+y1zG/dsWKT81DFSWfiSDspBAK8="
        },
        "nonce" : 2900054126498503030,
        "value" : 9801094726
       }
      ],
      "timestamp" : 1502470831
     },
     "password" : "my_wallet_password"
    }

    Response

    {
     "inputs" : [
      {
       "data" : {
        "signature" : "MEQCIHbLzyvml/ndoODCNtC2YpLZn6zin8ycOsaKjF6oIem3AiBh2MTeFC0u6UH0EifGbV8Rl5/0I3n4KNDlL3GtFk7dQw=="
       },
       "outputId" : "1fa734ea178465f19f74289a5fb4930f0715fd5551765aca07c8a3bedd960283"
      }
     ],
     "outputs" : [
      {
       "data" : {
        "contract" : null,
        "publicKey" : "BIRY3jEVuvPIfGj1S915zF9BlqKkYWCwxvSQlhbB3hoN6UA1GiWcSu6B5PJXb8gKUlnqWCIkWVpZW2jS3lWXF5o="
       },
       "nonce" : 4087638075676156377,
       "value" : 150000000
      },
      {
       "data" : {
        "contract" : null,
        "publicKey" : "BAz+SZCDZjRAr/NECLFZbG+YtYjy3shpcMUvIze44H9YUfW6RBszTIcaS//U+y1zG/dsWKT81DFSWfiSDspBAK8="
       },
       "nonce" : 2900054126498503030,
       "value" : 9801094726
      }
     ],
     "timestamp" : 1502470831
    }
  • listtransactions

    Parameters

    None

    Response

    {
     "transactions" : [
      List of JSON CK transactions as described in the "signtransaction" RPC response
     ]
    }
  • getblockbyheight

    Parameters

    {
     "height" : 1
    }

    Response

    {
     "coinbaseTx" : {
      "outputs" : [
       {
        "data" : {
         "contract" : null,
         "message" : "For the many...",
         "publicKey" : "BDgkCUSogr3PrCJtY5P0wNsxfMF47I4ZGnJp/nn/CT4SerSibE0MKptXciR4zZCrpNB85xychJB4EURSR2TpYUs="
        },
        "nonce" : 2461443158,
        "value" : 9999986946
       }
      ],
      "timestamp" : 1501282954
     },
     "consensusData" : null,
     "data" : null,
     "height" : 1,
     "id" : "18bc54886fdbad1253a9be4c6130960d2cbd914d9679dd558c805fa773b9758b",
     "previousBlockId" : "0",
     "timestamp" : 1501282954
    }
  • stop

    Parameters

    None

    Response

    Always returns the boolean true

  • getblock

    Parameters

    {
     "id" : "18bc54886fdbad1253a9be4c6130960d2cbd914d9679dd558c805fa773b9758b"
    }

    Response

    {
     "coinbaseTx" : {
      "outputs" : [
       {
        "data" : {
         "contract" : null,
         "message" : "For the many...",
         "publicKey" : "BDgkCUSogr3PrCJtY5P0wNsxfMF47I4ZGnJp/nn/CT4SerSibE0MKptXciR4zZCrpNB85xychJB4EURSR2TpYUs="
        },
        "nonce" : 2461443158,
        "value" : 9999986946
       }
      ],
      "timestamp" : 1501282954
     },
     "consensusData" : null,
     "data" : null,
     "height" : 1,
     "id" : "18bc54886fdbad1253a9be4c6130960d2cbd914d9679dd558c805fa773b9758b",
     "previousBlockId" : "0",
     "timestamp" : 1501282954
    }
  • gettransaction

    Parameters

    {
     "id" : "18bc54886fdbad1253a9be4c6130960d2cbd914d9679dd558c805fa773b9758b"
    }

    Response

    {
     "inputs" : [
      {
       "data" : {
        "signature" : "MEQCIHbLzyvml/ndoODCNtC2YpLZn6zin8ycOsaKjF6oIem3AiBh2MTeFC0u6UH0EifGbV8Rl5/0I3n4KNDlL3GtFk7dQw=="
       },
       "outputId" : "1fa734ea178465f19f74289a5fb4930f0715fd5551765aca07c8a3bedd960283"
      }
     ],
     "outputs" : [
      {
       "data" : {
        "contract" : null,
        "publicKey" : "BIRY3jEVuvPIfGj1S915zF9BlqKkYWCwxvSQlhbB3hoN6UA1GiWcSu6B5PJXb8gKUlnqWCIkWVpZW2jS3lWXF5o="
       },
       "nonce" : 4087638075676156377,
       "value" : 150000000
      },
      {
       "data" : {
        "contract" : null,
        "publicKey" : "BAz+SZCDZjRAr/NECLFZbG+YtYjy3shpcMUvIze44H9YUfW6RBszTIcaS//U+y1zG/dsWKT81DFSWfiSDspBAK8="
       },
       "nonce" : 2900054126498503030,
       "value" : 9801094726
      }
     ],
     "timestamp" : 1502470831
    }
  • importprivkey

    Parameters

    {
     "key" : "WnVW9OsLzVFFtFZt0l1KaC9MPBBZ7AouL51F1IwZ+FA=",
     "name" : "new_account_name",
     "password" : "my_wallet_password"
    }

    Response

    {
     "balance" : "0",
     "keys" : [
      {
       "privKey" : {
        "cipherText" : "rQ0DxnmP7KCG972HuvdRjlj5qe/dFDUZcrTAwaXrusyR68aaRfspe6ATtb/R8sBf",
        "iv" : "mFnG/E4MQ0fKtY+/kp/QHA==",
        "salt" : "frldLOsB5B9ZOtcGFq0hGThUkbrzn6+AW772VeWl3bA="
       },
       "pubKey" : "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw="
      }
     ],
     "name" : "new_account_name"
    }
  • getpeerinfo

    Parameters

    None

    Response

    {
     "73.218.234.243" :
     {
      "connectedSince" : 1503685063,
      "height" : 16833,
      "incoming" : true,
      "ping" : 28,
      "transferDown" : 276800,
      "transferUp" : 342145,
      "version" : "0.0.1-alpha"
     }
    }
  • dumpprivkeys

    Parameters

    {
     "account" : "my_account_name",
     "password" : "my_wallet_password"
    }

    Response

    {
     "BDrZB0yPdAyczLfNHdcmnoc70UvVQvdBmLfgoIEDGk7yBNQUD/iQWzNMH+f6LOCtOunLbp4FJIzfmgvggwWNpuw=" : "WnVW9OsLzVFFtFZt0l1KaC9MPBBZ7AouL51F1IwZ+FA="
    }



dci.mit.edu