hdac SDK
SDK for hdac blockchain development
매크로 | 함수 | 변수
hs_keys.cpp 파일 참조

hs_keys 소스파일. 더 자세히 ...

#include "hs_keys.h"
#include <utils/utilstrencodings.h>
#include <utils/base64.h>
#include <algorithm>
#include <cstring>
#include <entities/asset.h>
#include <memory>
#include "bitcoinaddress.h"
#include <script/standard.h>
#include <script/hdacscript.h>
#include "multisig.h"
#include "key.h"
#include <rpc/rpcprotocol.h>
#include <primitives/transaction.h>
#include "transactions.h"
#include <primitives/interpreter.h>
#include <standard.h>
#include <utils/define.h>
#include "eccautoinitreleasehandler.h"
#include "bitcoinsecret.h"

매크로

#define MC_AST_ASSET_REF_TYPE_OFFSET   32
 
#define MC_AST_ASSET_REF_TYPE_SIZE   4
 

함수

KeyPairs createKeyPairs (const IPrivateKeyHelper &privateHelper, const IWalletAddrHelper &addrHelper)
 개인키를 생성한다. 더 자세히 ...
 
void initAssetMetadataBuffer (const string &issueTxid, unsigned char buf[MC_AST_ASSET_FULLREF_BUF_SIZE])
 
void appendAssetSend (int64_t quantity, unsigned char initializedBuf[MC_AST_ASSET_FULLREF_BUF_SIZE], CScript &destinedScript)
 
string createAssetSendTx (const string &toAddr, double quantity, const string &issueTxid, int multiple, const string &unspentScriptPubKey, const string &unspentTxid, uint32_t unspentVOut, double unspentQty, const string &unspentRedeemScript, const string &privateKey, const IPrivateKeyHelper &privateHelper, const IWalletAddrHelper &walletHelper)
 개인키 처리를 위한 정보 제공 인터페이스를 가져온다. 더 자세히 ...
 
void appendStreamIdentifier (const string &createTxid, CScript &scriptOpReturn)
 
void appendStreamItemKey (const string &streamKey, CScript &scriptOpReturn)
 
void appendStreamItemValue (const string &streamValue, CScript &scriptOpReturn)
 
string createStreamPublishTx (const string &streamKey, const string &streamValue, const string &createTxid, const string &unspentScriptPubKey, const string &unspentTxid, uint32_t unspentVOut, const string &unspentRedeemScript, const string &privateKey, const IPrivateKeyHelper &helper)
 스트림키 발행을 위한 raw-tx 문자열을 생성한다. 더 자세히 ...
 
string walletAddrFromPubKey (const string &pubkeyStr, const IWalletAddrHelper &addrHelpler)
 공개키로부터 지갑주소를 문자열로 얻는다. 더 자세히 ...
 
bool VerifyMessage (const string &strAddress, const string &strSign, const string &strMessage, const IWalletAddrHelper &addrHelper)
 개인키 또는 지갑주소로 sign 된 메시지를 검증 한다. 더 자세히 ...
 
string SignMessage (const string &strAddress, const string &strMessage, const IPrivateKeyHelper &privateHelper, const IWalletAddrHelper &addrHelper)
 개인키를 이용하여 sign 된 메시지를 만든다. 더 자세히 ...
 

변수

const string strMessageMagic = "Hdac Signed Message:\n"
 

상세한 설명

hs_keys 소스파일.

날짜
2019-1-17
작성자
HDAC Technology Inc.

함수 문서화

string createAssetSendTx ( const string &  toAddr,
double  quantity,
const string &  issueTxid,
int  multiple,
const string &  unspentScriptPubKey,
const string &  unspentTxid,
uint32_t  unspentVOut,
double  unspentQty,
const string &  unspentRedeemScript,
const string &  privateKey,
const IPrivateKeyHelper privateHelper,
const IWalletAddrHelper walletHelper 
)

개인키 처리를 위한 정보 제공 인터페이스를 가져온다.

주로 개인키 처리를 위해 내부적으로 사용된다.

UTXO에 대한 정보는 listunspent RPC 명령을 통해 가져온다.

발행한 자산에 대한 정보는 listassets RPC 명령을 통해 가져온다.

개인키는 createKeyPairs 함수나 RPC 명령을 통해 가져온다.

