XTE and XTCASH documentation

XTE and XTCASH documentation

  • Getting Started
  • About
  • FAQ
  • Guides
  • For Developers

›API Documentation

For Developers

  • Developer Resources
  • Local Testnet
  • API Documentation

    • Daemon JSON RPC API
    • Daemon HTTP RPC API
    • Wallet RPC API
    • XTEservice Wallet RPC API
    • RPC Errors
Edit

XTEservice Wallet RPC API

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

Currently we support the following official client bindings:

  • PHP
  • Python
  • Go

Note: It is suggested to use wallet-api for new applications.

Installation

PHP
Python
Go
composer require trrxitte/traaittcash-rpc-php
pip3 install traaittcash
go get github.com/trrxitte/traaittcash-rpc-go

Interacting with the API

API endpoint example

http://localhost:8440/json_rpc

Configuration and instantiation

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

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

ParameterDescription
<service address>IP of traaittXTCASH RPC Wallet, if RPC Wallet is located on local machine it is either 127.0.0.1 or localhost
<service port>traaittXTCASH RPC Wallet port, by default it is bound to 8440 port, but it can be manually bound to any port you want
PHP
Python
Go
<?php
use traaittXTCASH\XTCASHservice;

$config = [
'rpcHost' => 'http://localhost',
'rpcPort' => 8440,
'rpcPassword' => 'passw0rd',
];

$XTCASHservice = new XTCASHservice($config);
from traaittcash import Walletd

rpc_host = 'localhost'
rpc_port = 8440
rpc_password = 'passw0rd'

walletd = Walletd(rpc_password, rpc_host, rpc_port)
import (
"fmt"
trpc "github.com/traaittcash/traaittcash-rpc-go"
)

rpcHost := "localhost"
rpcPort := 8440
rpcPassword := "passw0rd"

service := trpc.Walletd{
URL: rpcHost,
Port: rpcPort,
RPCPassword: rpcPassword}

reset

reset() method allows you to re-sync your wallet.

Input

ArgumentMandatoryDescriptionFormat
scanHeightNoThe height to begin scanning for transactions at. This can greatly speed up wallet syncing time.int
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"reset","params":{"scanHeight":100000}}' http://localhost:8440/json_rpc
<?php
$scanHeight = 100000;
$response = $XTCASHservice->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":{}
}

No output in case of success.

Note: If the viewSecretKey argument is not provided, the reset() method resets the wallet and re-syncs it. If the viewSecretKey argument is provided, the reset() method substitutes the existing wallet with a new one with the specified key.

save

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

No input. No output in case of success.

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"save","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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":{}
}

getViewKey

getViewKey() method returns your view key.

No input.

Output

ArgumentDescriptionFormat
viewSecretKeyPrivate view keystring
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getViewKey","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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..."
  }
}

getSpendKeys

getSpendKeys() method returns your spend keys.

Input

ArgumentMandatoryDescriptionFormat
addressYesValid address that exists in this containerstring

Output

ArgumentDescriptionFormat
spendSecretKeyPrivate spend keystring
spendPublicKeyPublic spend keystring
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getSpendKeys","params":{"address":"cashxxxx..."}}' http://localhost:8440/json_rpc
<?php
$address = 'cashxxxx...';
$response = $XTCASHservice->getSpendKeys($address);
echo $response;
address = 'cashxxxx...'
response = walletd.get_spend_keys(address)
print(response)
address := "cashxxxx..."
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..."
  }
}

getMnemonicSeed

getMnemonicSeed() method returns the mnemonic seed for the given deterministic address. A mnemonic seed is a list of words which can be used to recover a wallet.

Input

ArgumentMandatoryDescriptionFormat
addressYesValid deterministic address that exists in this containerstring

Output

ArgumentDescriptionFormat
mnemonicSeedMnemonic seedstring

Note: The first wallet address that is generated when the container is created is the deterministic address. Only one wallet from a multi-wallet container can be deterministic. If a non-deterministic address is given, the RPC response will be an error with the message: "Keys not deterministic."

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getMnemonicSeed","params":{"address":"cashxxxx..."}}' http://localhost:8440/json_rpc
<?php
$address = 'cashxxxx...';
$response = $XTCASHservice->getMnemonicSeed($address);
echo $response;
address = 'cashxxx...'
response = walletd.get_mnemonic_seed(address)
print(response)
address := "cashxxxx..."
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..."
  }
}

