service

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyEvent          = "key"
	BatchExecuteEvent = "batchExecute"
)

Variables

This section is empty.

Functions

func AsBytes

func AsBytes(args []string) [][]byte

func ConvertPrivateKeyToBase58Check

func ConvertPrivateKeyToBase58Check(privateKey ed25519.PrivateKey) string

ConvertPrivateKeyToBase58Check - use privateKey with standard encoded type - Base58Check

func ConvertPublicKeyToBase58

func ConvertPublicKeyToBase58(publicKey ed25519.PublicKey) string

ConvertPublicKeyToBase58 - use publicKey with standard encoded type - Base58

func ConvertSignatureToBase58

func ConvertSignatureToBase58(publicKey []byte) string

ConvertSignatureToBase58 - use signature with standard encoded type - Base58

func EncodedPrivKeyToEd25519

func EncodedPrivKeyToEd25519(secretKey string) (ed25519.PrivateKey, ed25519.PublicKey, error)

EncodedPrivKeyToEd25519 - get private key type Ed25519 by encoded private key in string secretKey string - private key in base58check, base58 or hex

func GenerateMessage

func GenerateMessage(validatorPublicKeys []string, channelID string, chaincodeName string, methodName string, args []string) string

func GeneratePrivateAndPublicKey

func GeneratePrivateAndPublicKey() (ed25519.PublicKey, ed25519.PrivateKey, error)

func GeneratePrivateKey

func GeneratePrivateKey() (string, error)

func GetAddress

func GetAddress(secretKey string) (string, error)

GetAddress - get address by encoded string in standard encoded for project is 'base58.Check' secretKey string - private key in base58check, or hex or base58

func GetAddressByPublicKey

func GetAddressByPublicKey(publicKey ed25519.PublicKey) (string, error)

GetAddressByPublicKey - get address by encoded string in standard encoded for project is 'base58.Check' secretKey string - private key in base58check, or hex or base58

func GetBase58PubKey

func GetBase58PubKey(secretKey string) (string, error)

GetBase58PubKey returns base58-encoded pubkey. secretKey string - private key in base58check, or hex or base58

func GetNonce

func GetNonce() string

func GetNonceInt64

func GetNonceInt64() int64

func GetPrivateKeySKFromBase58

func GetPrivateKeySKFromBase58(secretKey string) (ed25519.PrivateKey, ed25519.PublicKey, error)

GetPrivateKeySKFromBase58 - get private key type Ed25519 by string - Base58 encoded private key secretKey string - private key in Base58

func GetPrivateKeySKFromBase58Check

func GetPrivateKeySKFromBase58Check(secretKey string) (ed25519.PrivateKey, ed25519.PublicKey, error)

GetPrivateKeySKFromBase58Check - get private key type Ed25519 by string - Base58Check encoded private key secretKey string - private key in Base58Check

func GetPrivateKeySKFromHex

func GetPrivateKeySKFromHex(secretKey string) (ed25519.PrivateKey, ed25519.PublicKey, error)

GetPrivateKeySKFromHex - get private key type Ed25519 by string - hex encoded private key secretKey string - private key in hex

func NowMillisecond

func NowMillisecond() int64

func Sign

func Sign(privateKey ed25519.PrivateKey, publicKey ed25519.PublicKey, channel string, chaincode string, methodName string, args []string) ([]string, string, error)

func SignACL

func SignACL(signerInfoArray []SignerInfo, methodName string, address string, reason string, reasonID string, newPkey string) ([]string, string, error)

func SignMessage

func SignMessage(signerInfo SignerInfo, result []string) ([]byte, [32]byte, error)

Types

type HLFClient

type HLFClient struct {
	NotifierChaincodeEvents map[string]<-chan *fab.CCEvent

	ContextOptions []fabsdk.ContextOption
	// contains filtered or unexported fields
}

func (*HLFClient) AddAfterInvokeHandler

func (hlf *HLFClient) AddAfterInvokeHandler(afterInvokeHandler HlfAfterInvokeHandler)

func (*HLFClient) AddBeforeInvokeHandler

func (hlf *HLFClient) AddBeforeInvokeHandler(beforeInvokeHandler HlfBeforeInvokeHandler)

func (*HLFClient) AddChannel

func (hlf *HLFClient) AddChannel(channelID string, events ...string) error

func (*HLFClient) AddFabsdk

func (hlf *HLFClient) AddFabsdk(configProvider core2.ConfigProvider, opts ...fabsdk.Option) error

func (*HLFClient) ChaincodeVersion

func (hlf *HLFClient) ChaincodeVersion(chaincode string, peer string) (string, error)

ChaincodeVersion - only for admin user, get version for chaincode, firstly try to get version for 1.4, secondly try to get for 2.3 lifecycle

