hdac SDK
SDK for hdac blockchain development
|
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 소스파일.
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 값 |
unspentScriptPubKey | UTXO에 대한 scriptPubKey |
unspentTxid | UTXO에 대한 트랜잭션 ID |
unspentVOut | UTXO의 인덱스 |
unspentQty | UTXO의 양 |
unspentRedeemScript | UTXO의 redeem script (muti-sig 용으로 주로 사용) |
privateKey | 보내는 지갑에 대한 개인키 |
privateHelper | 개인키 처리를 위한 정보 제공 인터페이스 |
walletHelper | 지갑주소 처리를 위한 정보 제공 인터페이스 |
KeyPairs createKeyPairs | ( | const IPrivateKeyHelper & | privateHelper, |
const IWalletAddrHelper & | addrHelper | ||
) |
개인키를 생성한다.
개인키와 함께 공개키 및 이에 따른 공개키 해시와 지갑주소도 함께 구한다.
privateHelper | 개인키 처리를 위한 정보 제공 인터페이스 |
addrHelper | 지갑주소 처리를 위한 정보 제공 인터페이스 |
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 |
unspentScriptPubKey | UTXO에 대한 scriptPubKey |
unspentTxid | UTXO에 대한 트랜잭션 ID |
unspentVOut | UTXO의 인덱스 |
unspentRedeemScript | UTXO의 redeem script (muti-sig 용으로 주로 사용) |
privateKey | 보내는 지갑에 대한 개인키 |
privateHelper | 개인키 처리를 위한 정보 제공 인터페이스 |
string SignMessage | ( | const string & | strAddress, |
const string & | strMessage, | ||
const IPrivateKeyHelper & | privateHelper, | ||
const IWalletAddrHelper & | addrHelper | ||
) |
개인키를 이용하여 sign 된 메시지를 만든다.
개인키를 이용하여 평문으로 된 메시지를 sign 하여 암호화 한다.
strAddress | sign 할려고 하는 개인키 값 |
strMessage | sign 할려고 하는 원본 문자열 |
privateHelper | 개인키 처리를 위한 정보 제공 인터페이스 |
addrHelper | 지갑주소 처리를 위한 정보 제공 인터페이스 |
bool VerifyMessage | ( | const string & | strAddress, |
const string & | strSign, | ||
const string & | strMessage, | ||
const IWalletAddrHelper & | addrHelper | ||
) |
개인키 또는 지갑주소로 sign 된 메시지를 검증 한다.
개인키 또는 지갑주소로 sign 된 메시지가 해당 개인키 또는 지갑주소로 제대로 sign 되었는지 검증 할때 사용 한다.
strAddress | sign 할 때 사용 된 지갑주소 |
strSign | sign 되어진 문자열 |
strMessage | 원본 문자열 |
addrHelper | 지갑주소 처리를 위한 정보 제공 인터페이스 |
string walletAddrFromPubKey | ( | const string & | pubkeyStr, |
const IWalletAddrHelper & | addrHelpler | ||
) |
공개키로부터 지갑주소를 문자열로 얻는다.
문자열로 표기된 공개키와 주소를 생성하기 위한 prefix값과 checksum을 통해서 지갑주소를 구해낸다.
pubkeyStr | 문자열로 표기된 공개키 |
addrHelper | 지갑주소 처리를 위한 정보 제공 인터페이스 |