getStatus

getStatus() method returns information about the current RPC Wallet state: block count, known block count, last block hash and peer count.

No input.

Output

ArgumentDescriptionFormat
blockCountNode's known number of blocksint
knownBlockCountMaximum known number of blocks of all seeds that are connected to the nodeint
lastBlockHashHash of the last known blockstring
peerCountConnected peers numberint
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getStatus","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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
  }
}

getAddresses

getAddresses() method returns an array of your RPC Wallet's addresses.

No input.

Output

ArgumentDescriptionFormat
addressesArray of strings, where each string is an addressarray
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getAddresses","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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":[
      "cashxxxx...",
      "cashxxxx..."
    ]
  }
}

createAddress

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

Input

ArgumentMandatoryDescriptionFormat
spendSecretKeyNoPrivate spend key. If spendSecretKey was specified, RPC Wallet creates spend addressstring
spendPublicKeyNoPublic spend key. If spendPublicKey was specified, RPC Wallet creates view addressstring
newAddressNoIs 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
scanHeightNoThe 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
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createAddress","params":{}}' http://localhost:8440/json_rpc
<?php
$spendSecretKey = null;
$spendPublicKey = null;
$response = $XTCASHservice->createAddress($spendSecretKey, $spendPublicKey);
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":"cashxxxx..."
  }
}

deleteAddress

deleteAddress() method deletes a specified address.

Input

ArgumentMandatoryDescriptionFormat
addressYesAn address to be deletedstring

Output

In case of success returns an empty JSON object.

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"deleteAddress","params":{"address":"cashxxxx..."}}' http://localhost:8440/json_rpc
<?php
$address = 'cashxxxx...';
$response = $XTCASHservice->deleteAddress($address);
echo $response;
address = 'cashxxxx...'
response = walletd.delete_address(address)

# If the delete was successful, response will be True
print(response)
address := "cashxxxx..."
response, err := service.DeleteAddress(address)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(response)
}

Expected Output:

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

getBalance

getBalance() method returns a balance for a specified address.

Input

ArgumentMandatoryDescriptionFormat
addressNoValid address that exists in this containerstring

Output

ArgumentDescriptionFormat
availableBalanceAvailable balance of the specified address in shellsint
lockedAmountLocked amount of the specified address in shellsint

Note: If an address is not specified, getBalance() returns a cumulative balance of all RPC Wallet's addresses.

Note: Balances are expressed in shells, so a balance of 10000 is equal to 100.00 TRTL

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getBalance","params":{"address":"cashxxxx..."}}' http://localhost:8440/json_rpc
<?php
$address = 'cashxxxx...';
$response = $XTCASHservice->getBalance($address);
echo $response;
address = 'cashxxxx...'
response = walletd.get_balance(address)
print(response)
address := "cashxxxx..."
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
  }
}

getBlockHashes

getBlockHashes() method returns an array of block hashes for a specified block range.

Input

ArgumentMandatoryDescriptionFormat
firstBlockIndexYesStarting heightint
blockCountYesNumber of blocks to processint

Output

ArgumentDescriptionFormat
blockHashesArray of strings, where each element is a block hasharray
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getBlockHashes","params":{"firstBlockIndex":0,"blockCount":3}}' http://localhost:8440/json_rpc
<?php
$firstBlockIndex = 0;
$blockCount = 3;
$response = $XTCASHservice->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..."
    ]
  }
}

getTransactionHashes

getTransactionHashes() method returns an array of block and transaction hashes. A transaction consists of transfers. A transfer is an amount-address pair. There could be several transfers in a single transaction.

Input

ArgumentMandatoryDescriptionFormat
addressesNoArray of strings, where each string is an addressarray
blockHashOnly one of these parameters (blockHash or firstBlockIndex) is allowedHash of the starting blockstring
firstBlockIndexOnly one of these parameters (blockHash or firstBlockIndex) is allowedStarting heightint
blockCountYesNumber of blocks to return transaction hashes fromint
paymentIdNoValid payment ID (64char hex string)string
  • If paymentId parameter is set, getTransactionHashes() method returns transaction hashes of transactions that contain specified payment ID in the given block range.
  • If addresses parameter is set, getTransactionHashes() method returns transaction hashes of transactions that contain transfer from at least one of specified addresses.
  • If both above mentioned parameters are set, getTransactionHashes() method returns transaction hashes of transactions that contain both specified payment ID and transfer from at least one of specified addresses.