func (*HLFClient) ChaincodeVersion14

func (hlf *HLFClient) ChaincodeVersion14(client *resmgmt.Client, chaincode string, peer string) (string, error)

ChaincodeVersion14 - only for admin user, get version for chaincode for 1.4 hlf

func (*HLFClient) ChaincodeVersion23Lifecycle

func (hlf *HLFClient) ChaincodeVersion23Lifecycle(client *resmgmt.Client, chaincode string, peer string) (string, error)

ChaincodeVersion23Lifecycle - only for admin user, get version for Committed chaincode for 2.3 hlf - lifecycle

func (*HLFClient) GetBlockchainInfo

func (hlf *HLFClient) GetBlockchainInfo(channelID string, peer string) (*fab.BlockchainInfoResponse, error)

GetBlockchainInfo queries and return information about ledger (height, current block hash, and previous block hash) from peer.

func (*HLFClient) GetCCEventNotifier

func (hlf *HLFClient) GetCCEventNotifier(client *channel.Client, chaincodeName string, event string) (<-chan *fab.CCEvent, error)

func (*HLFClient) GetTransactionByID

func (hlf *HLFClient) GetTransactionByID(channelID string, transactionID string, peer string) (*peer.ProcessedTransaction, error)

GetTransactionByID - return transaction

func (*HLFClient) Invoke

func (hlf *HLFClient) Invoke(channelID string, chaincodeName string, methodName string, methodArgs []string, noBatch bool, peers ...string) (*channel.Response, error)

Invoke - method to sign arguments and send invoke request to hlf channelID string - channel name for invoke chaincodeName string - chaincode name for invoke methodName string - chaincode method name for invoke methodArgs []string - noBatch bool - if wait batchTransaction set 'true' peers string - target peer for invoke, if empty use default peer count by policy

func (*HLFClient) InvokeWithPublicAndPrivateKey

func (hlf *HLFClient) InvokeWithPublicAndPrivateKey(privateKey ed25519.PrivateKey, publicKey ed25519.PublicKey, channelID string, chaincodeName string, methodName string, methodArgs []string, noBatch bool, peers string) (*channel.Response, error)

InvokeWithPublicAndPrivateKey - method to sign arguments and send invoke request to hlf privateKey string - private key in ed25519 publicKey string - private key in ed25519 channelID string - channel name for invoke chaincodeName string - chaincode name for invoke methodName string - chaincode method name for invoke methodArgs []string - noBatch bool - if wait batchTransaction set 'true' peers string - peer0.testnet

func (*HLFClient) InvokeWithSecretKey

func (hlf *HLFClient) InvokeWithSecretKey(channelID string, chaincodeName string, methodName string, methodArgs []string, secretKey string, noBatch bool, peers string) (*channel.Response, error)

InvokeWithSecretKey - method to sign arguments and send invoke request to hlf methodArgs []string - secretKey string - private key ed25519 - in base58check, or hex or base58 chaincodeName string - chaincode name for invoke methodName string - chaincode method name for invoke noBatch bool - if wait batchTransaction set 'true' peers string - peer0.testnet.anoideaopen

func (*HLFClient) Query

func (hlf *HLFClient) Query(
	channelID string, chaincodeName string, methodName string, methodArgs []string,
) (*channel.Response, error)

func (*HLFClient) QueryBlock

func (hlf *HLFClient) QueryBlock(channelID string, blockID string, endpoints string) (*common.Block, error)

func (*HLFClient) QueryBlockByTxID

func (hlf *HLFClient) QueryBlockByTxID(channelID string, transactionID string, peer string) (*common.Block, error)

func (*HLFClient) Request

func (hlf *HLFClient) Request(
	methodArgs []string, chaincodeName string, methodName string, noBatch bool,
	client *channel.Client,
	requestFunc func(channel.Request, ...channel.RequestOption) (channel.Response, error),
	options ...channel.RequestOption,
) (*channel.Response, error)

func (*HLFClient) SignArgs

func (hlf *HLFClient) SignArgs(channelID string, chaincodeName string, methodName string, methodArgs []string, privateKey ed25519.PrivateKey, publicKey ed25519.PublicKey) ([]string, error)

type HlfAfterInvokeHandler

type HlfAfterInvokeHandler func(beforeInvokeData interface{}, r *channel.Response, invokeErr error, channelID string, chaincodeName string, methodName string, methodArgs []string, noBatch bool, peers ...string) error

type HlfBeforeInvokeHandler

type HlfBeforeInvokeHandler func(channelID string, chaincodeName string, methodName string, methodArgs []string, noBatch bool, peers ...string) (interface{}, error)

type SignerInfo

type SignerInfo struct {
	PrivateKey ed25519.PrivateKey
	PublicKey  ed25519.PublicKey
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL