crypto

package
v0.0.0-...-ffa7aea Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package crypto provides elliptic curve cryptography functionality implementing the F = K · G formula using secp256k1 curve for enterprise-grade security.

Package crypto - MultiSig implementation for Eden Core Adopting Bitcoin's multi-signature technology for source code protection

Package crypto - Script system for Eden Core Adopting Bitcoin Script for programmable code access conditions

Package crypto - TimeLock implementation for Eden Core Adopting Bitcoin's CheckLockTimeVerify (CLTV) for time-based code protection

Package crypto - UTXO implementation for Eden Core Adopting Bitcoin's Unspent Transaction Output model for code ownership tracking

Index

Constants

View Source
const (
	// KeySize is the size of encryption keys in bytes
	KeySize = 32
	// SaltSize is the size of salt used in key derivation
	SaltSize = 16
	// Iterations is the number of iterations for key derivation
	Iterations = 10000
)
View Source
const (
	// Arithmetic operations
	OP_ADD = "OP_ADD"
	OP_SUB = "OP_SUB"
	OP_MUL = "OP_MUL"
	OP_DIV = "OP_DIV"

	// Comparison operations
	OP_EQUAL       = "OP_EQUAL"
	OP_EQUALVERIFY = "OP_EQUALVERIFY"
	OP_LESSTHAN    = "OP_LESSTHAN"
	OP_GREATERTHAN = "OP_GREATERTHAN"

	// Logical operations
	OP_IF    = "OP_IF"
	OP_ELSE  = "OP_ELSE"
	OP_ENDIF = "OP_ENDIF"
	OP_NOT   = "OP_NOT"
	OP_AND   = "OP_AND"
	OP_OR    = "OP_OR"

	// Stack operations
	OP_DUP  = "OP_DUP"
	OP_DROP = "OP_DROP"
	OP_SWAP = "OP_SWAP"
	OP_ROT  = "OP_ROT"

	// Cryptographic operations
	OP_HASH160       = "OP_HASH160"
	OP_HASH256       = "OP_HASH256"
	OP_CHECKSIG      = "OP_CHECKSIG"
	OP_CHECKMULTISIG = "OP_CHECKMULTISIG"

	// Time operations (Bitcoin-style)
	OP_CHECKLOCKTIMEVERIFY = "OP_CHECKLOCKTIMEVERIFY"
	OP_CHECKSEQUENCEVERIFY = "OP_CHECKSEQUENCEVERIFY"

	// Code access specific operations
	OP_CHECKACCESS    = "OP_CHECKACCESS"
	OP_CHECKTEAM      = "OP_CHECKTEAM"
	OP_CHECKREP       = "OP_CHECKREP" // Check reputation
	OP_CHECKTIME      = "OP_CHECKTIME"
	OP_CHECKCONDITION = "OP_CHECKCONDITION"

	// Control operations
	OP_RETURN = "OP_RETURN"
	OP_VERIFY = "OP_VERIFY"
)

Script operation codes (similar to Bitcoin Script opcodes)

Variables

This section is empty.

Functions

func CreateConditionalScript

func CreateConditionalScript(condition string, trueBranch string, falseBranch string) string

CreateConditionalScript creates a conditional access script

func CreateEnterpriseAccessScript

func CreateEnterpriseAccessScript(teamName string, minRep int, timeWindow string, requireMultiSig bool) string

CreateEnterpriseAccessScript creates enterprise-grade access script

func CreateMultiSigScript

func CreateMultiSigScript(m int, pubKeys []string) string

CreateMultiSigScript creates a multi-signature script (M-of-N)

func CreateSimpleSignatureScript

func CreateSimpleSignatureScript(pubKeyHex string) string

CreateSimpleSignatureScript creates a simple signature verification script

func CreateTeamAccessScript

func CreateTeamAccessScript(teamName string, minReputation int) string

CreateTeamAccessScript creates a team-based access script

func CreateTimeLockScript

func CreateTimeLockScript(unlockTime int64, pubKeyHex string) string

CreateTimeLockScript creates a time-locked script

func DeriveKey

func DeriveKey(password, salt []byte) ([]byte, error)

DeriveKey derives a key from a password and salt using PBKDF2

func GenerateKey

func GenerateKey() ([]byte, error)

GenerateKey generates a new random key

func GenerateKeyPair

func GenerateKeyPair() ([]byte, []byte, error)

GenerateKeyPair generates a pair of public and private keys

func GenerateMultiAuthKey