Output

ArgumentDescription
itemsArray of
AttributeDescriptionFormat
blockHashHash of the block which contains transaction hashesstring
transactionHashesArray of strings, where each string is a transaction hasharray
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransactionHashes","params":{"firstBlockIndex":400000,"blockCount":100000}}' http://localhost:8440/json_rpc
<?php
$blockCount = 100000;
$firstBlockIndex = 400000;
$blockHash = null;
$addresses = null;
$paymentId = null;

$response = $XTCASHservice->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{"cashxxxx..."}
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..."]
      }
    ]
  }
}

getTransactions

getTransactions() method returns an array of block and transaction hashes. A transaction consists of transfers. A transfer is an amount-address pair. There could be several transfers in a single transaction.

Input

ArgumentMandatoryDescriptionFormat
addressesNoArray of strings, where each string is an addressarray
blockHashOnly one of these parameters (blockHash or firstBlockIndex) is allowed.Hash of the starting blockstring
firstBlockIndexOnly one of these parameters (blockHash or firstBlockIndex) is allowed.Starting height >0 (1,2,3...)int
blockCountYesNumber of blocks to return transaction hashes fromint
paymentIdNoValid payment ID (64char hex string)string
  • If paymentId parameter is set, getTransactions() method returns transactions that contain specified payment ID in the given block range.
  • If addresses parameter is set, getTransactions() method returns transactions that contain transfer from at least one of specified addresses.
  • If both above mentioned parameters are set, getTransactions() method returns transactions that contain both specified payment ID and transfer from at least one of specified addresses.

Output

ArgumentDescriptionFormat
itemsArray of
block_hashhash of the block which contains a transactionstring
transactionssee belowarray

Transaction attributes:

ArgumentDescriptionFormat
transactionHashHash of the transactionstring
blockIndexNumber of the block that contains a transactionint
timestampTimestamp of the transactionint
isBaseShows if the transaction is a CoinBase transaction or notboolean
unlockTimeHeight of the block when transaction is going to be available for spendingint
amountAmount of the transactionint
feeTransaction feeint
extraHash of the transactionstring
paymentIdPayment ID of the transaction (optional) (64char hex string)string
transfersArray of address (string), amount (int)array
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransactions","params":{"firstBlockIndex":400000,"blockCount":100000}}' http://localhost:8440/json_rpc
<?php
$blockCount = 100000;
$firstBlockIndex = 400000;
$blockHash = null;
$addresses = null;
$paymentId = null;

$response = $XTCASHservice->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{"cashxxxx..."}
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":"cashxxxx...","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":"cashxxxx...","amount":5000,"type":0},
              {"address":"","amount":-8000,"type":0},
              {"address":"","amount":2990,"type":0}
            ],
            "unlockTime":0
          }
        ]
      }
    ]
  }
}

getUnconfirmedTransactionHashes

getUnconfirmedTransactionHashes() method returns information about the current unconfirmed transaction pool or for a specified addresses.

Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.

Input

ArgumentMandatoryDescriptionFormat
addressesNoArray of strings, where each string is a valid addressarray

Note: If addresses parameter is set, transactions that contain transfer from at least one of specified addresses are returned.

Output

ArgumentDescriptionFormat
transactionHashesArray of strings, where each string is a hash of an unconfirmed transactionarray
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getUnconfirmedTransactionHashes","params":{}}' http://localhost:8440/json_rpc
<?php
$addresses = null;
$response = $XTCASHservice->getUnconfirmedTransactionHashes($addresses);
echo $response;
addresses = []
response = walletd.get_unconfirmed_transaction_hashes(addresses)
print(response)
addresses := []string{"cashxxxx..."}
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..."
    ]
  }
}

getTransaction

getTransaction() method returns information about a particular transaction.

Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.

Input

ArgumentMandatoryDescriptionFormat
transactionHashYesHash of the requested transactionstring

Output

ArgumentDescription
transactionsee below

Transaction attributes:

ArgumentDescriptionFormat
transactionHashHash of the transactionstring
blockIndexNumber of the block that contains a transactionint
timestampTimestamp of the transactionint
isBaseShows if the transaction is a CoinBase transaction or notboolean
unlockTimeHeight of the block when transaction is going to be available for spendingint
amountAmount of the transactionint
feeTransaction feeint
extraHash of the transactionstring
paymentIdPayment ID of the transaction (optional) (64char hex string)string
transfersArray of addresses (string), amount (int)array
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getTransaction","params":{"transactionHash":"55a23..."}}' http://localhost:8440/json_rpc
<?php
$transactionHash = '55a23...';
$response = $XTCASHservice->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":"cashxxxx...","amount":5000,"type":0},
        {"address":"","amount":-10000,"type":0},
        {"address":"","amount":4990,"type":0}
      ],
      "unlockTime":0
    }
  }
}

sendTransaction

sendTransaction() method allows you to send transaction(s) to one or several addresses. Also, it allows you to use a payment ID for a transaction to a single address.

Input

ArgumentMandatoryDescriptionFormat
addressesNoArray of strings, where each string is an address to take the funds fromarray
transfersYesArray of objects, address: (string address), amount: (int amount)array
feeNoTransaction fee. Should be given in atomic units. Leave blank to use the minimum fee possible.int
feePerByteNoFee to pay per byte of the transaction. Should be given in atomic units. If given, should be greater than 1.953125, the minimum network fee per byte.float
unlockTimeNoThe block height at which the transaction will be unlocked for spending.int
anonymityYesPrivacy (mixin) level from block 800,000 three (3)int
extraNoString of variable length. Can contain A-Z, 0-9 characters.string
paymentIdNoPayment ID (64char hex string)string
changeAddressNoValid and existing address in this container.string
  • If container contains only 1 address, changeAddress field can be left empty and the change is going to be sent to this address.
  • If addresses field contains only 1 address, changeAddress can be left empty and the change is going to be sent to this address.
  • In the rest of the cases, changeAddress field is mandatory and must contain an address.

Output

ArgumentDescriptionFormat
transactionHashHash of the sent transactionstring
feeThe fee of the send transactionint
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendTransaction","params":{"transfers":[{"address":"cashxxxx...","amount":5000}],"anonymity":3,"changeAddress":"cashyyyy..."}}' http://localhost:8440/json_rpc
<?php
$anonymity = 3;
$fee = 243000;
$addresses = null;
$unlockTime = null;
$extra = null;
$paymentId = null;
$changeAddress = 'cashyyyy...';

$transfers = [
["address" => "cashxxxx...", "amount" => 5000],
];

$response = $XTCASHservice->sendTransaction(
$anonymity, $transfers, $fee, $addresses, $unlockTime, $extra, $paymentId, $changeAddress
);

echo $response;
anonymity = 3
fee = 243000
addresses = []
unlock_time = 0
extra = ''
payment_id = ''
change_address = 'cashyyyy...'

transfers = [
{"address" : "cashxxxx...", "amount" : 5000},
]

response = walletd.send_transaction(
transfers, anonymity, fee, addresses, change_address, extra, payment_id, unlock_time
)
print(response)
addresses := []string{"cashyyyy..."} // can be empty
unlockTime := 0
extra := ""
paymentID := ""
fee := 243000
changeAddress := "cashyyyy..."

transfers := []map[string]interface{}{
{
"address" : "cashxxxx...",
"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...",
    "fee": 4500
  }
}

createDelayedTransaction

createDelayedTransaction() method creates a delayed transaction. Such transactions are not sent into the network automatically and should be pushed using sendDelayedTransaction method.

Input

ArgumentMandatoryDescriptionFormat
addressesNoArray of strings, where each string is an addressarray
transfersYesArray of address (string), amount (int)array
feeNoTransaction fee. Should be given in atomic units. Leave blank to use the minimum fee possible.int
feePerByteNoFee to pay per byte of the transaction. Should be given in atomic units. If given, should be greater than 1.953125, the minimum network fee per byte.float
unlockTimeNoHeight of the block until which transaction is going to be locked for spending.int
anonymityYesPrivacy (mixin) level from block 800,000 three (3)int
extraNoString of variable length. Can contain A-Z, 0-9 characters.string
paymentIdNoPayment ID (64char hex string)string
changeAddressNoValid and existing in this container address.string
  • If container contains only 1 address, changeAddress field can be left empty and the change is going to be sent to this address
  • If addresses field contains only 1 address, changeAddress can be left empty and the change is going to be sent to this address
  • In the rest of the cases, changeAddress field is mandatory and must contain an address.
  • Outputs that were used for this transactions will be locked until the transaction is sent or cancelled

