Documentation ¶
Index ¶
- func CalculateTransactionDataHash(txData *bcostars.TransactionData) (string, error)
- func CreateSignedTransaction(privateKey string, groupId string, chainId string, to string, dataHex string, ...) (txHash string, txHex string, err error)
- func CreateTransaction(from string, txData *bcostars.TransactionData, txDataHash string, ...) (*bcostars.Transaction, error)
- func CreateTransactionData(groupId string, chainId string, to string, dataHex string, abiJson string, ...) (*bcostars.TransactionData, error)
- func DecodeTransactionDataFromHex(txDataHex string) (*bcostars.TransactionData, error)
- func EncodeTransaction(tx *bcostars.Transaction) (string, error)
- func EncodeTransactionDataToHex(tx *bcostars.TransactionData) (string, error)
- func GetBlockLimit(groupId string) (int64, error)
- func HexByte2Int8(dataHex []byte) []int8
- func Nonce() string
- func ParseKeyPairFromPrivateKey(privateKey string) (*secp256k1.PrivateKey, error)
- func PrivateKeyToAddress(privateKey string) (string, error)
- func SignTransactionDataHash(privateKey string, txDataHash string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTransactionDataHash ¶
func CalculateTransactionDataHash(txData *bcostars.TransactionData) (string, error)
func CreateSignedTransaction ¶
func CreateTransaction ¶
func CreateTransaction(from string, txData *bcostars.TransactionData, txDataHash string, signedTxDataHash string, attribute int32) (*bcostars.Transaction, error)
func Address(priKey *ecdsa2.PrivateKey) string { //priKeyHash := "796c823671b118258b53ef6056fd1f9fc96d125600f348f75f397b2000267fe8" // 创建私钥对象,上面私钥没有钱哦 //priKey, err := crypto.HexToECDSA(priKeyHash) //if err != nil { // panic(err) //} //priKeyBytes := crypto.FromECDSA(priKey) //fmt.Printf("私钥为: %s\n", hex.EncodeToString(priKeyBytes)) pubKey := priKey.Public().(*ecdsa2.PublicKey) //// 获取公钥并去除头部0x04 pubKeyBytes := crypto.FromECDSAPub(pubKey)[1:] fmt.Printf("公钥为: %s\n", hex.EncodeToString(pubKeyBytes)) // //// 获取地址 addr := crypto.PubkeyToAddress(*pubKey) fmt.Printf("地址为: %s\n", addr.Hex()) return addr.Hex() }
func CreateTransactionData ¶
func CreateTransactionData(groupId string, chainId string, to string, dataHex string, abiJson string, blockLimit int64) (*bcostars.TransactionData, error)
1
func DecodeTransactionDataFromHex ¶
func DecodeTransactionDataFromHex(txDataHex string) (*bcostars.TransactionData, error)
func EncodeTransaction ¶
func EncodeTransaction(tx *bcostars.Transaction) (string, error)
func EncodeTransactionDataToHex ¶
func EncodeTransactionDataToHex(tx *bcostars.TransactionData) (string, error)
func HexByte2Int8 ¶
func PrivateKeyToAddress ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.