func GenerateMultiAuthKey(teams []string) ([]byte, error)

GenerateMultiAuthKey generates a key for multi-authentication protection

func GenerateOwnershipKey

func GenerateOwnershipKey(ownerKey string) ([]byte, error)

GenerateOwnershipKey generates a key for ownership protection

func GeneratePolicyScriptKey

func GeneratePolicyScriptKey(scriptContent string) ([]byte, error)

GeneratePolicyScriptKey generates a key for policy script protection

func GenerateTimeLockKey

func GenerateTimeLockKey(duration string) ([]byte, error)

GenerateTimeLockKey generates a key for time-lock protection

func RotateProtectionKey

func RotateProtectionKey(oldKey []byte, config KeyRotationConfig) ([]byte, error)

RotateProtectionKey implements secure key rotation

func ValidateMultiAuthKey

func ValidateMultiAuthKey(keyData []byte, teams []string, currentUser string) error

ValidateMultiAuthKey validates multi-auth key with team membership

func ValidateOwnershipKey

func ValidateOwnershipKey(keyData []byte, ownerKey string) error

ValidateOwnershipKey validates ownership key

func ValidatePolicyScriptKey

func ValidatePolicyScriptKey(keyData []byte, scriptContent string) error

ValidatePolicyScriptKey validates policy script key

func ValidateTimeLockKey

func ValidateTimeLockKey(keyData []byte, duration string) error

ValidateTimeLockKey validates if a time-lock key is still valid

func VerifyKeyRotationPolicy

func VerifyKeyRotationPolicy(keyData []byte, config KeyRotationConfig) (bool, error)

VerifyKeyRotationPolicy checks if key rotation is needed

Types

type AccessPolicy

type AccessPolicy struct {
	RequireSignature bool         `json:"require_signature"`
	RequireMultiSig  bool         `json:"require_multisig"`
	MinReputation    int          `json:"min_reputation"`
	AllowedTeams     []string     `json:"allowed_teams"`
	TimeRestrictions []TimeWindow `json:"time_restrictions"`
	MaxAccessPerHour int          `json:"max_access_per_hour"`
	RequireApproval  bool         `json:"require_approval"`
}

AccessPolicy defines access control policy

type AccessRecord

type AccessRecord struct {
	UserPubKey string `json:"user_pubkey"`
	AccessTime int64  `json:"access_time"`
	AccessType string `json:"access_type"`
	Success    bool   `json:"success"`
}

AccessRecord represents a historical access record

type AccessVerification

type AccessVerification struct {
	UserPubKey      string   `json:"user_pubkey"`
	CodeID          string   `json:"code_id"`
	RequiredRights  []string `json:"required_rights"`
	AvailableRights []string `json:"available_rights"`
	HasAccess       bool     `json:"has_access"`
	TotalValue      int64    `json:"total_value"`
	UTXOCount       int      `json:"utxo_count"`
	Reason          string   `json:"reason"`
}

AccessVerification represents the result of access verification

type CodeAccessManager

type CodeAccessManager struct {
	// contains filtered or unexported fields
}

CodeAccessManager manages Bitcoin-style code ownership using UTXO model

func NewCodeAccessManager

func NewCodeAccessManager() (*CodeAccessManager, error)

NewCodeAccessManager creates new UTXO-based code access manager

func (*CodeAccessManager) CreateGenesisUTXO

func (cam *CodeAccessManager) CreateGenesisUTXO(codeID string, ownerPubKey string, accessRights []string) (*CodeUTXO, error)

CreateGenesisUTXO creates initial ownership UTXO for new protected code

func (*CodeAccessManager) GetCodeOwners

func (cam *CodeAccessManager) GetCodeOwners(codeID string) map[string]*OwnershipInfo

GetCodeOwners returns all current owners of a specific code

func (*CodeAccessManager) GetMyPrivateKey

func (cam *CodeAccessManager) GetMyPrivateKey() string

GetMyPrivateKey returns our private key (KEEP SECRET!)

func (*CodeAccessManager) GetMyPublicKey

func (cam *CodeAccessManager) GetMyPublicKey() string

GetMyPublicKey returns our public key

func (*CodeAccessManager) GetUTXOsForOwner

func (cam *CodeAccessManager) GetUTXOsForOwner(ownerPubKey string) []*CodeUTXO

GetUTXOsForOwner returns all UTXOs owned by a specific public key

func (*CodeAccessManager) TransferCodeAccess