매개변수
toAddr보낼 지갑 주소
quantity보낼 자산량
issueTxid발행한 트랜잭션 ID
multiple자산에 대한 multiple 값
unspentScriptPubKeyUTXO에 대한 scriptPubKey
unspentTxidUTXO에 대한 트랜잭션 ID
unspentVOutUTXO의 인덱스
unspentQtyUTXO의 양
unspentRedeemScriptUTXO의 redeem script (muti-sig 용으로 주로 사용)
privateKey보내는 지갑에 대한 개인키
privateHelper개인키 처리를 위한 정보 제공 인터페이스
walletHelper지갑주소 처리를 위한 정보 제공 인터페이스
반환값
개인키 처리를 위한 정보 제공 인터페이스
KeyPairs createKeyPairs ( const IPrivateKeyHelper privateHelper,
const IWalletAddrHelper addrHelper 
)

개인키를 생성한다.

개인키와 함께 공개키 및 이에 따른 공개키 해시와 지갑주소도 함께 구한다.

매개변수
privateHelper개인키 처리를 위한 정보 제공 인터페이스
addrHelper지갑주소 처리를 위한 정보 제공 인터페이스
반환값
KeyPairs
string createStreamPublishTx ( const string &  streamKey,
const string &  streamValue,
const string &  createTxid,
const string &  unspentScriptPubKey,
const string &  unspentTxid,
uint32_t  unspentVOut,
const string &  unspentRedeemScript,
const string &  privateKey,
const IPrivateKeyHelper helper 
)

스트림키 발행을 위한 raw-tx 문자열을 생성한다.

보안을 강화하기 위해, 블록체인 망 내의 노드를 이용하지 않고, 표출되지 않은 개인키와 망으로 부터 구한 블록체인의 트랜잭션 정보들로부터 직접 생성한다.

주로 개인키 처리를 위해 내부적으로 사용된다.

UTXO에 대한 정보는 listunspent RPC 명령을 통해 가져온다.

생성한 스트림에 대한 정보는 liststreams RPC 명령을 통해 가져온다.

개인키는 createKeyPairs 함수나 RPC 명령을 통해 가져온다.

매개변수
streamKey스트림에 대한 키
streamValue키에 대한 값
createTxid스트림 생성 트랜잭션 ID
unspentScriptPubKeyUTXO에 대한 scriptPubKey
unspentTxidUTXO에 대한 트랜잭션 ID
unspentVOutUTXO의 인덱스
unspentRedeemScriptUTXO의 redeem script (muti-sig 용으로 주로 사용)
privateKey보내는 지갑에 대한 개인키
privateHelper개인키 처리를 위한 정보 제공 인터페이스
반환값
raw-tx 문자열
string SignMessage ( const string &  strAddress,
const string &  strMessage,
const IPrivateKeyHelper privateHelper,
const IWalletAddrHelper addrHelper 
)

개인키를 이용하여 sign 된 메시지를 만든다.

개인키를 이용하여 평문으로 된 메시지를 sign 하여 암호화 한다.

매개변수
strAddresssign 할려고 하는 개인키 값
strMessagesign 할려고 하는 원본 문자열
privateHelper개인키 처리를 위한 정보 제공 인터페이스
addrHelper지갑주소 처리를 위한 정보 제공 인터페이스
반환값
base64 로 인코딩 된 sign 된 문자열
bool VerifyMessage ( const string &  strAddress,
const string &  strSign,
const string &  strMessage,
const IWalletAddrHelper addrHelper 
)

개인키 또는 지갑주소로 sign 된 메시지를 검증 한다.

개인키 또는 지갑주소로 sign 된 메시지가 해당 개인키 또는 지갑주소로 제대로 sign 되었는지 검증 할때 사용 한다.

매개변수
strAddresssign 할 때 사용 된 지갑주소
strSignsign 되어진 문자열
strMessage원본 문자열
addrHelper지갑주소 처리를 위한 정보 제공 인터페이스
반환값
해당 개인키 또는 지갑주소로 sign 메시지가 맞다면 true 아니라면 false
string walletAddrFromPubKey ( const string &  pubkeyStr,
const IWalletAddrHelper addrHelpler 
)

공개키로부터 지갑주소를 문자열로 얻는다.

문자열로 표기된 공개키와 주소를 생성하기 위한 prefix값과 checksum을 통해서 지갑주소를 구해낸다.

매개변수
pubkeyStr문자열로 표기된 공개키
addrHelper지갑주소 처리를 위한 정보 제공 인터페이스
반환값
문자열로 표기된 지갑주소