To query the Balance of a specific Address you can use the REQUEST_ENTITY
with type 31
unsigned char publicKey[32];
: PublicKey of the Address you want to get balanceRESPOND_ENTITY
struct Entity
{
unsigned char publicKey[32];
long long incomingAmount, outgoingAmount;
unsigned int numberOfIncomingTransfers, numberOfOutgoingTransfers;
unsigned int latestIncomingTransferTick, latestOutgoingTransferTick;
};
typedef struct
{
::Entity entity;
unsigned int tick;
int spectrumIndex;
unsigned char siblings[SPECTRUM_DEPTH][32];
} RespondedEntity;
publicKey
: Address/IdincomingAmount
: Amount of incoming $QUBIC’s for given AddressoutgoingAmount
: Amount of incoming $QUBIC’s for given AddressnumberOfIncomingTransfers
: Amount of incoming Transactions for given AddressnumberOfOutgoingTransfers
: Amount of incoming Transactions for given AddresslatestIncomingTransferTick
: Tick for the last incoming TransactionlatestOutgoingTransferTick
: Tick for the last outgoing Transactiontick
: For which Tick this Report is validspectrumIndex
: Position of Entity in Spectrum[!NOTE] To get current Balance for the given Address substract
outgoingAmount
fromincomingAmount
[!NOTE] Keep track of
tick
in your application. Don’t update Balance if responded tick is lower than existing.
[!WARNING] A manipulated node may report wrong information. Only use trusted Peers!