func (cam *CodeAccessManager) TransferCodeAccess(senderPrivKey string, codeID string, recipientPubKey string, accessRights []string, value int64) (*CodeTransaction, error)

TransferCodeAccess transfers code access rights (like Bitcoin transaction)

func (*CodeAccessManager) VerifyCodeAccess

func (cam *CodeAccessManager) VerifyCodeAccess(userPubKey string, codeID string, requiredRights []string) (bool, *AccessVerification)

VerifyCodeAccess verifies if a user has specific access to code

type CodeTransaction

type CodeTransaction struct {
	TxID       string         `json:"tx_id"`       // Transaction identifier
	Inputs     []CodeTxInput  `json:"inputs"`      // UTXOs being spent
	Outputs    []CodeTxOutput `json:"outputs"`     // New UTXOs being created
	Timestamp  int64          `json:"timestamp"`   // Transaction timestamp
	CreatorKey string         `json:"creator_key"` // Creator's public key
	Signatures []TxSignature  `json:"signatures"`  // Digital signatures
	Fees       int64          `json:"fees"`        // Transaction fees (access value consumed)
	TxHash     string         `json:"tx_hash"`     // SHA-256 hash of transaction
}

CodeTransaction represents a transaction that moves code access rights

type CodeTxInput

type CodeTxInput struct {
	PrevTxID       string `json:"prev_tx_id"`      // Previous transaction ID
	PrevOutIndex   int    `json:"prev_out_index"`  // Previous output index
	UnlockScript   string `json:"unlock_script"`   // Script that unlocks the UTXO
	OwnerSignature string `json:"owner_signature"` // Owner's signature
	Sequence       uint32 `json:"sequence"`        // Sequence number (for time locks)
}

CodeTxInput represents an input to a code transaction (spending a UTXO)

type CodeTxOutput

type CodeTxOutput struct {
	Value        int64    `json:"value"`         // Access value
	LockScript   string   `json:"lock_script"`   // Locking script
	RecipientKey string   `json:"recipient_key"` // Recipient's public key
	AccessRights []string `json:"access_rights"` // Access permissions
	ExpiresAt    int64    `json:"expires_at"`    // Expiration time
}

CodeTxOutput represents an output of a code transaction (creating new UTXO)

type CodeUTXO

type CodeUTXO struct {
	TxID         string   `json:"tx_id"`         // Transaction ID that created this UTXO
	OutputIndex  int      `json:"output_index"`  // Output index within transaction
	CodeID       string   `json:"code_id"`       // Identifier of the protected code
	OwnerPubKey  string   `json:"owner_pubkey"`  // Current owner's public key
	AccessRights []string `json:"access_rights"` // List of permissions (read, write, execute, transfer)
	Value        int64    `json:"value"`         // Access "value" (like Bitcoin satoshis)
	CreatedAt    int64    `json:"created_at"`    // Creation timestamp
	ExpiresAt    int64    `json:"expires_at"`    // Expiration timestamp (0 = never expires)
	LockScript   string   `json:"lock_script"`   // Script that must be satisfied to spend
	IsSpent      bool     `json:"is_spent"`      // Whether this UTXO has been spent
}

CodeUTXO represents an Unspent Code Access Output (like Bitcoin UTXO)

type EllipticCrypto

type EllipticCrypto struct {
	// contains filtered or unexported fields
}

EllipticCrypto implements elliptic curve cryptography using F = K · G formula

func LoadEllipticCryptoFromHex

func LoadEllipticCryptoFromHex(privateKeyHex string) (*EllipticCrypto, error)

LoadEllipticCryptoFromHex loads EllipticCrypto from existing private key

func NewEllipticCrypto

func NewEllipticCrypto() (*EllipticCrypto, error)

NewEllipticCrypto creates new elliptic curve cryptographic engine Implements the fundamental cryptographic formula: F = K · G

func (*EllipticCrypto) GetCurveInfo

func (ec *EllipticCrypto) GetCurveInfo() map[string]interface{}

GetCurveInfo returns information about the elliptic curve

func (*EllipticCrypto) GetPrivateKeyHex

func (ec *EllipticCrypto) GetPrivateKeyHex() string

GetPrivateKeyHex returns private key as hex string (KEEP SECRET!)

func (*EllipticCrypto) GetPublicKeyHex

func (ec *EllipticCrypto) GetPublicKeyHex() string

GetPublicKeyHex returns public key as hex string (F = K · G result)

func (*EllipticCrypto) ProtectWithECC

func (ec *EllipticCrypto) ProtectWithECC(data []byte) (*EllipticCurveProtection, error)

ProtectWithECC protects data using elliptic curve cryptography This is UNBREAKABLE with current technology (same security level as major cryptocurrencies)

func (*EllipticCrypto) SecurityLevel

func (ec *EllipticCrypto) SecurityLevel() int

SecurityLevel returns the security level in bits (equivalent to major cryptocurrencies)

func (*EllipticCrypto) UnprotectWithECC

func (ec *EllipticCrypto) UnprotectWithECC(protection *EllipticCurveProtection) ([]byte, error)

UnprotectWithECC recovers original data using elliptic curve cryptography

func (*EllipticCrypto) VerifyEllipticFormula

func (ec *EllipticCrypto) VerifyEllipticFormula() bool

VerifyEllipticFormula verifies that F = K · G

type EllipticCurveProtection

type EllipticCurveProtection struct {
	EncryptedData []byte `json:"encrypted_data"`
	PublicKeyX    []byte `json:"public_key_x"`  // F = K · G (X coordinate)
	PublicKeyY    []byte `json:"public_key_y"`  // F = K · G (Y coordinate)
	SharedSecret  []byte `json:"shared_secret"` // For ECDH
	Signature     []byte `json:"signature"`     // Digital signature
	Hash          []byte `json:"hash"`          // SHA256 hash
	Nonce         []byte `json:"nonce"`         // Random nonce
}

EllipticCurveProtection represents protection using elliptic curve

type KeyRotationConfig

type KeyRotationConfig struct {
	RotationInterval time.Duration // How often keys should be rotated
	RetentionPeriod  time.Duration // How long to keep old keys
	EmergencyKeys    []string      // Backup keys for emergency access
	NotifyBefore     time.Duration // Notification period before rotation
}

KeyRotationConfig represents configuration for automatic key rotation

type MultiSigConfig

type MultiSigConfig struct {
	RequiredSignatures int      `json:"required_signatures"` // M (minimum required)
	TotalSigners       int      `json:"total_signers"`       // N (total possible)
	PublicKeys         []string `json:"public_keys"`         // All signer public keys
	Description        string   `json:"description"`         // Human readable description
}

MultiSigConfig represents multi-signature configuration (M-of-N)

func CreateTeamMultiSigConfig

func CreateTeamMultiSigConfig(teamName string, requiredSigs int, memberPubKeys []string) *MultiSigConfig

CreateTeamMultiSigConfig creates a predefined multi-sig config for teams

type MultiSigCrypto

type MultiSigCrypto struct {
	// contains filtered or unexported fields
}

MultiSigCrypto implements Bitcoin-style multi-signature cryptography

func NewMultiSigCrypto

func NewMultiSigCrypto(config *MultiSigConfig) (*MultiSigCrypto, error)

NewMultiSigCrypto creates new multi-signature crypto engine Implements Bitcoin's M-of-N multi-signature scheme

func (*MultiSigCrypto) AddSignature

func (msc *MultiSigCrypto) AddSignature(protection *MultiSigProtection, signerPrivateKeyHex string) error

AddSignature adds a signature from another authorized signer

func (*MultiSigCrypto) CreateMultiSigProtection

func (msc *MultiSigCrypto) CreateMultiSigProtection(sourceCode []byte) (*MultiSigProtection, error)

CreateMultiSigProtection protects code with Bitcoin-style multi-signature

func (*MultiSigCrypto) GetMultiSigStatus

func (msc *MultiSigCrypto) GetMultiSigStatus(protection *MultiSigProtection) map[string]interface{}

GetMultiSigStatus returns current status of multi-sig protection

func (*MultiSigCrypto) GetMyPrivateKey

func (msc *MultiSigCrypto) GetMyPrivateKey() string

GetMyPrivateKey returns our private key (KEEP SECRET!)

func (*MultiSigCrypto) GetMyPublicKey

func (msc *MultiSigCrypto) GetMyPublicKey() string

GetMyPublicKey returns our public key for sharing with other signers

func (*MultiSigCrypto) VerifyAndUnlock

func (msc *MultiSigCrypto) VerifyAndUnlock(protection *MultiSigProtection) ([]byte, error)

VerifyAndUnlock verifies signatures and unlocks protected code Implements Bitcoin's signature verification logic

type MultiSigEntry

