NET API
HSM Dinamo
Loading...
Looking for...
No entries found
bchain_get_address.cs

Example of address recovery using the blockchain module.

See Note on examples.
using Dinamo.Hsm;
using System;
using System.Text;
using System.IO;
namespace BchainGetAddress
{
class Program
{
private static String addr = "127.0.0.1";
private static String userId = "test";
private static String userPwd = "12345678";
static void Main(string[] args)
{
String keyId = "key";
try {
/*
Connect to HSM
*/
api.Connect(addr, userId, userPwd);
Console.Out.WriteLine("Connected successfully!");
/*
Generates the XPriv BIP-32 key.
*/
api. BchainCreateXPrvBip32(keyId, DinamoApi.DN_BCHAIN_VER_BIP32_MAINNET, false, false);
Console.Out.WriteLine("Key generated successfully!");
/*
Retrieve the address of the generated private key.
*/
byte[] keyAddr = api. BchainGetAddress(DinamoApi.DN_BCHAIN_AT_ETH_EOA,
keyId);
Console.Out.WriteLine("Address retrieved successfully!");
Console.Out.WriteLine("Address: " + System.Text.Encoding.UTF8.GetString(keyAddr));
} catch (DinamoException e) {
Console.Out.WriteLine(e.Message);
} finally{
/*
Disconnects from HSM
*/
api.Disconnect();
Console.Out.WriteLine("Successfully disconnected!");
}
}
}
}
Low-level class for accessing the HSM. To use this class you need to understand more ...
Definition DinamoApi.cs:15
const byte DN_BCHAIN_VER_BIP32_MAINNET
Definition DinamoApi.cs:2394
const string DN_BCHAIN_HRP_UNUSED
Definition DinamoApi.cs:2557
const byte DN_BCHAIN_AT_ETH_EOA
Definition DinamoApi.cs:2536
const byte DN_BCHAIN_VER_UNUSED
Definition DinamoApi.cs:2546
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
Exception class for errors from Dinamo.
Definition DinamoException.cs:10
override string Message
Definition DinamoException.cs:42
void BchainCreateXPrvBip32(string szId, byte bVersion, bool isExportable, bool isTemporary)
Creates an XPriv private key in BIP32 format.
Definition DinamoClient.cs:7016
byte[] BchainGetAddress(byte bType, byte bVersion, string szHrp, string szId)
Retrieves the address of a key using the blockchain module.
Definition DinamoClient.cs:7207
void RemoveObjectIfExists(string ObjectId)
Removes an object from the HSM, if it exists.
Definition DinamoClient.cs:2410
void Connect(string User, string Password)
Establishes an encrypted connection to the HSM using the load balance settings.
Definition DinamoClient.cs:562
void Disconnect(bool flagClose)
Terminates the connection to the HSM.
Definition DinamoClient.cs:814
Namespace denoting a set of functions for accessing the HSM Dinamo and their respective exceptions.
Definition DinamoClient.cs:12