NET API
HSM Dinamo
Loading...
Looking for...
No entries found
Blockchain Module

Detailed description

Operations to support the security of Blockchain-based structures.

See HSM technical documentation about operating details, specifications used, licenses e module trade name.

Functions

void BchainCreateXPrvBtcMinikey (string szId, bool isExportable, bool isTemporary)
 Creates an XPriv private key for Bitcoin in minikey format.
 
void BchainCreateXPrvBip32 (string szId, byte bVersion, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP32 format.
 
void BchainCreateXPrvBip32Seed (string szId, DinamoApi.DN_BCHAIN_BIP32_SEED_XPRV_DATA pData, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP32 format using seed.
 
void BchainCreateXPrvBip39Seed (string szId, DinamoApi.DN_BCHAIN_BIP39_SEED_XPRV_DATA pData, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP39 format using seed.
 
DinamoApi.DN_BCHAIN_KEY_INFO BchainCreateBip32Ckd (byte bVersion, UInt32 dwIndex, string szPar, string szDst, bool isExportable, bool isTemporary)
 Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.
 
byte[] BchainSignHash (byte bType, byte bHashMode, byte[] pbHash, string szPk)
 Sign a hash using the Blockchain module.
 
byte[] BchainGetPubKey (byte bType, string szId)
 Retrieves a public key using the blockchain module.
 
byte[] BchainGetAddress (byte bType, byte bVersion, string szHrp, string szId)
 Retrieves the address of a key using the blockchain module.
 
byte[] BchainEdDsaSign (byte bType, string szCtxStr, byte[] pbData, string szId)
 Generates an EdDsa signature using the blockchain module.
 
void BchainGenerateKey (Dinamo.Hsm.DinamoClient.KEY_ALG dwAlg, string szId, bool isExportable, bool isTemporary)
 Generates a marked key for use in the blockchain module.
 

Functions

BchainCreateXPrvBtcMinikey()

void BchainCreateXPrvBtcMinikey ( string szId,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key for Bitcoin in minikey format.

Parameters
szIdKey identifier.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateXPrvBip32()

void BchainCreateXPrvBip32 ( string szId,
byte bVersion,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP32 format.

Parameters
szIdKey identifier.
bVersionKey version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_BIP32_MAINNET Mainnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_TESTNET Testnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_MAINNET Mainnet BIP32 Hathor.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_TESTNET Testnet BIP32 Hathor.
DinamoAPI.DN_BCHAIN_VER_BIP32_FPRV1 Fireblocks variation.
Parameters
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_ckd.cs, bchain_get_address.cs, bchain_get_pub.c s and bchain_sign_hash.cs.

BchainCreateXPrvBip32Seed()

void BchainCreateXPrvBip32Seed ( string szId,
DinamoApi.DN_BCHAIN_BIP32_SEED_XPRV_DATA pData,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP32 format using seed.

Parameters
szIdKey identifier.
pDataData for generating the key.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateXPrvBip39Seed()

void BchainCreateXPrvBip39Seed ( string szId,
DinamoApi.DN_BCHAIN_BIP39_SEED_XPRV_DATA pData,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP39 format using seed.

Parameters
szIdKey identifier.
pDataData for generating the key.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateBip32Ckd()

DinamoApi.DN_BCHAIN_KEY_INFO BchainCreateBip32Ckd ( byte bVersion,
UInt32 dwIndex,
string szPar,
string szDst,
bool isExportable,
bool isTemporary )
inline

Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.

Parameters
bVersionKey version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_BIP32_MAINNET Mainnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_TESTNET Testnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_MAINNET Mainnet BIP32 Hathor.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_TESTNET Testnet BIP32 Hathor.
DinamoAPI.DN_BCHAIN_VER_BIP32_FPRV1 Fireblocks variation.
dwIndexIndex of the key to be derived. Non-hardened keys use an index from 0 to 231-1 and hardened (unrestrictedly secure) keys use indexes from 231 to 232-1, as specified in the BIP32 standard. It is highly recommended to generate hardened keys. Use DinamoApi.DN_BCHAIN_SECURE_BIP32_INDEX_BASE as the basis for generating hardened indexes (e.g. DinamoApi.DN_BCHAIN_SECURE_BIP32_INDEX_BASE + 1 ...).
szParIdentifier of the parent key.
szDstIdentifier of the derived key. Must be an XPrv key(DinamoApi.DN_BCHAIN_BIP32_XPRV etc.)
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Return
Information on the derived key.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_ckd.cs.

BchainSignHash()

byte[] BchainSignHash ( byte bType,
byte bHashMode,
byte[] pbHash,
string szPk )
inline

Sign a hash using the Blockchain module.

Parameters
bTypeKey type.
Value Meaning
DinamoApi.DN_BCHAIN_SIG_DER_ECDSA DER signature, in the format v || DER. SECG!SEC1 strict DER with low S as described in BIP62/66, BIP146, EIP2. With 'v' having a size of 1 byte. 'v' is the parity bit of 'r' and can have the values 0 or 1.
DinamoApi.DN_BCHAIN_SIG_RAW_ECDSA RAW signature, in the format v || r || s. With 'v' having a size of 1 byte and 'r' and 's' each having a size of 32 bytes. 'v' is the parity bit of 'r' and can have the values 0 or 1.
DinamoApi.DN_BCHAIN_SIG_BIP340 Signature BIP340 - Schnorr 64 bytes.
bHashModeHash type.
Value Meaning
DinamoApi.DN_BCHAIN_HASH_BTC_H160 Bitcoin H160.
DinamoApi.DN_BCHAIN_HASH_RIPEMD160 RIPEMD160.
DinamoApi.DN_BCHAIN_HASH_SHA256 SHA256
DinamoApi.DN_BCHAIN_HASH_BTC_SHA256_2X Bitcoin SHA256 2x.
DinamoApi.DN_BCHAIN_HASH_KECCAK256 KECCAK256.
DinamoApi.DN_BCHAIN_HASH_BLAKE2B224 Blake2b 224.
DinamoApi.DN_BCHAIN_HASH_BLAKE2B256 Blake2b 256.
pbHashHash calculated according to the information in bHashMode.
szPkPrivate key identifier.
Return
Signature.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_sign_hash.cs.

BchainGetPubKey()

byte[] BchainGetPubKey ( byte bType,
string szId )
inline

Retrieves a public key using the blockchain module.

Parameters
bTypeKey type.
Value Meaning
DinamoApi.DN_BCHAIN_PBK_SEC1_UNCOMP ECDSA SEC1 uncompressed.
DinamoApi.DN_BCHAIN_PBK_SEC1_COMP ECDSA SEC1 compressed.
DinamoApi.DN_BCHAIN_PBK_BIP340 Schnorr, BIP-340.
DinamoApi.DN_BCHAIN_PBK_ED25519 Ed25519.
DinamoApi.DN_BCHAIN_PBK_AT_ALGORAND Algorand.
DinamoApi.DN_BCHAIN_PBK_BIP32_XPUB BIP32 XPub.
DinamoApi.DN_BCHAIN_PBK_AT_SOL Solana.
DinamoApi.DN_BCHAIN_PBK_AT_XLM Stellar Lumens.
DinamoAPI.DN_BCHAIN_PBK_ADA_VK Cardano CIP-0016 / CIP-0005.
DinamoAPI.DN_BCHAIN_PBK_AT_SS58 SS58.
DinamoAPI.DN_BCHAIN_PBK_TON TEP-2 "User-friendly"/"armored."
DinamoAPI.DN_BCHAIN_PBK_E_UNCOMP | SEC1_UNCOMP without the 0x04 prefix (X || Y). Only alt_bn128 (EIPs 196/197).
szIdPrivate key identifier.
Return
Public key.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_get_pub.cs.

BchainGetAddress()

byte[] BchainGetAddress ( byte bType,
byte bVersion,
string szHrp,
string szId )
inline

Retrieves the address of a key using the blockchain module.

Parameters
bTypeType of address to be generated. It can be one of the values below.
Value Meaning
DinamoApi.DN_BCHAIN_AT_BTC_P2PKH P2PKH address.
DinamoApi.DN_BCHAIN_AT_BTC_P2SH Address P2SH BIP13..
DinamoAPI.DN_BCHAIN_AT_BTC_P2WPKH Address BIP173, version 0.
DinamoApi.DN_BCHAIN_AT_BTC_P2WSH Address BIP173, version 0.
DinamoApi.DN_BCHAIN_AT_ETH_EOA Address ETH EOA.
DinamoApi.DN_BCHAIN_AT_ETH_EOA_MC_CKS Address ETH EOA MC CKS. EIP55.
DinamoApi.DN_BCHAIN_AT_ETH_EOA_ICAP Address ETH EOA ICAP.
DinamoApi.DN_BCHAIN_AT_ALGORAND Address Algorand.
DinamoApi.DN_BCHAIN_AT_TRON_HEX Hexadecimal TRON address.
DinamoApi.DN_BCHAIN_AT_TRON_B58 Address TRON Base 58.
DinamoApi.DN_BCHAIN_AT_XRP XRP Ledger/Ripple address.
DinamoApi.DN_BCHAIN_AT_SOL Address Solana.
DN_BCHAIN_AT_XLM Stellar Address SEP-23.
DN_BCHAIN_AT_ADA_PKH Cardano address CIP-0019, Shelley, Header type: 0110 (6).
DN_BCHAIN_AT_ADA_SH Cardano address CIP-0019, Shelley, Header type: 0111 (7).
DN_BCHAIN_AT_LUNC Address Terra Classic.
DN_BCHAIN_AT_SS58 Address SS58.
DN_BCHAIN_AT_XTZ Address Tezos.
DN_BCHAIN_AT_TON Toncoin TEP-2 address.
DN_BCHAIN_AT_TON_SH Toncoin Address TEP-2 SH.
DN_BCHAIN_AT_ATOM Address: Atom ADR-028.
DN_BCHAIN_AT_BTC_P2TR BTC address BIP350, version 1-16.
DN_BCHAIN_AT_LTC_P2PKH LTC P2PKH address.
DN_BCHAIN_AT_LTC_P2SH LTC P2SH BIP13 address.
DN_BCHAIN_AT_LTC_P2WPKH Address LTC P2WPKH BIP173.
DN_BCHAIN_AT_LTC_P2WSH Address LTC P2WSH BIP173.
DN_BCHAIN_AT_LTC_P2TR LTC BIP350 address, version 1-16.
Parameters
bVersionAddress version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_UNUSED Parameter not used.
DinamoApi.DN_BCHAIN_VER_BTC_A1_MAIN_NET Bitcoin A1 mainnet.
DinamoApi.DN_BCHAIN_VER_BTC_AMN_TEST_NET Bitcoin P2PKH testnet.
DinamoApi.DN_BCHAIN_VER_BTC_A3_MAIN_NET Bitcoin A3 mainnet.
DinamoApi.DN_BCHAIN_VER_BTC_B32_WITVER Bitcoin B32 witver.
DinamoApi.DN_BCHAIN_VER_BTC_SEGWIT0 Bitcoin SEGWIT0
DinamoApi.DN_BCHAIN_VER_BTC_SEGWIT1 Bitcoin SEGWIT1
DinamoApi.DN_BCHAIN_VER_HTR_MAINNET Hathor mainnet.
DinamoApi.DN_BCHAIN_VER_HTR_TESTNET Hathor testnet.
DinamoApi.DN_BCHAIN_VER_HTR_P2SH_MAINNET Hathor P2SH mainnet.
DinamoApi.DN_BCHAIN_VER_HTR_P2SH_TESTNET Hathor P2SH testnet.
DinamoApi.DN_BCHAIN_VER_XRP_CLASSIC XRP Ledger/Ripple Classic.
DinamoApi.DN_BCHAIN_VER_LTC_SEGWIT0 Litecoin SEGWIT0
DinamoApi.DN_BCHAIN_VER_LTC_SEGWIT1 Litecoin SEGWIT1
DinamoApi.DN_BCHAIN_VER_LTC_AL_MAINNET Litecoin AL mainnet.
DinamoApi.DN_BCHAIN_VER_LTC_Amn_TESTNET Litecoin Amn testnet.
DinamoApi.DN_BCHAIN_VER_LTC_AM_MAINNET Litecoin AM mainnet.
DinamoAPI.DN_BCHAIN_VER_LTC_AQ_TESTNET Litecoin AQ testnet.
DinamoApi.DN_BCHAIN_VER_ADA_MAINNET Cardano mainnet.
DinamoApi.DN_BCHAIN_VER_ADA_TESTNET Cardano testnet.
DinamoApi.DN_BCHAIN_VER_SS58_POLKADOT Polkadot SS58.
DinamoAPI.DN_BCHAIN_VER_SS58_GEN_SUBST Generic Substrate SS58.
DinamoAPI.DN_BCHAIN_VER_TON_MN_BWORK Toncoin wallet v4r2; mainnet; basic workchain.
DinamoApi.DN_BCHAIN_VER_TON_MN_MCHAIN Toncoin wallet v4r2; mainnet; masterchain. *
DinamoApi.DN_BCHAIN_VER_TON_TN_BWORK Toncoin wallet v4r2; testnet; basic workchain.
DinamoApi.DN_BCHAIN_VER_TON_TN_MCHAIN Toncoin wallet v4r2; testnet; masterchain.
szHrpHRP (Human Readable Part) of the key. The values in the table are accepted. It must have a maximum size of DinamoApi.DN_BCHAIN_MAX_HRP
Value Meaning
DinamoApi.DN_BCHAIN_HRP_UNUSED Parameter not used.
DinamoApi.DN_BCHAIN_HRP_BTC_MAIN_NET Bitcoin mainnet.
DinamoApi.DN_BCHAIN_HRP_BTC_TEST_NET Bitcoin testnet.
<see cref="DinamoApi.DN_BCHAIN_HRP_LTC_MAINNET" Litecoin mainnet.
<see cref="DinamoApi.DN_BCHAIN_HRP_LTC_TESTNET" Litecoin testnet.
<see cref="DinamoApi.DN_BCHAIN_HRP_TON_BNCBLE" Toncoin bounceable.
<see cref="DinamoApi.DN_BCHAIN_HRP_TON_NBNCBLE" Toncoin non-bounceable.
szIdPrivate key identifier.
Return
Address.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_get_address.cs.

BchainEdDsaSign()

byte[] BchainEdDsaSign ( byte bType,
string szCtxStr,
byte[] pbData,
string szId )
inline

Generates an EdDsa signature using the blockchain module.

Parameters
bTypeType of subscription to be generated. It can be one of the values below.
Value Meaning
DinamoApi.DN_BCHAIN_EDDSA_SIG_PURE EdDsa Pure Signature.
DinamoApi.DN_BCHAIN_EDDSA_SIG_ALGORAND EdDsa Algorand Signature.
DinamoApi.DN_BCHAIN_EDDSA_SIG_XRP EdDsa XRP subscription.
DinamoApi.DN_BCHAIN_EDDSA_SIG_SOL Signature EdDsa Solana.
DinamoApi.DN_BCHAIN_EdDSA_SIG_XLM EdDsa Stellar signature.
DinamoApi.DN_BCHAIN_EdDSA_SIG_ADA EdDsa Cardano signature.
DinamoAPI.DN_BCHAIN_EdDSA_SIG_DOT EdDsa Polkadot signature.
DinamoApi.DN_BCHAIN_EdDSA_SIG_XTZ EdDsa Tezos signature encoded in b58.
DinamoApi.DN_BCHAIN_EdDSA_SIG_XTZ_PH EdDsa Tezos signature (same as DinamoApi.DN_BCHAIN_EdDSA_SIG_XTZ_PH), using blake2b-256 as data.
szCtxStrContext string as defined in RFC-8032 of maximum size DinamoApi.DN_BCHAIN_EDDSA_MAX_CSTRL. Can be passed DinamoApi.DN_BCHAIN_EDDSA_CSTR_UNUSED.
pbDataData to be signed.
szIdPrivate key identifier.
Return
Signature.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_eddsa_sign.cs.

BchainGenerateKey()

void BchainGenerateKey ( Dinamo.Hsm.DinamoClient.KEY_ALG dwAlg,
string szId,
bool isExportable,
bool isTemporary )
inline

Generates a marked key for use in the blockchain module.

Parameters
dwAlgAlgorithm to be used. Dinamo.Hsm.DinamoClient.KEY_ALG
szIdKey identifier.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_eddsa_sign.cs.