type MultiSigEntry struct {
	SignerPubKey string `json:"signer_pubkey"` // Public key of signer
	Signature    string `json:"signature"`     // ECDSA signature
	SignedAt     int64  `json:"signed_at"`     // Signature timestamp
	NodeID       string `json:"node_id"`       // Network node identifier
}

MultiSigEntry represents a single signature in the multi-sig scheme

type MultiSigProtection

type MultiSigProtection struct {
	EncryptedData []byte          `json:"encrypted_data"`
	ConfigHash    string          `json:"config_hash"` // Hash of MultiSig config
	Signatures    []MultiSigEntry `json:"signatures"`  // Collected signatures
	Threshold     int             `json:"threshold"`   // Required signature count
	CodeHash      string          `json:"code_hash"`   // SHA-256 of original code
	Timestamp     int64           `json:"timestamp"`   // Protection timestamp
}

MultiSigProtection represents Bitcoin-style multi-signature protected code

type OwnershipInfo

type OwnershipInfo struct {
	OwnerPubKey  string          `json:"owner_pubkey"`
	TotalValue   int64           `json:"total_value"`
	AccessRights map[string]bool `json:"access_rights"`
	UTXOCount    int             `json:"utxo_count"`
}

OwnershipInfo represents ownership information for a code

type ScriptContext

type ScriptContext struct {
	CodeID          string                 `json:"code_id"`
	RequesterPubKey string                 `json:"requester_pubkey"`
	Timestamp       int64                  `json:"timestamp"`
	BlockHeight     int64                  `json:"block_height"`
	NetworkState    map[string]interface{} `json:"network_state"`
	TeamMembers     []string               `json:"team_members"`
	AccessHistory   []AccessRecord         `json:"access_history"`
}

ScriptContext provides context for script execution

type ScriptCrypto

type ScriptCrypto struct {
	// contains filtered or unexported fields
}

ScriptCrypto implements Bitcoin Script-based cryptography

func NewScriptCrypto

func NewScriptCrypto() (*ScriptCrypto, error)

NewScriptCrypto creates new script-based crypto engine

func (*ScriptCrypto) CreateScriptProtection

func (sc *ScriptCrypto) CreateScriptProtection(sourceCode []byte, lockScript string, policy AccessPolicy) (*ScriptProtection, error)

CreateScriptProtection creates script-protected code

func (*ScriptCrypto) GetMyPublicKey

func (sc *ScriptCrypto) GetMyPublicKey() string

GetMyPublicKey returns our public key

func (*ScriptCrypto) UnlockScriptProtection

func (sc *ScriptCrypto) UnlockScriptProtection(protection *ScriptProtection, unlockScript string, context *ScriptContext) ([]byte, error)

UnlockScriptProtection unlocks script-protected code

type ScriptEngine

type ScriptEngine struct {
	// contains filtered or unexported fields
}

ScriptEngine represents Bitcoin-style script execution engine

func NewScriptEngine

func NewScriptEngine(script string, context *ScriptContext) *ScriptEngine

NewScriptEngine creates new script execution engine

func (*ScriptEngine) Execute

func (se *ScriptEngine) Execute() (bool, error)

Execute executes the script and returns true if successful

func (*ScriptEngine) GetExecutionLog

func (se *ScriptEngine) GetExecutionLog() []string

GetExecutionLog returns script execution log for debugging

type ScriptProtection

type ScriptProtection struct {
	EncryptedData []byte       `json:"encrypted_data"`
	LockScript    string       `json:"lock_script"`    // Script that must evaluate to true
	ScriptHash    string       `json:"script_hash"`    // Hash of lock script
	CodeHash      string       `json:"code_hash"`      // Hash of original code
	CreatorPubKey string       `json:"creator_pubkey"` // Creator's public key
	CreatedAt     int64        `json:"created_at"`     // Creation timestamp
	AccessPolicy  AccessPolicy `json:"access_policy"`  // Access policy configuration
}

ScriptProtection represents script-protected code

type TimeLockConfig

type TimeLockConfig struct {
	LockType         TimeLockType `json:"lock_type"`
	LockValue        int64        `json:"lock_value"`         // Timestamp, duration, or block height
	CreatedAt        int64        `json:"created_at"`         // Creation timestamp
	Description      string       `json:"description"`        // Human readable description
	AllowEarlyUnlock bool         `json:"allow_early_unlock"` // Emergency unlock flag
	UnlockCondition  string       `json:"unlock_condition"`   // Custom condition (for condition type)
}

TimeLockConfig represents Bitcoin-style time lock configuration

func CreateAbsoluteTimeLock

