Home Reference Source

Function

Static Public Summary
public

broadcastTransaction(signedTransactionPayload: *): *

Broadcasts a transaction to the network/blockchain

public

compose(settings: ApiSettings): {"block": *, "network": *, "transaction": *, "message": *}

Composes the API, i.e.

public

decryptAES(encryptedBase64: *, key: *): *

Decrypt an encrypted message

public

generateMasterKeys(passPhrase: *): *

Generate the Master Public Key and Master Private Key for a new passphrase

public

generateSignature(messageHex: *, privateKey: *): *

Generate a signature for the transaction

public

generateSignedTransactionBytes(unsignedTransactionHex: *, signature: *): *

Generates a signed message digest

public

getAccountIdFromPublicKey(publicKey: *): *

Convert hex string of the public key to the account id

public

getBlockByHeight(height: *, includeTransactions: *): *

Get a block by given height

public

getBlockById(id: *, includeTransactions: *): *

Get a block by given id

public

getBlockByTimestamp(timestamp: *, includeTransactions: *): *

Get a block by given timestamp

public

getBlockId(height: number): Promise<BlockId>

Get a block id by given height

public

getBlockchainStatus(service: *): *

Get the blockchain status.

public

getServerStatus(service: *): *

Get the state of the server node and network

public

getTransaction(transactionId: *): *

Get a transaction from the network/blockchain

public

sendTextMessage(message: *, recipientId: *, senderPublicKey: *, senderPrivateKey: *, fee: *): *

Broadcasts a text message to the network/blockchain

public

verifySignature(signature: *, messageHex: *, publicKey: *): *

Verify a signature for given message

Static Public

public broadcastTransaction(signedTransactionPayload: *): * source

import {broadcastTransaction} from '@burstjs/core/api'

Broadcasts a transaction to the network/blockchain

Params:

NameTypeAttributeDescription
signedTransactionPayload *

The signed transaction payload encoded in base64

Return:

*

The Transaction Id

public compose(settings: ApiSettings): {"block": *, "network": *, "transaction": *, "message": *} source

import {compose} from '@burstjs/core/api'

Composes the API, i.e. setup the environment and mounts the API structure with its functions.

Params:

NameTypeAttributeDescription
settings ApiSettings

Return:

{"block": *, "network": *, "transaction": *, "message": *}

public decryptAES(encryptedBase64: *, key: *): * source

import {decryptAES} from 'packages/crypto/src/decryptAES.ts'

Decrypt an encrypted message

Params:

NameTypeAttributeDescription
encryptedBase64 *

encryprts data in base64 format

key *

The secret key

Return:

*

The decrypted content

public generateMasterKeys(passPhrase: *): * source

import {generateMasterKeys} from 'packages/crypto/src/generateMasterKeys.ts'

Generate the Master Public Key and Master Private Key for a new passphrase

Params:

NameTypeAttributeDescription
passPhrase *

The passphrase

Return:

*

EC-KCDSA sign key pair + agreement key

public generateSignature(messageHex: *, privateKey: *): * source

import {generateSignature} from 'packages/crypto/src/generateSignature.ts'

Generate a signature for the transaction

Method:

 s = sign(sha256(sha256(transactionHex)_keygen(sha256(sha256(transactionHex)_privateKey)).publicKey),
         sha256(sha256(transactionHex)_privateKey),
         privateKey)
 p = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)

Params:

NameTypeAttributeDescription
messageHex *

The data in hexadecimal representation

privateKey *

The private key for signing

Return:

*

public generateSignedTransactionBytes(unsignedTransactionHex: *, signature: *): * source

import {generateSignedTransactionBytes} from 'packages/crypto/src/generateSignedTransactionBytes.ts'

Generates a signed message digest

Params:

NameTypeAttributeDescription
unsignedTransactionHex *

The unsigned message

signature *

The signature

Return:

*

The signed message digest

public getAccountIdFromPublicKey(publicKey: *): * source

import {getAccountIdFromPublicKey} from 'packages/crypto/src/getAccountIdFromPublicKey.ts'

Convert hex string of the public key to the account id

Params:

NameTypeAttributeDescription
publicKey *

The public key

Return:

*

The numeric account Id

public getBlockByHeight(height: *, includeTransactions: *): * source

import {getBlockByHeight} from '@burstjs/core/api'

Get a block by given height

Params:

NameTypeAttributeDescription
height *

The block height

includeTransactions *

true, if transactions shall be included

Return:

*

The Block

public getBlockById(id: *, includeTransactions: *): * source

import {getBlockById} from '@burstjs/core/api'

Get a block by given id

Params:

NameTypeAttributeDescription
id *

The block id

includeTransactions *

true, if transactions shall be included

Return:

*

The Block

public getBlockByTimestamp(timestamp: *, includeTransactions: *): * source

import {getBlockByTimestamp} from '@burstjs/core/api'

Get a block by given timestamp

Params:

NameTypeAttributeDescription
timestamp *

The timestamp in seconds since Genesis Block

includeTransactions *

true, if transactions shall be included

Return:

*

The Block

public getBlockId(height: number): Promise<BlockId> source

import {getBlockId} from '@burstjs/core/api'

Get a block id by given height

Params:

NameTypeAttributeDescription
height number

The block height

Return:

Promise<BlockId>

The Block Id

public getBlockchainStatus(service: *): * source

import {getBlockchainStatus} from '@burstjs/core/api'

Get the blockchain status.

Params:

NameTypeAttributeDescription
service *

Return:

*

The Blockchain Status

public getServerStatus(service: *): * source

import {getServerStatus} from '@burstjs/core/api'

Get the state of the server node and network

Params:

NameTypeAttributeDescription
service *

Return:

*

The server Status

public getTransaction(transactionId: *): * source

import {getTransaction} from '@burstjs/core/api'

Get a transaction from the network/blockchain

Params:

NameTypeAttributeDescription
transactionId *

The transaction Id

Return:

*

The Transaction

public sendTextMessage(message: *, recipientId: *, senderPublicKey: *, senderPrivateKey: *, fee: *): * source

import {sendTextMessage} from '@burstjs/core/api'

Broadcasts a text message to the network/blockchain

The message will be broadcasted in two steps.

  1. Send the message with public key to the network
  2. Take the returned unsigned message and sign it, i.e. the private key won't be transmitted.

Params:

NameTypeAttributeDescription
message *

The text message to be sent

recipientId *

The recipients Id, not RS Address

senderPublicKey *

The senders public key for sending an unsigned message

senderPrivateKey *

The senders private key to sign the message

fee *

The optional fee (expressed in Burst) for the message, default is 0.1 Burst.

Return:

*

The Transaction Id

public verifySignature(signature: *, messageHex: *, publicKey: *): * source

import {verifySignature} from 'packages/crypto/src/verifySignature.ts'

Verify a signature for given message

  • Method:
    * h1 = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
    ==
    sha256(sha256(transactionHex)_verify(v, h1, publickey)) = h2
    

Params:

NameTypeAttributeDescription
signature *

The signature to be verified

messageHex *

The message data in hexadecimal representation

publicKey *

The public key

Return:

*