API Reference

createTransaction

1
createTransaction(txParams, lockTime=0, cb)
Copied!
Create an Incognito PRV or pToken transaction
Parameters:
    txParams: Object with format
      SenderSK : string - base64-encoded 32-byte private key
      PaymentInfo: Array of receivers
      InputCoins: Array of coins to spend
      Fee: Number - transaction fee (PRV)
      Metadata: Object - extra information
      Info: string - optional base64-encoded message
      CoinCache: Object - other coins for hiding sender identity
      TokenParams: Object - parameters for pToken, if applicable
    lockTime: Number - optional time in TX
Output: base58-encoded transaction

createConvertTx

1
createConvertTx(txParams, lockTime=0, cb)
Copied!
Create a transaction that converts old Incognito coins to version 2 Parameters:
    txParams: Object with format
      SenderSK : string - base64-encoded 32-byte private key
      PaymentInfo: Array of receivers. [] works
      InputCoins: Array of PRV coins
      Fee: Number - transaction fee (PRV)
      TokenID: string - token ID being spent
      Metadata: Object - extra information
      Info: string - optional base64-encoded message
      CoinCache: Object - other coins for hiding sender identity
      TokenParams: Object - parameters for pToken, if applicable
    lockTime: Number - optional time in TX
Output: base58-encoded transaction

decryptCoin

1
decryptCoin(coinParams, cb)
Copied!
Decrypt an Incognito coin (of any version)
Parameters:
    coinParams: Object with format
      Coin: the encrypted coin as JSON
      KeySet: your base58-serialized key
Output: the decrypted coin as JSON string

createCoin

1
createCoin(coinParams, cb)
Copied!
Create a valid, pretend One Time Address (OTA) coin object. It is not (yet) a UTXO in the Incognito chain
Parameters:
    coinParams: Object with format
      PaymentInfo: Object with the receiver address and amount
      TokenID: the pToken ID of this coin
Output: the new OTA coin as JSON string

hybridEncrypt

1
hybridEncrypt(rawKeyAndMsg, cb)
Copied!
Encrypt a message using the intended receiver's Incognito public key
Parameters:
    rawKeyAndMsg: string - the concatenated byte array of their public key and your message, encoded in base64
Output: the ciphertext, encoded in base64

hybridDecrypt

1
hybridDecrypt(rawKeyAndMsg, cb)
Copied!
Decrypt a message you received using your Incognito private key
Parameters:
    rawKeyAndMsg: string - the concatenated byte array of your private key and the encrypted message, encoded in base64
Output: the original message, encoded in base64

scalarMultBase

1
scalarMultBase(scalar, cb)
Copied!
Elliptic curve multiply-by-base operation
Parameters:
    scalar: string - a big number encoded in base64
Output: the product - a 32-byte curve point, encoded in base64

getSignPublicKey

1
getSignPublicKey(keyParams, cb)
Copied!
Compute a Schnorr public key using the private key
Parameters:
    keyParams: Object
    1
    {
    2
    "Data": {
    3
    "Sk": "<your-base64-encoded-private-key>"
    4
    }
    5
    }
    Copied!
Output: the public key, encoded as hex string

signPoolWithdraw

1
signPoolWithdraw(keyParams, cb)
Copied!
Sign some information using your Schnorr private key
Parameters:
    keyParams: Object
    1
    {
    2
    "Data": {
    3
    "PaymentAddress": "<address-to-sign,string>",
    4
    "Amount": "<amount-to-sign,string>",
    5
    "Sk": "<your-base64-encoded-private-key>"
    6
    }
    7
    }
    Copied!

verifySign

1
verifySign(rawKeyAndSig, cb)
Copied!
Verify a Schnorr signature
Parameters:
    rawKeyAndSig: string - the concatenated byte array of the public key and the signature, encoded as hex string
Output: true or false

generateKeyFromSeed

1
generateKeyFromSeed(seed, cb)
Copied!
Generate a private key from a seed
Parameters:
    seed: string - the byte array of the seed, encoded in base64
Output: the 32-byte private key, encoded in base64

generateBLSKeyPairFromSeed

1
generateBLSKeyPairFromSeed(seed, cb)
Copied!
Generate a BLS key pair from a seed
Parameters:
    seed: string - the byte array of the seed, encoded in base64
Output: the concatenated private and public keys, encoded in base64

newKeySetFromPrivate

1
newKeySetFromPrivate(rawKey, cb)
Copied!
Generate an Incognito key set from a private key
Parameters:
    rawKey: string - the byte array of the private key, encoded in base64
Output: the KeySet object as JSON string

Other functions

The function names:
    initPrivacyTx
    staking
    stopAutoStaking
    initPrivacyTokenTx
    initBurningRequestTx
    initWithdrawRewardTx
    initPRVContributionTx
    initPTokenContributionTx
    initPRVTradeTx
    initPTokenTradeTx
    withdrawDexTx
are aliases to createTransaction