func CreateAbsoluteTimeLock(unlockTime time.Time, description string) TimeLockConfig

CreateAbsoluteTimeLock creates lock until specific date

func CreateDailyTimeLock

func CreateDailyTimeLock(description string) TimeLockConfig

CreateDailyTimeLock creates a 24-hour time lock

func CreateProductionTimeLock

func CreateProductionTimeLock(releaseDate time.Time) TimeLockConfig

CreateProductionTimeLock creates lock for production releases

func CreateWeeklyTimeLock

func CreateWeeklyTimeLock(description string) TimeLockConfig

CreateWeeklyTimeLock creates a 7-day time lock

type TimeLockCrypto

type TimeLockCrypto struct {
	// contains filtered or unexported fields
}

TimeLockCrypto implements Bitcoin-style time lock cryptography

func NewTimeLockCrypto

func NewTimeLockCrypto() (*TimeLockCrypto, error)

NewTimeLockCrypto creates new time lock crypto engine

func (*TimeLockCrypto) CheckTimeLockStatus

func (tlc *TimeLockCrypto) CheckTimeLockStatus(protection *TimeLockProtection) (*TimeLockStatus, error)

CheckTimeLockStatus checks if time lock can be unlocked (Bitcoin CLTV logic)

func (*TimeLockCrypto) CreateTimeLockProtection

func (tlc *TimeLockCrypto) CreateTimeLockProtection(sourceCode []byte, config TimeLockConfig) (*TimeLockProtection, error)

CreateTimeLockProtection creates time-locked protection (Bitcoin CLTV style)

func (*TimeLockCrypto) GetMyPrivateKey

func (tlc *TimeLockCrypto) GetMyPrivateKey() string

GetMyPrivateKey returns our private key (KEEP SECRET!)

func (*TimeLockCrypto) GetMyPublicKey

func (tlc *TimeLockCrypto) GetMyPublicKey() string

GetMyPublicKey returns our public key for verification

func (*TimeLockCrypto) UnlockTimeLockProtection

func (tlc *TimeLockCrypto) UnlockTimeLockProtection(protection *TimeLockProtection, emergencyKey string) ([]byte, error)

UnlockTimeLockProtection unlocks time-locked code if conditions are met

type TimeLockProtection

type TimeLockProtection struct {
	EncryptedData    []byte         `json:"encrypted_data"`
	TimeLockConfig   TimeLockConfig `json:"timelock_config"`
	CreatorSignature string         `json:"creator_signature"`
	ConfigHash       string         `json:"config_hash"`
	CodeHash         string         `json:"code_hash"`
	UnlockAttempts   int            `json:"unlock_attempts"`
	LastAttemptAt    int64          `json:"last_attempt_at"`
	IsUnlocked       bool           `json:"is_unlocked"`
}

TimeLockProtection represents time-locked protected code

type TimeLockStatus

type TimeLockStatus struct {
	CanUnlock     bool   `json:"can_unlock"`
	TimeRemaining int64  `json:"time_remaining"`
	LockType      string `json:"lock_type"`
	CurrentTime   int64  `json:"current_time"`
	UnlockTime    int64  `json:"unlock_time"`
	Reason        string `json:"reason"`
}

TimeLockStatus represents current status of time lock

type TimeLockType

type TimeLockType string

TimeLockType represents different types of time-based locks

const (
	TimeLockAbsolute    TimeLockType = "absolute"    // Lock until specific timestamp
	TimeLockRelative    TimeLockType = "relative"    // Lock for duration from creation
	TimeLockBlockHeight TimeLockType = "blockheight" // Lock until specific network block height
	TimeLockCondition   TimeLockType = "condition"   // Lock until custom condition met
)

type TimeWindow

type TimeWindow struct {
	StartHour int   `json:"start_hour"` // 0-23
	EndHour   int   `json:"end_hour"`   // 0-23
	Days      []int `json:"days"`       // 0=Sunday, 1=Monday, etc.
}

TimeWindow represents allowed access time windows

type TxSignature

type TxSignature struct {
	SignerPubKey string `json:"signer_pubkey"` // Signer's public key
	Signature    string `json:"signature"`     // ECDSA signature
	SigType      string `json:"sig_type"`      // Signature type (SIGHASH_ALL, etc.)
}

TxSignature represents a digital signature on a transaction

type UTXOSet

type UTXOSet struct {
	// contains filtered or unexported fields
}

UTXOSet represents the set of unspent code access outputs

Jump to

Keyboard shortcuts

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