Output

ArgumentDescriptionFormat
transactionHashHash of the sent transactionstring
feeThe fee of the send transactionint
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createDelayedTransaction","params":{"transfers":[{"address":"cashxxxx...","amount":5000}],"anonymity":3,"changeAddress":"cashyyyy..."}}' http://localhost:8440/json_rpc
<?php
$anonymity = 3;
$fee = 243000;
$addresses = null;
$unlockTime = null;
$extra = null;
$paymentId = null;
$changeAddress = 'cashyyyy...';

$transfers = [
["address" => "cashxxxx...", "amount" => 5000],
];

$response = $XTCASHservice->createDelayedTransaction(
$anonymity, $transfers, $fee, $addresses, $unlockTime, $extra, $paymentId, $changeAddress
);

echo $response;
anonymity = 3
fee = 243000
addresses = []
unlock_time = 0
extra = ''
payment_id = ''
change_address = 'cashyyyy...'

transfers = [
{"address" : "cashxxxx...", "amount" : 5000},
]

response = walletd.create_delayed_transaction(
transfers, anonymity, fee, addresses, change_address, extra, payment_id, unlock_time
)
print(response)
addresses := []string{"cashyyyy..."} // can be empty
unlockTime := 0
extra := ""
paymentID := ""
fee := 243000
changeAddress := "cashyyyy..."

transfers := []map[string]interface{}{
{
"address" : "cashxxxx...",
"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...",
    "fee": 4500
  }
}

getDelayedTransactionHashes

getDelayedTransactionHashes() method returns hashes of delayed transactions.

No input.

Output

ArgumentDescriptionFormat
transactionHashesArray of strings, where each string is a transaction hasharray
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getDelayedTransactionHashes","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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..."]
  }
}

deleteDelayedTransaction

deleteDelayedTransaction() method deletes a specified delayed transaction.

Input

ArgumentMandatoryDescriptionFormat
transactionHashYesValid, existing delayed transactionstring

Output

In case of success returns an empty JSON object.

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"deleteDelayedTransaction","params":{"transactionHash":"b3e37..."}}' http://localhost:8440/json_rpc
<?php
$transactionHash = 'b3e37...';
$response = $XTCASHservice->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":{}
}

sendDelayedTransaction

sendDelayedTransaction() method sends a specified delayed transaction.

Input

ArgumentMandatoryDescriptionFormat
transactionHashYesValid, existing delayed transactionstring

Output

In case of success returns an empty JSON object.

Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendDelayedTransaction","params":{"transactionHash":"c37cd..."}}' http://localhost:8440/json_rpc
<?php
$transactionHash = 'c37cd...';
$response = $XTCASHservice->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":{}
}

sendFusionTransaction

sendFusionTransaction() method allows you to send a fusion transaction, by taking funds from selected addresses and transferring them to the destination address. If there aren't any outputs that can be optimized, sendFusionTransaction() will return an error. You can use estimateFusion to check the outputs, available for the optimization.

Input

ArgumentMandatoryDescriptionFormat
thresholdYesValue that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction.int
anonymityYesPrivacy (mixin) level from block 800,000 three (3)int
addressesNoArray of strings, where each string is an address to take the funds from.array
destinationAddressNoAn address that the optimized funds will be sent to. Valid and existing in this container address.string
  • If container contains only 1 address, destinationAddress field can be left empty and the funds are going to be sent to this address.
  • If addresses field contains only 1 address, destinationAddress can be left empty and the funds are going to be sent to this address.
  • In the rest of the cases, destinationAddress field is mandatory and must contain an address.

Output

ArgumentDescriptionFormat
transactionHashHash of the sent transactionstring
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"sendFusionTransaction","params":{"threshold":1000000,"anonymity":3,"addresses":["cashxxxx...","cashyyyy..."],"destinationAddress":"cashzzzz..."}}' http://localhost:8440/json_rpc
<?php
$threshold = 1000000;
$anonymity = 3;
$addresses = ['cashxxxx...', 'cashyyyy...'];
$destinationAddress = 'cashzzzz...';
$response = $XTCASHservice->sendFusionTransaction($threshold, $anonymity, $addresses, $destinationAddress);

echo $response;
threshold = 1000000
anonymity = 3
addresses = ['cashxxxx...', 'cashyyyy...']
destination_address = 'cashzzzz...'
response = walletd.send_fusion_transaction(threshold, anonymity, addresses, destination_address)

