transaction

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMspPolicy

func CreateMspPolicy(policy string) (*applicationpb.NamespacePolicy, error)

CreateMspPolicy creates an MSP-based namespace policy from a DSL expression. Example: "OR('Org1MSP.member', 'Org2MSP.member')" or "AND('Org1MSP.admin', 'Org2MSP.admin')".

func CreateNamespacesTx

func CreateNamespacesTx(nsPolicy *applicationpb.NamespacePolicy, nsID string, nsVersion int) *applicationpb.Tx

CreateNamespacesTx builds a transaction to create or update a namespace policy. Writes to the meta-namespace. Use version -1 for create, >= 0 for update.

func CreateThresholdPolicy

func CreateThresholdPolicy(path string) (*applicationpb.NamespacePolicy, error)

CreateThresholdPolicy creates a threshold ECDSA namespace policy from a PEM file. The file must contain an ECDSA public key or X.509 certificate with an ECDSA key.

func Endorse

func Endorse(signer msp.SigningIdentity, txID string, tx *applicationpb.Tx) (*applicationpb.Tx, error)

Endorse signs a transaction with the provided identity for all namespaces. Returns a cloned transaction with added endorsements. Currently uses threshold ECDSA; MSP-based endorsement support is planned.

func GenerateTxID

func GenerateTxID() string

GenerateTxID generates a unique transaction ID using SHA-256 hash of a random nonce.

func Merge

func Merge(txs []*applicationpb.Tx) (*applicationpb.Tx, error)

Merge combines multiple endorsed transactions into a single transaction. It validates that all transactions have identical namespace content, then merges their endorsements while deduplicating by MSP ID. Requires at least 2 transactions. The merged endorsements are sorted alphabetically by MSP ID.

func ValidateVersion

func ValidateVersion(v int) error

ValidateVersion checks if version is valid: -1 for create, >= 0 for update.

Types

This section is empty.

Jump to

Keyboard shortcuts

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