NAV Navbar
shell javascript php python go
  • Introduction
  • Wallet RPC API
  • Daemon JSON RPC API
  • Daemon HTTP RPC API
  • RPC Errors
  • Introduction

                     .~\ /~\_/ \.
                     .~\_/~\_/ \_/~\.
                   .~\_/ \_/ \_/ \_/~\
        .----.    /\_/ \_/ \_/ \_/ \_/\
       (o)(o)`\_ /_/ \_/ \_/ \_/ \_/ \_\
       |      , |/ \_/ \_/ \_/ \_/ \_/ \\.  _.;
        \ "  /  |\_/ \_/ \_/ \_/ \_/ \_/~\"'_.'
         `--'`--\/_\-/-\_/-\-/ \_/-\_/_\.-""
                  /~/"""| |"""""| |'"\~\
                _/ /   _| |    _| |   \ \
               (___|  (___|   (___|  (___|
    

    This website documents the public APIs of TurtleCoin.

    You can view code examples in the dark area to the right; switch the programming language of the examples with the tabs in the top right.

    We also have some specific language bindings to make integration easier.

    If anything is missing or seems incorrect, please check the GitHub issues for existing known issues or create a new one.

    Wallet RPC API

    TurtleCoin RPC Wallet is a HTTP server which provides JSON 2.0 RPC interface for TurtleCoin payment operations and address management.

    Currently we support the following official client bindings:

    npm install turtlecoin-rpc
    
    composer require turtlecoin/turtlecoin-rpc-php
    
    pip3 install turtlecoin
    
    go get github.com/turtlecoin/turtlecoin-rpc-go
    

    Interacting with the API

    API endpoint example

    http://localhost:8070/json_rpc
    

    Configuration and instantiation

    const TurtleService = require('turtlecoin-rpc').TurtleService
    
    const service = new TurtleService({
      host: '127.0.0.1', // ip address or hostname of the turtle-service host
      port: 8070, // what port is turtle-service running on
      timeout: 2000, // request timeout
      ssl: false, // whether we need to connect using SSL/TLS
      rpcPassword: 'changeme', // must be set to the password used to run turtle-service
    
      // RPC API default values
      defaultMixin: false, // the default mixin to use for transactions, the default setting is false which means we don't have a default value
      defaultFee: 0.1, // the default transaction fee for transactions
      defaultBlockCount: 1, // the default number of blocks when blockCount is required
      decimalDivisor: 100, // Currency has many decimal places?
      defaultFirstBlockIndex: 1, // the default first block index we will use when it is required
      defaultUnlockTime: 0, // the default unlockTime for transactions
      defaultFusionThreshold: 10000000, // the default fusionThreshold for fusion transactions
    })
    
    <?php
    use TurtleCoin\TurtleService;
    
    $config = [
        'rpcHost'     => 'http://localhost',
        'rpcPort'     => 8070,
        'rpcPassword' => 'passw0rd',
    ];
    
    $turtleService = new TurtleService($config);
    
    from turtlecoin import Walletd
    
    rpc_host = 'localhost'
    rpc_port = 8070
    rpc_password = 'passw0rd'
    
    walletd = Walletd(rpc_password, rpc_host, rpc_port)
    
    import (
      "fmt"
      trpc "github.com/turtlecoin/turtlecoin-rpc-go"
    )
    
    rpcHost := "localhost"
    rpcPort := 8070
    rpcPassword := "passw0rd"
    
    service := trpc.Walletd{
      URL: rpcHost,
      Port: rpcPort,
      RPCPassword: rpcPassword}
    

    To make a JSON RPC request to your TurtleCoin RPC Wallet you should use a POST request that looks like this:

    http://<service address>:<service port>/json_rpc

    Parameter Description
    <service address> IP of TurtleCoin RPC Wallet, if RPC Wallet is located on local machine it is either 127.0.0.1 or localhost
    <service port> TurtleCoin RPC Wallet port, by default it is bound to 8070 port, but it can be manually bound to any port you want

    reset

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"reset","params":{"scanHeight":100000}}' http://localhost:8070/json_rpc
    
    service.reset({
      scanHeight: 100000
    }).then(() => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $scanHeight = 100000;
    $response = $turtleService->reset($scanHeight);
    echo $response;
    
    scan_height = 100000
    response = walletd.reset(scan_height)
    print(response)
    
    scanHeight := 0 // starting height to scan
    response, err := service.Reset(scanHeight)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{}
    }
    

    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

    No output in case of success.

    save

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"save","params":{}}' http://localhost:8070/json_rpc
    
    service.save().then(() => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtleService->save();
    echo $response;
    
    response = walletd.save()
    print(response)
    
    response, err := service.Save()
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{}
    }
    

    save() method allows you to save your wallet by request.

    No input. No output in case of success.

    getViewKey

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getViewKey","params":{}}' http://localhost:8070/json_rpc
    
    service.getViewKey().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtleService->getViewKey();
    echo $response;
    
    response = walletd.get_view_key()
    print(response)
    
    response, err := service.GetViewKey()
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "viewSecretKey":"xxxxx..."
      }
    }
    

    getViewKey() method returns your view key.

    No input.

    Output

    Argument Description Format
    viewSecretKey Private view key string

    getSpendKeys

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getSpendKeys","params":{"address":"TRTLxxxx..."}}' http://localhost:8070/json_rpc
    
    service.getSpendKeys({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $address = 'TRTLxxxx...';
    $response = $turtleService->getSpendKeys($address);
    echo $response;
    
    address = 'TRTLxxxx...'
    response = walletd.get_spend_keys(address)
    print(response)
    
    address := "TRTLxxxx..."
    response, err := service.GetSpendKeys(address)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "spendSecretKey":"xxxxx...",
        "spendPublicKey":"xxxxx..."
      }
    }
    

    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

    getMnemonicSeed

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getMnemonicSeed","params":{"address":"TRTLxxxx..."}}' http://localhost:8070/json_rpc
    
    service.getMnemonicSeed({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $address = 'TRTLxxxx...';
    $response = $turtleService->getMnemonicSeed($address);
    echo $response;
    
    address = 'TRTLxxxx...'
    response = walletd.get_mnemonic_seed(address)
    print(response)
    
    address := "TRTLxxxx..."
    response, err := service.GetMnemonicSeed(address)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "mnemonicSeed":"turtles are cool..."
      }
    }
    

    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

    getStatus

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getStatus","params":{}}' http://localhost:8070/json_rpc
    
    service.getStatus().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtleService->getStatus();
    echo $response;
    
    response = walletd.get_status()
    print(response)
    
    response, err := service.GetStatus()
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "blockCount":455956,
        "knownBlockCount":455955,
        "lastBlockHash":"8d6f8...",
        "peerCount":8
      }
    }
    

    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

    getAddresses

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getAddresses","params":{}}' http://localhost:8070/json_rpc
    
    service.getAddresses().then((result) => {
      // do something
    }).catch((error) => {
      //do something
    })
    
    <?php
    $response = $turtleService->getAddresses();
    echo $response;
    
    response = walletd.get_addresses()
    print(response)
    
    response, err := service.GetAddresses()
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "addresses":[
          "TRTLxxxx...",
          "TRTLxxxx..."
        ]
      }
    }
    

    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

    createAddress

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createAddress","params":{}}' http://localhost:8070/json_rpc
    
    service.createAddress({
      secretSpendKey: '',
      publicSpendKey: ''
    }).then((result) => {
      // do something
    }).catch((error) => {
      //do something
    })
    
    <?php
    $secretSpendKey = null;
    $publicSpendKey = null;
    $response = $turtleService->createAddress($secretSpendKey, $publicSpendKey);
    echo $response;
    
    spend_secret_key = ''
    spend_public_key = ''
    response = walletd.create_address(spend_secret_key, spend_public_key)
    print(response)
    
    spendSecretKey := ""
    spendPublicKey := ""
    scanHeight := 850000
    newAddress := true
    response, err := service.CreateAddress(spendSecretKey, spendPublicKey, scanHeight, newAddress)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "address":"TRTLxxxx..."
      }
    }
    

    createAddress() method creates an additional address in your wallet.

    Input

    Argument Mandatory Description Format
    secretSpendKey No Private spend key. If secretSpendKey was specified, RPC Wallet creates spend address string
    publicSpendKey No Public spend key. If publicSpendKey was specified, RPC Wallet creates view address 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

    deleteAddress

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"deleteAddress","params":{"address":"TRTLxxxx..."}}' http://localhost:8070/json_rpc
    
    service.deleteAddress({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    })
    
    <?php
    $address = 'TRTLxxxx...';
    $response = $turtleService->deleteAddress($address);
    echo $response;
    
    address = 'TRTLxxxx...'
    response = walletd.delete_address(address)
    
    # If the delete was successful, response will be True
    print(response)
    
    address := "TRTLxxxx..."
    response, err := service.DeleteAddress(address)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{}
    }
    

    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.

    getBalance

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getBalance","params":{"address":"TRTLxxxx..."}}' http://localhost:8070/json_rpc
    
    // Address optional
    service.getBalance({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    })
    
    <?php
    $address = 'TRTLxxxx...';
    $response = $turtleService->getBalance($address);
    echo $response;
    
    address = 'TRTLxxxx...'
    response = walletd.get_balance(address)
    print(response)
    
    address := "TRTLxxxx..."
    response, err := service.GetBalance(address)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "availableBalance":10000,
        "lockedAmount":0
      }
    }
    

    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

    getBlockHashes

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getBlockHashes","params":{"firstBlockIndex":0,"blockCount":3}}' http://localhost:8070/json_rpc
    
    service.getBlockHashes({
      firstBlockIndex: 500000,
      blockCount: 10
    }).then((result) => {
      // do something
    })
    
    <?php
    $firstBlockIndex = 0;
    $blockCount = 3;
    $response = $turtleService->getBlockHashes($firstBlockIndex, $blockCount);
    echo $response;
    
    first_block_index = 0
    block_count = 3
    response = walletd.get_block_hashes(first_block_index, block_count)
    print(response)
    
    firstBlockIndex := 0
    blockCount := 3
    response, err := service.GetBlockHashes(firstBlockIndex, blockCount)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "blockHashes":[
          "7fb97...",
          "8c973...",
          "2ef06..."
        ]
      }
    }
    

    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

    getTransactionHashes

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransactionHashes","params":{"firstBlockIndex":400000,"blockCount":100000}}' http://localhost:8070/json_rpc
    
    service.getTransactionHashes({
      addresses: [
        "TRTLux9QBmzCYEGgdWXHEQCAm6vY9vZHkbGmx8ev5LxhYk8N71Pp7PWFYL9CHxpWph2wCPZcJ6tkPfUxVZcUN8xmYsSDJZ25i9n",
        "TRTLv1mPerM2ckUuNvxrkzDE7QKd9PFVUXYbVfbvx8YxB5BYEdSqQvUFYL9CHxpWph2wCPZcJ6tkPfUxVZcUN8xmYsSDJbQMVgF"
      ],
      blockHash: 'f98d6bbe80a81b3aa0aebd004096e2223524f58f347a1f21be122450f244b948',
      blockCount: 1
    }).then((result) => {
      // do something
    })
    
    <?php
    $blockCount = 100000;
    $firstBlockIndex = 400000;
    $blockHash = null;
    $addresses = null;
    $paymentId = null;
    
    $response = $turtleService->getTransactionHashes(
        $blockCount, $firstBlockIndex, $blockHash, $addresses, $paymentId
    );
    
    echo $response;
    
    block_count = 100000
    block_hash = '6c285...'
    addresses = []
    payment_id = ''
    
    response = walletd.get_transaction_hashes(addresses, block_hash, block_count, payment_id)
    print(response)
    
    addresses := []string{"TRTLxxxx..."}
    blockHash := ""
    firstBlockIndex := 0
    blockCount := 3
    paymentID := ""
    response, err := service.GetTransactionHashes(addresses, blockHash, firstBlockIndex, blockCount, paymentID)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "items":[
          {
            "blockHash":"f0d8c...",
            "transactionHashes":["529ea..."]
          },
          {
            "blockHash":"4a1ae...",
            "transactionHashes":["2e709..."]
          }
        ]
      }
    }
    

    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

    Output

    Argument Description
    items Array of
    Attribute Description Format
    blockHash Hash of the block which contains transaction hashes string
    transactionHashes Array of strings, where each string is a transaction hash array

    getTransactions

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransactions","params":{"firstBlockIndex":400000,"blockCount":100000}}' http://localhost:8070/json_rpc
    
    service.getTransactions({
      addresses: [
        "TRTLux9QBmzCYEGgdWXHEQCAm6vY9vZHkbGmx8ev5LxhYk8N71Pp7PWFYL9CHxpWph2wCPZcJ6tkPfUxVZcUN8xmYsSDJZ25i9n",
        "TRTLv1mPerM2ckUuNvxrkzDE7QKd9PFVUXYbVfbvx8YxB5BYEdSqQvUFYL9CHxpWph2wCPZcJ6tkPfUxVZcUN8xmYsSDJbQMVgF"
      ],
      firstBlockIndex: 469419,
      blockCount: 1
    }).then((result) => {
      // do something
    })
    
    <?php
    $blockCount = 100000;
    $firstBlockIndex = 400000;
    $blockHash = null;
    $addresses = null;
    $paymentId = null;
    
    $response = $turtleService->getTransactions(
        $blockCount, $firstBlockIndex, $blockHash, $addresses, $paymentId
    );
    
    echo $response;
    
    block_count = 100000
    block_hash = '6c285...'
    addresses = []
    payment_id = ''
    
    response = walletd.get_transactions(addresses, block_hash, block_count, payment_id)
    print(response)
    
    addresses := []string{"TRTLxxxx..."}
    blockHash := ""
    firstBlockIndex := 0
    blockCount := 3
    paymentID := ""
    response, err := service.GetTransactions(addresses, blockHash, firstBlockIndex, blockCount, paymentID)
    if err != nil {
      fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "items":[
          {
            "blockHash":"f0d8c...",
            "transactions":[
              {
                "amount":10000,
                "blockIndex":456018,
                "extra":"01bd0...",
                "fee":10,
                "isBase":false,
                "paymentId":"b6fc6...",
                "state":0,
                "timestamp":1526458339,
                "transactionHash":"529ea...",
                "transfers":[
                  {"address":"TRTLxxxx...","amount":10000,"type":0},
                  {"address":"","amount":-100000,"type":0},
                  {"address":"","amount":89990,"type":0}
                ],
                "unlockTime":0
              }
            ]
          },
          {
            "blockHash":"4a1ae...",
            "transactions":[
              {
                "amount":5000,
                "blockIndex":456076,
                "extra":"018c1...",
                "fee":10,
                "isBase":false,
                "paymentId":"55255...",
                "state":0,
                "timestamp":1526460243,
                "transactionHash":"2e709...",
                "transfers":[
                  {"address":"TRTLxxxx...","amount":5000,"type":0},
                  {"address":"","amount":-8000,"type":0},
                  {"address":"","amount":2990,"type":0}
                ],
                "unlockTime":0
              }
            ]
          }
        ]
      }
    }
    

    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 (blockHash or firstBlockIndex) is allowed. Hash of the starting block string
    firstBlockIndex Only one of these parameters (blockHash or firstBlockIndex) is allowed. 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

    Output

    Argument Description Format
    items Array of
    block_hash hash of the block which contains a transaction string
    transactions see below array

    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

    getUnconfirmedTransactionHashes

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getUnconfirmedTransactionHashes","params":{}}' http://localhost:8070/json_rpc
    
    service.getUnconfirmedTransactionHashes({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    })
    
    <?php
    $addresses = null;
    $response = $turtleService->getUnconfirmedTransactionHashes($addresses);
    echo $response;
    
    addresses = []
    response = walletd.get_unconfirmed_transaction_hashes(addresses)
    print(response)
    
    addresses := []string{"TRTLxxxx..."}
    response, err := service.GetUnconfirmedTransactionHashes(addresses)
    if err != nil {
            fmt.Println(err)
    } else {
      fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transactionHashes":[
          "55a23..."
        ]
      }
    }
    

    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

    Output

    Argument Description Format
    transactionHashes Array of strings, where each string is a hash of an unconfirmed transaction array

    getTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransaction","params":{"transactionHash":"55a23..."}}' http://localhost:8070/json_rpc
    
    service.getTransaction({
      transactionHash: 'd01e448f7b631cebd989e3a150258b0da59c66f96adecec392bbf61814310751'
    }).then((result) => {
      // do something
    })
    
    <?php
    $transactionHash = '55a23...';
    $response = $turtleService->getTransaction($transactionHash);
    echo $response;
    
    transaction_hash = '55a23...'
    response = walletd.get_transaction(transaction_hash)
    print(response)
    
    transactionHash := "55a23..."
    response, err := service.GetTransaction(transactionHash)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transaction":{
          "amount":5000,
          "blockIndex":456635,
          "extra":"0134b...",
          "fee":10,
          "isBase":false,
          "paymentId":"ac9c5...",
          "state":0,
          "timestamp":1526477499,
          "transactionHash":"55a23...",
          "transfers":[
            {"address":"TRTLxxxx...","amount":5000,"type":0},
            {"address":"","amount":-10000,"type":0},
            {"address":"","amount":4990,"type":0}
          ],
          "unlockTime":0
        }
      }
    }
    

    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

    sendTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendTransaction","params":{"transfers":[{"address":"TRTLxxxx...","amount":5000}],"fee":10,"anonymity":3,"changeAddress":"TRTLyyyy..."}}' http://localhost:8070/json_rpc
    
    service.sendTransaction({
      transfers: [
        service.newTransfer('TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ', 1000000)
      ],
      fee: 0.1
    }).then((result) => {
      // do something
    })
    
    <?php
    $anonymity = 3;
    $fee = 10;
    $addresses = null;
    $unlockTime = null;
    $extra = null;
    $paymentId = null;
    $changeAddress = 'TRTLyyyy...';
    
    $transfers = [
        ["address" => "TRTLxxxx...", "amount"  => 5000],
    ];
    
    $response = $turtleService->sendTransaction(
        $anonymity, $transfers, $fee, $addresses, $unlockTime, $extra, $paymentId, $changeAddress
    );
    
    echo $response;
    
    anonymity = 3
    fee = 10
    addresses = []
    unlock_time = 0
    extra = ''
    payment_id = ''
    change_address = 'TRTLyyyy...'
    
    transfers = [
        {"address" : "TRTLxxxx...", "amount" : 5000},
    ]
    
    response = walletd.send_transaction(
        transfers, anonymity, fee, addresses, change_address, extra, payment_id, unlock_time
    )
    print(response)
    
    addresses := []string{"TRTLyyyy..."} // can be empty
    unlockTime := 0
    extra := ""
    paymentID := ""
    fee := 10
    changeAddress := "TRTLyyyy..."
    
    transfers := []map[string]interface{}{
      {
        "address" : "TRTLxxxx...",
        "amount" : 5000,
      },
    }
    
    response, err := service.SendTransaction(addresses, transfers, fee, unlockTime, extra, paymentID, changeAddress)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transactionHash":"ae57e..."
      }
    }
    

    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 Yes Transaction fee. Minimal fee in TurtleCoin network is 0.10 TRTL. As with other amounts use whole units, 1 TRTL = 100 units, so 0.1 TRTL = 10 units int
    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

    Output

    Argument Description Format
    transactionHash Hash of the sent transaction string

    createDelayedTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createDelayedTransaction","params":{"transfers":[{"address":"TRTLxxxx...","amount":5000}],"fee":10,"anonymity":3,"changeAddress":"TRTLyyyy..."}}' http://localhost:8070/json_rpc
    
    service.createDelayedTransaction({
      transfers: [
        service.newTransfer('TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ', 1000000)
      ],
      fee: 0.1
    }).then((result) => {
      // do something
    })
    
    <?php
    $anonymity = 3;
    $fee = 10;
    $addresses = null;
    $unlockTime = null;
    $extra = null;
    $paymentId = null;
    $changeAddress = 'TRTLyyyy...';
    
    $transfers = [
        ["address" => "TRTLxxxx...", "amount"  => 5000],
    ];
    
    $response = $turtleService->createDelayedTransaction(
        $anonymity, $transfers, $fee, $addresses, $unlockTime, $extra, $paymentId, $changeAddress
    );
    
    echo $response;
    
    anonymity = 3
    fee = 10
    addresses = []
    unlock_time = 0
    extra = ''
    payment_id = ''
    change_address = 'TRTLyyyy...'
    
    transfers = [
        {"address" : "TRTLxxxx...", "amount" : 5000},
    ]
    
    response = walletd.create_delayed_transaction(
        transfers, anonymity, fee, addresses, change_address, extra, payment_id, unlock_time
    )
    print(response)
    
    addresses := []string{"TRTLyyyy..."} // can be empty
    unlockTime := 0
    extra := ""
    paymentID := ""
    fee := 10
    changeAddress := "TRTLyyyy..."
    
    transfers := []map[string]interface{}{
      {
        "address" : "TRTLxxxx...",
        "amount" : 5000,
      },
    }
    
    response, err := service.CreateDelayedTransaction(addresses, transfers, fee, unlockTime, extra, paymentID, changeAddress)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transactionHash":"ae57e..."
      }
    }
    

    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 Yes Transaction fee. Minimal fee in TurtleCoin network is 0.10 TRTL. This parameter should be specified in minimal available TRTL units. For example, if your fee is 0.10 TRTL, you should pass it as 10. int
    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

    Output

    Argument Description Format
    transactionHash Hash of the sent transaction string

    getDelayedTransactionHashes

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getDelayedTransactionHashes","params":{}}' http://localhost:8070/json_rpc
    
    service.getDelayedTransactionHashes().then((result) => {
      // do something
    })
    
    <?php
    $response = $turtleService->getDelayedTransactionHashes();
    echo $response;
    
    response = walletd.get_delayed_transaction_hashes()
    print(response)
    
    response, err := service.GetDelayedTransactionHashes()
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transactionHashes":["b3e374..."]
      }
    }
    

    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

    deleteDelayedTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"deleteDelayedTransaction","params":{"transactionHash":"b3e37..."}}' http://localhost:8070/json_rpc
    
    service.deleteDelayedTransaction({
      transactionHash: 'd01e448f7b631cebd989e3a150258b0da59c66f96adecec392bbf61814310751'
    }).then((result) => {
      // do something
    })
    
    <?php
    $transactionHash = 'b3e37...';
    $response = $turtleService->deleteDelayedTransaction($transactionHash);
    echo $response;
    
    transaction_hash = '50d83...'
    response = walletd.delete_delayed_transaction(transaction_hash)
    
    # If delete is successful, the response will be True
    print(response)
    
    transactionHash := "50d83..."
    response, err := service.DeleteDelayedTransaction(transactionHash)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{}
    }
    

    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.

    sendDelayedTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendDelayedTransaction","params":{"transactionHash":"c37cd..."}}' http://localhost:8070/json_rpc
    
    service.sendDelayedTransaction({
      transactionHash: 'd01e448f7b631cebd989e3a150258b0da59c66f96adecec392bbf61814310751'
    }).then((result) => {
      // do something
    })
    
    <?php
    $transactionHash = 'c37cd...';
    $response = $turtleService->sendDelayedTransaction($transactionHash);
    
    echo $response;
    
    transaction_hash = '50d83...'
    response = walletd.send_delayed_transaction(transaction_hash)
    
    # If transaction is sent successful, the response will be True
    print(response)
    
    transactionHash := "50d83..."
    response, err := service.SendDelayedTransaction(transactionHash)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{}
    }
    

    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.

    sendFusionTransaction

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendFusionTransaction","params":{"threshold":1000000,"anonymity":3,"addresses":["TRTLxxxx...","TRTLyyyy..."],"destinationAddress":"TRTLzzzz..."}}' http://localhost:8070/json_rpc
    
    service.sendFusionTransaction({
      destinationAddress: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((result) => {
      // do something
    })
    
    <?php
    $threshold = 1000000;
    $anonymity = 3;
    $addresses = ['TRTLxxxx...', 'TRTLyyyy...'];
    $destinationAddress = 'TRTLzzzz...';
    $response = $turtleService->sendFusionTransaction($threshold, $anonymity, $addresses, $destinationAddress);
    
    echo $response;
    
    threshold = 1000000
    anonymity = 3
    addresses = ['TRTLxxxx...', 'TRTLyyyy...']
    destination_address = 'TRTLzzzz...'
    response = walletd.send_fusion_transaction(threshold, anonymity, addresses, destination_address)
    
    print(response)
    
    threshold := 1000000
    addresses := []string{"TRTLxxxx...", "TRTLyyyy..."}
    destinationAddress := "TRTLzzzz..."
    response, err := service.SendfusionTransaction(threshold, addresses, destinationAddress)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "transactionHash":"93faed..."
      }
    }
    

    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

    Output

    Argument Description Format
    transactionHash Hash of the sent transaction string

    estimateFusion

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"estimateFusion","params":{"threshold":1000000,"addresses":["TRTLxxxx...","TRTLyyyy..."]}}' http://localhost:8070/json_rpc
    
    service.estimateFusion({
      threshold: 100000000,
      addresses:[
        'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
      ]
    }).then((result) => {
      // do something
    })
    
    <?php
    $threshold = 1000000;
    $addresses = ['TRTLxxxx...', 'TRTLyyyy...'];
    $response = $turtleService->estimateFusion($threshold, $addresses);
    
    echo $response;
    
    threshold = 1000000
    addresses = ['TRTLxxxx...', 'TRTLyyyy...']
    response = walletd.estimate_fusion(threshold, addresses)
    print(response)
    
    threshold := 1000000
    addresses := []string{"TRTLxxxx...","TRTLyyyy..."}
    response, err := service.EstimateFusion(threshold, addresses)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id":1,
      "jsonrpc":"2.0",
      "result":{
        "fusionReadyCount":0,
        "totalOutputCount":8
      }
    }
    

    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

    createIntegratedAddress

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createIntegratedAddress","params":{"paymentId":"7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F", "address":"TRTLxxxx..."}}' http://localhost:8070/json_rpc
    
    service.createIntegratedAddress({
      address: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ',
      paymentId: '80ec855eef7df4bce718442cabe086f19dfdd0d03907c7768eddb8eca8c5a667'
    }).then((result) => {
      // do something
    })
    
    <?php
    $address = 'TRTLxxxx...';
    $paymentId = '7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F';
    $response = $turtleService->createIntegratedAddress($address, $paymentId);
    
    echo $response;
    
    address = 'TRTLxxxx...'
    payment_id = '7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F'
    response = walletd.create_integrated_address(address, payment_id)
    print(response)
    
    address := "TRTLxxxx..."
    paymentID := "7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F"
    response, err := service.CreateIntegratedAddress(address, paymentID)
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "integratedAddress": "TRTLxxx..."
      }
    }
    

    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

    getFeeInfo

    curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getFeeInfo","params":{}}' http://localhost:8070/json_rpc
    
    service.getFeeInfo().then((result) => {
      // do something
    })
    
    <?php
    $response = $turtleService->getFeeInfo();
    
    echo $response;
    
    response = walletd.get_fee_info()
    print(response)
    
    response, err := service.GetFeeInfo()
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(response)
    }
    

    Expected output:

    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "address": "TRTLxxx...",
        "amount": 5000
      }
    }
    

    getFeeInfo() method retrieves the fee and address (if any) that that TurtleCoind 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

    License

    Creative Commons License

    The content in this document were 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, TurtleCoin 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.

    TurtleCoin developers 2018

    Daemon JSON RPC API

    Daemon JSON RPC is a HTTP server which provides JSON 2.0 RPC interface for interacting with Daemon and Block Explorer.

    Currently we support the following official client bindings:

    npm install turtlecoin-rpc
    
    composer require turtlecoin/turtlecoin-rpc-php
    
    pip3 install turtlecoin
    
    go get github.com/turtlecoin/turtlecoin-rpc-go
    

    Interacting with the API

    API endpoint example

    http://localhost:11898/json_rpc
    

    Configuration and Instantiation

    from turtlecoin import TurtleCoind
    
    rpc_host = 'localhost'
    rpc_port = 11898
    turtlecoind = TurtleCoind(rpc_host, rpc_port)
    
    const TurtleCoind = require('turtlecoin-rpc').TurtleCoind
    
    const daemon = new TurtleCoind({
      host: '0.0.0.0', // ip address or hostname of the TurtleCoind host
      port: 11898, // what port is the RPC server running on
      timeout: 2000, // request timeout
      ssl: false // whether we need to connect using SSL/TLS
    })
    
    <?php
    use TurtleCoin\TurtleCoind;
    
    $config = [
        'rpcHost' => 'http://localhost',
        'rpcPort' => 11898,
    ];
    
    $turtlecoind = new TurtleCoind($config);
    
    import (
        "fmt"
        trpc "github.com/turtlecoin/turtlecoin-rpc-go"
    )
    
    rpcHost := "localhost"
    rpcPort := 11898
    
    daemon := trpc.TurtleCoind{
        URL: rpcHost,
        Port: rpcPort}
    

    To start the Daemon JSON RPC API server at http://localhost:11898/json_rpc, run:

    TurtleCoind --rpc-bind-port=11898

    To make the server accessible from another computer, use the --rpc-bind-ip 0.0.0.0 switch.

    TurtleCoind --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898

    To enable block explorer API access (like for getblocks, gettransactionpool, etc.), use the --enable_blockexplorer switch.

    TurtleCoind --enable_blockexplorer

    The above given switches can be combined to achieve remote access with block explorer methods as shown below.

    TurtleCoind --enable_blockexplorer --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898

    This would make the RPC server accessible at

    http://<your ip address>:11898/json_rpc

    and, locally at

    http://localhost:11898/json_rpc

    To make a JSON RPC request to your Daemon RPC you should use a POST request that looks like this:

    http://<service address>:<service port>/json_rpc

    Parameter Description
    <service address> IP of Daemon RPC, if it is located on local machine it is either 127.0.0.1 or localhost
    <service port> Daemon RPC port, by default it is bound to 11898 port, but it can be manually bound to any port you want

    getblockcount

    curl -d '{"jsonrpc":"2.0", "method":"getblockcount", "params":{}}' http://localhost:11898/json_rpc
    
    daemon.getBlockCount().then((blockCount) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getBlockCount();
    echo $response;
    
    response = turtlecoind.get_block_count()
    print(response)
    
    response := daemon.GetBlockCount()
    fmt.Println(response)
    

    Expected Output

    {
        "jsonrpc":"2.0",
        "result":{
            "count":560915,
            "status":"OK"
        }
    }
    

    getblockcount() method returns the current chain height.

    No Input.

    Output

    Argument Description Format
    count Current chain height int
    status Status of request string

    getblockhash

    curl -d '{"jsonrpc":"2.0","method":"on_getblockhash","params":[123456]}' http://localhost:11898/json_rpc
    
    daemon.getBlockHash({
      height: 500000
    }).then((blockHash) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $height = 123456;
    $response = $turtlecoind->getBlockHash($height);
    echo $response;
    
    height = 123456
    response = turtlecoind.get_block_hash(height)
    print(response)
    
    height := 123456
    response := daemon.GetBlockHash(height)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":"4bd7d..."
    }
    

    getblockhash() method returns block hash for a given height off by one.

    Input

    Argument Mandatory Description Format
    height Yes The height of the block whose previous hash is to be retrieved. int

    Output

    Argument Description Format
    result Hash of previous block int

    getblocktemplate

    curl -d '{"jsonrpc":"2.0","method":"getblocktemplate","params":{"reserve_size":200,"wallet_address":"TRTLxxxx..."}}' http://localhost:11898/json_rpc
    
    daemon.getBlockTemplate({
      reserveSize: 200,
      walletAddress: 'TRTLv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ'
    }).then((blockTemplate) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $reserveSize = 200;
    $address = 'TRTLxxxx...';
    $response = $turtlecoind->getBlockTemplate($reserveSize, $address);
    echo $response;
    
    reserve_size = 200
    wallet_address = 'TRTLxxxx...'
    
    response = turtlecoind.get_block_template(reserve_size, wallet_address)
    print(response)
    
    reserveSize := 200
    walletAddress := "TRTLxxxx..."
    
    response := daemon.GetBlockTemplate(reserveSize, walletAddress)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc": "2.0",
        "result": {
            "blocktemplate_blob": "0100de...",
            "difficulty": 65563,
            "height": 123456,
            "reserved_offset": 395,
            "status": "OK"
        }
    }
    

    getblocktemplate(reserve_size, addr) method returns blocktemplate with an empty "hole" for nonce.

    Input

    Argument Mandatory Description Format
    reserve_size Yes Size of the reserve to be specified int
    wallet_address Yes Valid TurtleCoin wallet address String

    Output

    Argument Description Format
    blocktempate_blob Blocktemplate with empty "hole" for nonce string
    difficulty Difficulty of the network int
    height Chain height of the network int
    reserved_offset Offset reserved int
    status Status of the network string

    submitblock

    curl -d '{"jsonrpc":"2.0","method":"submitblock","params":["0100b...."]}' https://localhost:11898/json_rpc
    
    daemon.submitBlock({
      blockBlob: '...'
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $blockBlob = '0100b...';
    $response = $turtlecoind->submitBlock($blockBlob);
    echo $response;
    
    block_blob = '0100b...'
    response = turtlecoind.submit_block(block_blob)
    print(response)
    
    blockBlob := "0100b..."
    response := daemon.SubmitBlock(blockBlob)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc": "2.0",
        "result": {
            "status" : "OK"
        }
    }
    

    submitblock(block_blob) method submits mined block.

    Input

    Argument Mandatory Description Format
    block_blob Yes Block blob of the mined block string

    Output

    Argument Description Format
    status Status of request string

    getlastblockheader

    curl -d '{"jsonrpc":"2.0","method":"getlastblockheader","params":{}}' http://localhost:11898/json_rpc
    
    daemon.getLastBlockHeader().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getLastBlockHeader();
    echo $response;
    
    response = turtlecoind.get_last_block_header()
    print(response)
    
    response := daemon.GetLastBlockHeader()
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "block_header":{
                "block_size":86171,
                "depth":0,
                "difficulty":431119113,
                "hash":"b746b...",
                "height":561342,
                "major_version":4,
                "minor_version":0,
                "nonce":715846563,
                "num_txes":4,
                "orphan_status":false,
                "prev_hash":"b8e02...",
                "reward":2930801,
                "timestamp":1529750993
            },
            "status":"OK"
        }
    }
    

    No Input

    Output

    Argument Description Format
    block_size size of the block int
    depth height away from the known top block int
    difficulty difficulty of the last block int
    hash hash of the last block string
    height height of the last block int
    major_version - int
    minor_version - int
    nonce - int
    num_txs Number of transactions in the block int
    orphan_status whether the last block was an orphan or not bool
    prev_hash hash of the previous block string
    reward reward of the block str
    timestamp the time at which the block is occured on chain since Unix epoch int
    status status of the request string

    getblockheaderbyhash

    curl -d '{"jsonrpc":"2.0","method":"getblockheaderbyhash","params":{"hash":"30706..."}}' http://localhost:11898/json_rpc
    
    daemon.getBlockHeaderByHash({
      hash: '7d6db7b77232d41c19d898e81c85ecf08c4e8dfa3434f975a319f6261a695739'
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $hash = '30706...';
    $response = $turtlecoind->getBlockHeaderByHash($hash);
    echo $response;
    
    hash = '30706...'
    response = turtlecoind.get_block_header_by_hash(hash)
    print(response)
    
    hash := "30706..."
    response := daemon.GetBlockHeaderByHash(hash)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "block_header":{
                "block_size":11640,
                "depth":437898,
                "difficulty":70050782,
                "hash":"30706...",
                "height":123456,
                "major_version":3,
                "minor_version":0,
                "nonce":3177228614,
                "num_txes":3,
                "orphan_status":false,
                "prev_hash":"4bd7d...",
                "reward":2969487,
                "timestamp":1516631879
            },
        "status":"OK"
        }
    }
    

    getblockheaderbyhash() returns block header by given block hash

    Input

    Argument Mandatory Description Format
    hash Yes Hash of the block string

    Output

    Argument Description Format
    block_size size of the block int
    depth height away from the known top block int
    difficulty difficulty of the requested block int
    hash hash of the requested block string
    height height of the requested block int
    major_version - int
    minor_version - int
    nonce - int
    num_txs Number of transactions in the block int
    orphan_status whether the requested block was an orphan or not bool
    prev_hash hash of the previous block string
    reward reward of the block str
    timestamp the time at which the block is occured on chain since Unix epoch int
    status status of the request string

    getblockheaderbyheight

    curl -d '{"jsonrpc":"2.0","method":"getblockheaderbyheight","params":{"height":123456}}' http://localhost:11898/json_rpc
    
    daemon.getBlockHeaderByHeight({
      height: 502345
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $height = 123456;
    $response = $turtlecoind->getBlockHeaderByHeight($height);
    echo $response;
    
    height = 123456
    response = turtlecoind.get_block_header_by_height(height)
    print(response)
    
    height := 123456
    response := daemon.GetBlockHeaderByHeight(height)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "block_header":{
                "block_size":11640,
                "depth":437898,
                "difficulty":70050782,
                "hash":"30706...",
                "height":123456,
                "major_version":3,
                "minor_version":0,
                "nonce":3177228614,
                "num_txes":3,
                "orphan_status":false,
                "prev_hash":"4bd7d...",
                "reward":2969487,
                "timestamp":1516631879
            },
        "status":"OK"
        }
    }
    

    getblockheaderbyheight() method returns block header by given block height

    Input

    Argument Mandatory Description Format
    height Yes Height of the block int

    Output

    Argument Description Format
    block_size size of the block int
    depth height away from the known top block int
    difficulty difficulty of the requested block int
    hash hash of the requested block string
    height height of the requested block int
    major_version - int
    minor_version - int
    nonce - int
    num_txs Number of transactions in the block int
    orphan_status whether the requested block was an orphan or not bool
    prev_hash hash of the previous block string
    reward reward of the block str
    timestamp the time at which the block is occured on chain since Unix epoch int
    status status of the request string

    getcurrencyid

    curl -d '{"jsonrpc":"2.0","method":"getcurrencyid","params":{}}' http://localhost:11898/json_rpc
    
    daemon.getCurrencyId().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getCurrencyId();
    echo $response;
    
    response = turtlecoind.get_currency_id()
    print(response)
    
    response := daemon.GetCurrencyID()
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "currency_id_blob":"7fb97..."
        }
    }
    

    getcurrencyid() method returns unique currency identifier.

    No Input

    Output

    Argument Description Format
    currency_id_blob unique currency identifier string

    getblocks

    curl -d '{"jsonrpc":"2.0","method":"f_blocks_list_json","params":{"height":500000}}' http://localhost:11898/json_rpc
    
    daemon.getBlocks({
      height: 500000
    }).then((blocks) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $height = 500000;
    $response = $turtlecoind->getBlocks($height);
    echo $response;
    
    height = 500000
    response = turtlecoind.get_blocks(height)
    print(response)
    
    height := 500000
    response := daemon.GetBlocks(height)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc": "2.0",
        "result": {
            "blocks":[
                {
                    "cumul_size": 22041,
                    "difficulty": 285124963,
                    "hash": "62f00...",
                    "height": 500000,
                    "timestamp": 1527834137,
                    "tx_count": 4
                }
            ],
            "status": "OK"
        }
    }
    

    getblocks() method returns information on the last 30 blocks from height (inclusive)

    Input

    Argument Mandatory Description Format
    height Yes height of the last block to be included in the result. int

    Output

    Argument Description Format
    status status of the request string
    blocks Array of
    cumul_size size of the block int
    difficulty difficulty of the block int
    hash hash of the block string
    height height of the block int
    timestamp the time at which the block is occured on the chain since Unix epoch int
    tx_count number of transactions in the block int

    getblock

    curl -d '{"jsonrpc":"2.0","method":"f_block_json","params":{"hash":"980ff..."}}' http://localhost:11898/json_rpc
    
    daemon.getBlock({
      hash: 'f11580d74134ac34673c74f8da458080aacbe1eccea05b197e9d10bde05139f5'
    }).then((block) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $hash = '980ff...';
    $response = $turtlecoind->getBlock($hash);
    echo $response;
    
    hash = '980ff...'
    response = turtlecoind.get_block(hash)
    print(response)
    
    hash := "980ff..."
    response := daemon.GetBlock(hash)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "block":{
                "alreadyGeneratedCoins":"1659188157030",
                "alreadyGeneratedTransactions":1097221,
                "baseReward":2930784,
                "blockSize":384,
                "depth":1,
                "difficulty":264289473,
                "effectiveSizeMedian":100000,
                "hash":"980ff...",
                "height":561537,
                "major_version":4,
                "minor_version":0,
                "nonce":60779,
                "orphan_status":false,
                "penalty":0.0,
                "prev_hash":"c37f8...",
                "reward":2930784,
                "sizeMedian":265,
                "timestamp":1529757254,
                "totalFeeAmount":0,
                "transactions":[
                    {
                        "amount_out":2930784,
                        "fee":0,
                        "hash":"c0a2d...",
                        "size":265
                    }
                ],
                "transactionsCumulativeSize":265
            },
            "status":"OK"
        }
    }
    

    getblock() method returns information on a single block

    Input

    Argument Mandatory Description Format
    hash Yes hash of the block string

    Output

    Argument Description Format
    alreadyGeneratedCoins total number of coins generated in the network upto that block string
    alreadyGeneratedTransactions total number of transactions present in the network upto that block int
    baseReward calculated reward int
    block_size size of the block int
    depth height away from the known top block int
    difficulty difficulty of the requested block int
    effectiveSizeMedian fixed constant for max size of block int
    hash hash of the requested block string
    height height of the requested block int
    major_version - int
    minor_version - int
    nonce - int
    orphan_status whether the requested block was an orphan or not bool
    penalty penalty in block reward determined for deviation float
    prev_hash hash of the previous block string
    reward total reward of the block after removing penalty str
    sizeMedian calculated median size from last 100 blocks int
    timestamp the time at which the block is occured on chain since Unix epoch int
    totalFeeAmount total fees for the transactions in the block int
    transactions Array of transactions in the block array
    transactionsCumulativeSize total sum of size of all transactions in the block int
    status status of the request string

    Transaction Attributes:

    Argument Description Format
    amount_out output amount of the transaction int
    fee fees for the transaction int
    hash hash of the transaction string
    size size of the transaction int

    gettransaction

    curl -d '{"jsonrpc":"2.0","method":"f_transaction_json","params":{"hash":"702ad..."}}' http://localhost:11898/json_rpc
    
    daemon.getTransaction({
      hash: '702ad5bd04b9eff14b080d508f69a320da1909e989d6c163c18f80ae7a5ab832'
    }).then((transaction) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $hash = '702ad...';
    $response = $turtlecoind->getTransaction($hash);
    echo $response;
    
    hash = '702ad...'
    response = turtlecoind.get_transaction(hash)
    print(response)
    
    hash := "702ad..."
    response := daemon.GetTransaction(hash)
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "block":{
                "cumul_size":22041,
                "difficulty":106780143,
                "hash":"62f00...",
                "height":500000,
                "timestamp":1527834137,
                "tx_count":4
            },
            "status":"OK",
            "tx":{
                "extra":"019e4...",
                "unlock_time":500040,
                "version":1,
                "vin":[
                    {
                        "type":"ff",
                        "value":{
                            "height":500000
                        }
                    }
                ],
                "vout":[
                    {
                        "amount":80,
                        "target":{
                            "data":{
                                "key":"5ce69..."
                            },
                            "type":"02"
                        }
                    }
                ]
            },
            "txDetails":{
                "amount_out":2936280,
                "fee":0,
                "hash":"702ad...",
                "mixin":0,
                "paymentId":"",
                "size":266
            }
        }
    }
    

    gettransaction() method returns information on single transaction.

    Input

    Argument Mandatory Description Format
    hash Yes hash of the transaction string

    Output

    Argument Description Format
    block details of the block in which transaction is present json object
    status status of the request string
    tx sub-transactions in the transaction json object
    txDetails details of the transaction json object

    Block attributes:

    Argument Description Format
    cumul_size size of the block int
    difficulty difficulty of the block int
    hash hash of the block string
    height height of the block int
    timestamp the time at which the block is occured on chain since Unix epoch int
    tx_count number of transactions in the block int

    Transaction Details attributes:

    Argument Description Format
    amount_out total amount present in the transaction int
    fee total fees of the transaction int
    hash hash of the transaction string
    mixin mixin of the transaction int
    paymentId payment Id of the transaction string
    size total size of the transaction int

    Transaction attributes:

    Argument Description Format
    extra Transaction extra which can be any information in hex string
    unlock_time delay in unlocking the amount int
    version - int
    vin array of input transactions array
    vout array of output transactions array

    gettransactionpool

    curl -d '{"jsonrpc":"2.0","method":"f_on_transactions_pool_json","params":{}}' http://localhost:11898/json_rpc
    
    daemon.getTransactionPool().then((transactions) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getTransactionPool();
    echo $response;
    
    response = turtlecoind.get_transaction_pool()
    print(response)
    
    response := daemon.GetTransactionPool()
    fmt.Println(response)
    

    Expected Output:

    {
        "jsonrpc":"2.0",
        "result":{
            "status":"OK",
            "transactions":[
                {
                    "amount_out":8990,
                    "fee":10,
                    "hash":"a5e88...",
                    "size":541
                }
            ]
        }
    }
    

    gettransactionpool() returns the list of transaction hashes present in mempool

    No Input

    Output

    Argument Description Format
    status status of the request string
    transactions array of transactions in mempool array

    Transactions attributes:

    Argument Description Format
    amount_out output amount of the transaction int
    fee fees for the transaction int
    hash hash of the transaction string
    size size of the transaction int

    License

    Creative Commons License

    The content in this document were 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, TurtleCoin 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.

    TurtleCoin developers 2018

    Daemon HTTP RPC API

    Daemon HTTP RPC is a HTTP server which provides additional information regarding Network and Daemon connections.

    Currently we support the following official client bindings:

    composer require turtlecoin/turtlecoin-rpc-php
    
    pip3 install turtlecoin
    
    go get github.com/turtlecoin/turtlecoin-rpc-go
    

    Interacting with the API

    API endpoint example

    http://localhost:11898
    

    Configuration and Instantiation

    const TurtleCoind = require('turtlecoin-rpc').TurtleCoind
    
    const daemon = new TurtleCoind({
      host: '0.0.0.0', // ip address or hostname of the TurtleCoind host
      port: 11898, // what port is the RPC server running on
      timeout: 2000, // request timeout
      ssl: false // whether we need to connect using SSL/TLS
    })
    
    <?php
    use TurtleCoin\TurtleCoind;
    
    $config = [
        'rpcHost' => 'http://localhost',
        'rpcPort' => 11898,
    ];
    
    $turtlecoind = new TurtleCoind($config);
    
    from turtlecoin import TurtleCoind
    
    rpc_host = 'localhost'
    rpc_port = 11898
    turtlecoind = TurtleCoind(rpc_host, rpc_port)
    
    import (
      "fmt"
      trpc "github.com/turtlecoin/turtlecoin-rpc-go"
    )
    
    rpcHost := "localhost"
    rpcPort := 11898
    
    daemon := trpc.TurtleCoind{
      URL: rpcHost,
      Port: rpcPort}
    

    To start the Daemon JSON RPC API server at http://localhost:11898, run:

    TurtleCoind --rpc-bind-port=11898

    To make the server accessible from another computer, use the --rpc-bind-ip 0.0.0.0 switch.

    TurtleCoind --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898

    To enable block explorer API access (like for getblocks, gettransactionpool, etc.), use the --enable_blockexplorer switch.

    TurtleCoind --enable_blockexplorer

    The above given switches can be combined to achieve remote access with block explorer methods as shown below.

    TurtleCoind --enable_blockexplorer --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898

    This would make the RPC server accessible at

    http://<your ip address>:11898

    and, locally at

    http://localhost:11898

    To make a HTTP RPC request to your Daemon RPC you should use a GET request that looks like this:

    http://<service address>:<service port>

    Parameter Description
    <service address> IP of Daemon RPC, if it is located on local machine it is either 127.0.0.1 or localhost
    <service port> Daemon RPC port, by default it is bound to 11898 port, but it can be manually bound to any port you want

    getheight

    curl http://localhost:11898/getheight
    
    daemon.getHeight().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getHeight();
    echo $response;
    
    response = turtlecoind.get_height()
    print(response)
    
    response := daemon.Height()
    fmt.Println(response)
    

    Expected Output:

    {
        "height":614214,
        "network_height":614218,
        "status":"OK"
    }
    

    getheight() returns the height of the daemon and the network

    No Input.

    Output

    Argument Description Format
    height Current daemon height int
    network_height Current Network height int
    status Status of request string

    getinfo

    curl http://localhost:11898/getinfo
    
    daemon.getInfo().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getInfo();
    echo $response;
    
    response = turtlecoind.get_info()
    print(response)
    
    response := daemon.Info()
    fmt.Println(response)
    

    Expected Output:

    {
        "alt_blocks_count":1,
        "difficulty":250340644,
        "grey_peerlist_size":493,
        "hashrate":8344688,
        "height":614321,
        "incoming_connections_count":28,
        "last_known_block_index":614319,
        "major_version":4,
        "minor_version":0,
        "network_height":614321,
        "outgoing_connections_count":8,
        "start_time":1531403048,
        "status":"OK",
        "supported_height":620000,
        "synced":true,
        "testnet":false,
        "tx_count":720189,
        "tx_pool_size":0,
        "upgrade_heights":[
            187000,
            350000,
            440000,
            620000,
            .....
        ],
        "version":"0.6.3",
        "white_peerlist_size":43
    }
    

    getinfo() returns information related to the network and daemon connection

    No Input.

    Output

    Argument Description Format
    alt_blocks_count - int
    difficulty difficulty of the top block int
    gray_peerlist_size - int
    hashrate hashrate of the network int
    height height of the daemon int
    incoming_connections_count number of incoming connections to the daemon int
    last_known_block_index - int
    major_version - int
    minor_version - int
    network_height height of the network int
    outgoing_connections_count number of outgoing connections from the daemon int
    start_time - int
    status Status of request string
    supported_height supported fork height int
    synced sync status bool
    testnet whether the daemon is on testnet or not bool
    tx_count transaction count in the network int
    tx_pool_size - int
    upgrade_heights pre-determined fork heights array
    version version of the daemon string
    white_peerlist_size - int

    gettransactions

    curl http://localhost:11898/gettransactions
    
    daemon.getTransactions({
      hashes: [
        '549828e75151982b0e51b27e8f53b26ebc174f0ef78063984c8952b13e2a3564',
        '549828e75151982b0e51b27e8f53b26ebc174f0ef78063984c8952b13e2a3563'
      ]
    }).then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getTransactions();
    echo $response;
    
    response = turtlecoind.get_transactions()
    print(response)
    
    Not Implemented
    

    Expected Output:

    {
        "missed_tx":[],
        "status":"OK",
        "txs_as_hex":[]
    }
    

    gettransactions() method returns list of missed transactions

    No Input

    Output

    Argument Description Format
    missed_tx array of missed transactions array
    status Status of request string
    txs_as_hex array of hex values of missed transactions array

    getpeers

    curl http://localhost:11898/getpeers
    
    daemon.getPeers().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getPeers();
    echo $response;
    
    response = turtlecoind.get_peers()
    print(response)
    
    response := daemon.Peers()
    fmt.Println(response)
    

    Expected Output:

    {
        "peers":[
            "192.222.157.172:11897",
            "94.23.49.75:11897",
            "112.78.10.43:11897",
            .....
        ],
        "status":"OK"
    }
    

    getpeers() method returns the list of peers connected to the daemon

    No Input.

    Output

    Argument Description Format
    peers array of peers (peer_ip:peer_port) array
    status Status of request string

    feeinfo

    curl http://localhost:11898/feeinfo
    
    daemon.feeInfo().then((result) => {
      // do something
    }).catch((error) => {
      // do something
    })
    
    <?php
    $response = $turtlecoind->getFeeInfo();
    echo $response;
    
    response = turtlecoind.get_fee_info()
    print(response)
    
    response := daemon.Fee()
    fmt.Println(response)
    

    Expected Output:

    {
        "address":"",
        "amount":0,
        "status":"Node's fee address is not set"
    }
    

    feeinfo() method returns information about the fee set for the remote node.

    No Input.

    Output

    Argument Description Format
    address address to which the fee is paid string
    amount fee amount int
    status Status of fees for the node string

    License

    Creative Commons License

    The content in this document were 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, TurtleCoin 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.

    TurtleCoin developers 2018

    RPC Errors

    Here are some common error messages with TurtleCoind and Walletd spit out, why they occured and how to fix them.
    Listed are also some possible alternative errors which they could spit out.

    BAD_ADDRESS / Bad address

    Possible Alternative Error: The supplied address parameter is invalid or in an incorrect format

    Description: This error can happen when an address you supply is invalid, or the address field in your request is improperly formatted.

    Solution: First make sure that the address you are attempting to send to is a valid 99 character long TRTL address, or 236 character integrated address. Next, make sure that your request is properly formatted - for instance, in a SendTransaction request where you are sending from multiple addresses, the address field must be an array of strings, and the address field within the transfers array must be a single string.

    WRONG_AMOUNT / Wrong amount

    Possible Alternative Error: The requested send amount is in an incorrect format, or your wallet does not have enough balance or available inputs to send the requested amount

    Description: This error can happen when the amount you are trying to send within a transaction is above the sum of your available inputs, or is in an incorrect format. This can also occur when you have dust inputs that are unsendable. These generally comprise a very small amount of your balance, but may prevent you from sending all your balance at once.

    Solution: This error can be solved by ensuring that the amount you are attempting to send is valid and within the bounds of your available balance, and that your wallet has been properly optimized/fused.

    MIXIN_COUNT_TOO_BIG / MixIn count is too big

    Possible Alternative Error: I'm not sure if internal node error suggests something else as well, I have seen it only when encountering the mixin too big error.

    Description: The network can't find enough outputs to mix your transaction with.

    Solution: This can be rectified by using zero mixin or lowering the amount you are sending. This is very unlikely to be encountered on mainnet, and is mainly found on testnet.

    NOT_INITIALIZED / Object was not initialized

    Possible Alternative Error:

    Description: -

    Solution: -

    WRONG_PASSWORD / The password is wrong

    Possible Alternative Error: The wallet password is incorrect

    Description: This is a pretty simple one. The wallet password is wrong. If you're 100% sure it's correct, check that you're opening a wallet file, and it's not got corrupted.

    Solution: Enter the correct password! Import via keys if you cannot remember it.

    ALREADY_INITIALIZED / The object is already initialized

    Possible Alternative Error:

    Description: -

    Solution: -

    INTERNAL_WALLET_ERROR / Internal error occurred

    Possible Alternative Error:

    Description: -

    Solution: -

    TRANSACTION_SIZE_TOO_BIG / Transaction size is too big

    Possible Alternative Error: Transaction is too large to fit in a block, try reducing the amount you are sending

    Description: This is caused when the transaction size (in bytes, not amount), is too large to fit into a block. Currently this limit is around 125k bytes, and the size of transactions is based upon how many key images you need to supply for the transaction - each key image comes from a previous transaction, and so if you have lots of small payments, your transactions will need a lot of key images to sum to the desired amount.

    Solution: You can either:
    * Perform fusion transactions, to fuse your small key images into larger ones, letting you send more at once, or
    * Split your one transaction into multiple transactions, until each smaller one can fit into a block. This will slightly raise the fee you have to pay of course.

    SUM_OVERFLOW / Sum overflow

    Possible Alternative Error: Amount + fee would cause integer overflow. Please lower the amount you are sending.

    Description: When sending a transaction, the amount+fee would cause integer overflow. This is very unlikely to occur in practice, as the data type used is a uint64_t.

    Solution: Send a smaller amount in one transaction.

    ZERO_DESTINATION / The destination is empty

    Possible Alternative Error: No destination address specified, or amount specified is zero

    Description: This is caused by either:
    * A transaction amount of zero, or
    * No address was specified to transfer to.

    Solution: Ensure you supply an address parameter in the transfers array, and that the amount is larger than zero.

    TX_CANCEL_IMPOSSIBLE / Impossible to cancel transaction

    Possible Alternative Error:

    Description: -

    Solution: -

    WRONG_STATE / The wallet is in wrong state (maybe loading or saving),try again later

    Possible Alternative Error:

    Description: -

    Solution: -

    OPERATION_CANCELLED / The operation you've requested has been cancelled

    Possible Alternative Error:

    Description: -

    Solution: -

    TX_TRANSFER_IMPOSSIBLE / Transaction transfer impossible

    Possible Alternative Error:

    Description: -

    Solution: -

    WRONG_VERSION / Wrong version

    Possible Alternative Error:

    Description: This is encountered when loading the wallet file with walletd. There are a few possible causes for it: * Your wallet file is the wrong version * The wallet file has got corrupted.

    Solution: Delete the blockchain db, delete the .wallet file, import your keys, and resync from scratch

    FEE_TOO_SMALL / Transaction fee is too small

    Possible Alternative Error: Transaction fee lower than minimum of 0.1 TRTL.

    Description: This occurs if the transaction fee is below the minimum allowed.

    Solution: Make sure the fee used is at least 0.1 TRTL, or 10 in atomic units.

    KEY_GENERATION_ERROR / Cannot generate new key

    Possible Alternative Error:

    Description: -

    Solution: -

    INDEX_OUT_OF_RANGE / Index is out of range

    Possible Alternative Error:

    Description: -

    Solution: -

    ADDRESS_ALREADY_EXISTS / Address already exists

    Possible Alternative Error: The address you are trying to create already exists in this wallet.

    Description: The address you are trying to add with createAddress() already exists.

    Solution: Um, address already exists, so don't do that? If you just want a new random address, don't supply the view/spend key parameter, and it will generate a random one.

    TRACKING_MODE / The wallet is in tracking mode

    Possible Alternative Error: This method is not usable in a view only wallet.

    Description: This error occurs when you are using a view only wallet (A tracking wallet), and call a method that can only be used with wallets that can spend, such as sendTransaction().

    Solution: Don't use methods which require spending with a view only wallet.

    WRONG_PARAMETERS / Wrong parameters passed

    Possible Alternative Error: Individual errors for each specific issue.

    Description: This error can occur in a number of scenarios.
    * A supplied private/public key is invalid/cannot be parsed.
    * A spend key was specified to createAddress in a view only wallet, or a null spend key was specified in a non view only wallet
    * The blocks count given is less than 1
    * The blockindex given is less than 1

    For more info on the exact error, check your walletd.log or console window.

    Solution: Check the api-docs for examples on how to use the method you are toying with, to help determine what parameter is invalid.

    OBJECT_NOT_FOUND / Object not found

    Possible Alternative Error:

    Description: -

    Solution: -

    WALLET_NOT_FOUND / Requested wallet not found

    Possible Alternative Error: Wallet address could not be found in the wallet container.

    Description: The wallet address you are trying to retrieve the balance of does not exist in your wallet container.

    Solution: Ensure you are checking the balance of a wallet that exists in your container.

    CHANGE_ADDRESS_REQUIRED / Change address required

    Possible Alternative Error: No change address given with a multi address wallet.

    Description: This occurs when you omit the change address parameter in a transaction. This is not required in a single address wallet, but if multiple addresses have been added to a wallet container, then the change address is required. Generally, you will want this value to be the same as the address you are sending from.

    Solution: Include a change address with your requests to allow your code to work with single and multi address wallets.

    CHANGE_ADDRESS_NOT_FOUND / Change address not found

    Possible Alternative Error: Change address is not present in your wallet container.

    Description: This occurs when the address you specified in the change address parameter is not a wallet that exists in your wallet container file.

    Solution: Make sure you set the change address value to a wallet address that exists in your container.

    DESTINATION_ADDRESS_REQUIRED / Destination address required

    Possible Alternative Error: No destination address given with a multi address wallet.

    Description: This occurs when you omit the destination address parameter in a fusion transaction. This is not required in a single address wallet, but if multiple addresses have been added to a wallet container, then the destination address is required. Generally, you will want this value to be the same as the address you are sending from.

    Solution: Include a destination address with your fusion transactions to allow your code to work with single and multi address wallets.

    DESTINATION_ADDRESS_NOT_FOUND / Destination address not found

    Possible Alternative Error: Destination address is not present in your wallet container.

    Description: This occurs when the address you specified in the destination address parameter is not a wallet that exists in your wallet container file.

    Solution: Make sure you set the destination address value to a wallet address that exists in your container.

    BAD_PAYMENT_ID / Wrong payment id format

    Possible Alternative Error: Payment ID is not 64 characters or is not a valid hex string.

    Description: Your payment ID is not a valid, 64 char hex string.

    Solution: Ensure you are correctly generating payment ID's. They should contain only a-z 0-9 characters, and be 64 characters long.

    BAD_TRANSACTION_EXTRA / Wrong transaction extra format

    Possible Alternative Error: Transaction extra is not a valid hex string.

    Description: This occurs when your transaction extra is not hex encoded data.

    Solution: Your transaction extra should only contain a-z 0-9 characters.

    MIXIN_ABOVE_THRESHOLD / Mixin above maximum allowed threshold

    Possible Alternative Error: Mixin is above maximum allowed threshold of <x>

    Description: This occurs when your anonymity value is above the maximum allowed. You can check the current mixin limits by viewing their values in CryptoNoteConfig.h. Currently, the maximum allowed mixin is 100. This will change to 7 at block 620k.

    Solution: Make sure your anonymity value is within the allowed limits.

    MIXIN_BELOW_THRESHOLD / Mixin below minimum allowed threshold

    Possible Alternative Error: Mixin is below minimum allowed threshold of <x>

    Description: This occurs when your anonymity value is above the minimum allowed. You can check the current mixin limits by viewing their values in CryptoNoteConfig.h. Currently, the minimum allowed mixin is 0. This will change to 7 at block 620k.

    Solution: Make sure your anonymity value is withing the allowed limits.

    CONFLICTING_PAYMENT_IDS / Multiple conflicting payment ID's werespecified via the use of integrated addresses

    Possible Alternative Error:

    Description: When using integrated addresses, if a payment ID is specified, it must match the payment ID included in the integrated address. Furthermore, if multiple integrated addresses are used, they must all have the same payment ID.

    Solution: Only send to one integrated address at once, and don't include a payment ID, to avoid confusion.

    Turtlecoind Errors
    * https://github.com/turtlecoin/turtlecoin/blob/master/src/NodeRpcProxy/NodeErrors.h
    * https://github.com/turtlecoin/turtlecoin/blob/master/src/InProcessNode/InProcessNodeErros.h

    NOT_INITIALIZED / Object was not initialized

    Possible Alternative Error:

    Description: -

    Solution: -

    ALREADY_INITIALIZED / Object has been already initialized

    Possible Alternative Error:

    Description: -

    Solution: -

    NETWORK_ERROR / Network error

    Possible Alternative Error:

    Description: TurtleCoind is not open / not responding.

    Solution: I'm not sure if you can experience this with walletd, I have seen it with walletgreen.

    NODE_BUSY / Node is busy

    Possible Alternative Error:

    Description: -

    Solution: -

    INTERNAL_NODE_ERROR / Internal node error

    Possible Alternative Error:

    Description: -

    Solution: -

    REQUEST_ERROR / Error in request parameters

    Possible Alternative Error:

    Description: -

    Solution: -

    CONNECT_ERROR / Can't connect to daemon

    Possible Alternative Error:

    Description: -

    Solution: -