print(response)
threshold := 1000000
addresses := []string{"cashxxxx...", "cashyyyy..."}
destinationAddress := "cashzzzz..."
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..."
  }
}

estimateFusion

estimateFusion() method counts the number of unspent outputs of the specified addresses and returns how many of those outputs can be optimized. This method is used to understand if a fusion transaction can be created. If fusionReadyCount returns a value = 0, then a fusion transaction cannot be created.

Input

ArgumentMandatoryDescriptionFormat
thresholdYesValue that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction.int
addressesNoArray of strings, where each string is an address to take the funds from.string

Output

ArgumentDescriptionFormat
totalOutputCountTotal number of unspent outputs of the specified addresses.int
fusionReadyCountNumber of outputs that can be optimized.int
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"estimateFusion","params":{"threshold":1000000,"addresses":["cashxxxx...","cashyyyy..."]}}' http://localhost:8440/json_rpc
<?php
$threshold = 1000000;
$addresses = ['cashxxxx...', 'cashyyyy...'];
$response = $XTCASHservice->estimateFusion($threshold, $addresses);

echo $response;
threshold = 1000000
addresses = ['cashxxxx...', 'cashyyyy...']
response = walletd.estimate_fusion(threshold, addresses)
print(response)
threshold := 1000000
addresses := []string{"cashxxxx...","cashyyyy..."}
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
  }
}

createIntegratedAddress

createIntegratedAddress() method allows you to create a combined address, containing a standard address and a paymentId, to be used in sendTransaction() or for supplying to a user, instead of using an address and paymentId as separate parameters. This is helpful to ensure users cannot forget to supply a payment Id.

Input

ArgumentMandatoryDescriptionFormat
addressYesA valid addressstring
paymentIdYesA valid paymentId (64char hex string)string

Output

ArgumentDescriptionFormat
integratedAddressThe created integrated addressstring
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"createIntegratedAddress","params":{"paymentId":"7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F", "address":"cashxxxx..."}}' http://localhost:8440/json_rpc
<?php
$address = 'cashxxxx...';
$paymentId = '7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F';
$response = $XTCASHservice->createIntegratedAddress($address, $paymentId);

echo $response;
address = 'cashxxxx...'
payment_id = '7FE73BD90EF05DEA0B5C15FC78696619C50DD5F2BA628F2FD16A2E3445B1922F'
response = walletd.create_integrated_address(address, payment_id)
print(response)
address := "cashxxxx..."
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": "cashxxx..."
  }
}

getFeeInfo

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

ArgumentDescriptionFormat
addressThe address of the node ownerstring
amountThe fee that will be sent to the node owners address with each transactionint
Shell
PHP
Python
Go
curl -d '{"jsonrpc":"2.0","id":1,"password":"passw0rd","method":"getFeeInfo","params":{}}' http://localhost:8440/json_rpc
<?php
$response = $XTCASHservice->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": "cashxxx...",
    "amount": 5000
  }
}

License

Creative Commons License

The content in this document was originally written by the Bytecoin (BCN) Developers. It is licensed under the CC BY SA 3.0 license. The source material can be found at the Bytecoin Wiki.

TRRXITTE Int., incorporate and 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.

Last updated on 4.7.2024
← Wallet RPC APIRPC Errors →
  • Note: It is suggested to use wallet-api for new applications.
  • Installation
  • Interacting with the API
    • API endpoint example
    • Configuration and instantiation
  • reset
  • save
  • getViewKey
  • getSpendKeys
  • getMnemonicSeed
  • getStatus
  • getAddresses
  • createAddress
  • deleteAddress
  • getBalance
  • getBlockHashes
  • getTransactionHashes
  • getTransactions
  • getUnconfirmedTransactionHashes
  • getTransaction
  • sendTransaction
  • createDelayedTransaction
  • getDelayedTransactionHashes
  • deleteDelayedTransaction
  • sendDelayedTransaction
  • sendFusionTransaction
  • estimateFusion
  • createIntegratedAddress
  • getFeeInfo
  • License
XTE and XTCASH documentation
Docs
Getting StartedAboutGuidesDeveloper Resources
Community
Generalx.com
More
GitHubStar
Copyright © 2024 TRRXITTE Int., incorporate
Docs released under the MIT License
cryptocurrencies released under the GNU General Public V3 License