LogoLogo
Threshold WebsitetBTC v2 DocsTACo Docs
  • What is the Threshold Network?
  • THRESHOLD DASHBOARD
    • tBTC Minting Walkthrough
  • Applications
    • tBTC Bitcoin Bridge
      • Fees
      • Wallet Generation
      • Wallet Signing
      • The Path to Permissionlessness
      • Sweeping
      • Coverage Pool
    • Threshold USD
      • Overview of thUSD
      • Borrowing
      • Stability Pool and Liquidations
      • Redemptions and thUSD Price Stability
      • Recovery Mode
      • Bootstrapping
        • Initial Protocol Loan
      • B. Protocol
      • thUSD on Build on Bitcoin (BOB)
        • Connecting to BOB Network
        • Bridging Collateral to BOB Network
        • Opening Collateral Vaults and Minting thUSD
  • Governance
    • Threshold DAO
      • 🗳️Governance Process
      • 🙋‍♀️Guilds
      • 💰Threshold Multisigs
      • Threshold DAO Rules
    • Vote Delegation
      • Liquid Token Delegation
  • Staking & Running a Node
    • tBTC v2 Node Setup
      • Operator Account
      • Application Authorization & Operator Registration
      • Network Configuration
      • Data Storage
      • Installation
        • Docker Installation
        • Binary Installation
      • Updating tBTC v2 Node
      • Advanced Options
        • Alternatives to Dashboard
        • Logging
        • Config File
        • CLI Options
        • Client Info
      • Frequently Asked Questions
      • Sepolia Testnet
        • Testnet tBTC v2 node Setup
    • tBTC Beta Stakers Program
  • App Development
    • DAO Contracts
      • DAO Contracts API
        • BaseTokenholderGovernor
        • Checkpoints
        • GovernorParameters
        • IApplication
        • ILegacyTokenStaking
        • IStaking
        • IVotesHistory
        • KeepStake
        • PercentUtils
        • ProxyAdminWithDeputy
        • SafeTUpgradeable
        • StakerGovernor
        • StakerGovernorVotes
        • T
        • TokenholderGovernor
        • TokenholderGovernorVotes
        • TokenStaking
        • VendingMachine
    • Random Beacon
      • Random Beacon API
        • AltBn128
        • BeaconAuthorization
        • BeaconDkg
        • BeaconDkgValidator
        • BeaconInactivity
        • BLS
        • BytesLib
        • Callback
        • Governable
        • Groups
        • IRandomBeacon
        • IRandomBeaconConsumer
        • ModUtils
        • RandomBeacon
        • RandomBeaconChaosnet
        • RandomBeaconGovernance
        • Reimbursable
        • ReimbursementPool
        • Relay
    • tBTC
      • tBTC SDK
        • Quickstart
        • Architecture
        • Guides
          • Initialize SDK
            • Ethereum and Bitcoin mainnet
            • Ethereum and Bitcoin testnet
            • Crosschain
            • Custom mode
          • Deposit and mint
          • Unmint and redeem
        • API Reference
      • tBTC Contracts API
        • Bridge API
          • Bank
          • BitcoinTx
          • Bridge
          • BridgeGovernance
          • BridgeGovernanceParameters
          • BridgeState
          • Deposit
          • DepositSweep
          • DonationVault
          • EcdsaLib
          • Fraud
          • GovernanceUtils
          • Heartbeat
          • IReceiveBalanceApproval
          • IRelay
          • IVault
          • L2TBTC
          • L2WormholeGateway
          • LightRelay
          • LightRelayMaintainerProxy
          • MaintainerProxy
          • MovingFunds
          • Redemption
          • TBTC
          • TBTCOptimisticMinting
          • TBTCVault
          • VendingMachine
          • VendingMachineV2
          • VendingMachineV3
          • WalletCoordinator
          • Wallets
        • ECDSA API
          • EcdsaAuthorization
          • EcdsaDkg
          • EcdsaDkgValidator
          • EcdsaInactivity
          • IWalletOwner
          • IWalletRegistry
          • WalletRegistry
          • WalletRegistryGovernance
          • Wallets
  • Resources
    • T Token
    • Contract Addresses
      • Mainnet
        • Threshold DAO
        • tBTC
        • thUSD
        • Legacy
      • Görli Testnet
      • Sepolia Testnet
    • tBTC Pools
    • Upgrade NU & KEEP to T
    • Contribution
    • Security
    • Brand Assets
    • Links
Powered by GitBook
On this page
  • Wallets
  • Wallet
  • Data
  • validatePublicKey
  • addWallet
  • deleteWallet
  • isWalletRegistered
  • getWalletMembersIdsHash
  • getWalletPublicKeyCoordinates
  • getWalletPublicKey

Was this helpful?

Export as PDF
  1. App Development
  2. tBTC
  3. tBTC Contracts API
  4. ECDSA API

Wallets

Wallets

Wallet

struct Wallet {
  bytes32 membersIdsHash;
  bytes32 publicKeyX;
  bytes32 publicKeyY;
}

Data

struct Data {
  mapping(bytes32 => struct Wallets.Wallet) registry;
  uint256[49] __gap;
}

validatePublicKey

function validatePublicKey(struct Wallets.Data self, bytes publicKey) internal view

Performs preliminary validation of a new group public key. The group public key must be unique and have 64 bytes in length. If the validation fails, the function reverts. This function must be called first for a public key of a wallet added with addWallet function.

Parameters

Name
Type
Description

self

struct Wallets.Data

publicKey

bytes

Uncompressed public key of a new wallet.

addWallet

function addWallet(struct Wallets.Data self, bytes32 membersIdsHash, bytes publicKey) internal returns (bytes32 walletID, bytes32 publicKeyX, bytes32 publicKeyY)

Registers a new wallet. This function does not validate parameters. The code calling this function must call validatePublicKey first.

Uses a public key hash as a unique identifier of a wallet.

Parameters

Name
Type
Description

self

struct Wallets.Data

membersIdsHash

bytes32

Keccak256 hash of group members identifiers array

publicKey

bytes

Uncompressed public key

Return Values

Name
Type
Description

walletID

bytes32

Wallet's ID

publicKeyX

bytes32

Wallet's public key's X coordinate

publicKeyY

bytes32

Wallet's public key's Y coordinate

deleteWallet

function deleteWallet(struct Wallets.Data self, bytes32 walletID) internal

Deletes wallet with the given ID from the registry. Reverts if wallet with the given ID has not been registered or if it has already been closed.

isWalletRegistered

function isWalletRegistered(struct Wallets.Data self, bytes32 walletID) internal view returns (bool)

Checks if a wallet with the given ID is registered.

Parameters

Name
Type
Description

self

struct Wallets.Data

walletID

bytes32

Wallet's ID

Return Values

Name
Type
Description

[0]

bool

True if a wallet is registered, false otherwise

getWalletMembersIdsHash

function getWalletMembersIdsHash(struct Wallets.Data self, bytes32 walletID) internal view returns (bytes32)

Returns Keccak256 hash of the wallet signing group members identifiers array. Group members do not include operators selected by the sortition pool that misbehaved during DKG. Reverts if wallet with the given ID is not registered.

Parameters

Name
Type
Description

self

struct Wallets.Data

walletID

bytes32

ID of the wallet

Return Values

Name
Type
Description

[0]

bytes32

Wallet signing group members hash

getWalletPublicKeyCoordinates

function getWalletPublicKeyCoordinates(struct Wallets.Data self, bytes32 walletID) internal view returns (bytes32 x, bytes32 y)

Gets public key of a wallet with the given wallet ID. The public key is returned as X and Y coordinates. Reverts if wallet with the given ID is not registered.

Parameters

Name
Type
Description

self

struct Wallets.Data

walletID

bytes32

ID of the wallet

Return Values

Name
Type
Description

x

bytes32

Public key X coordinate

y

bytes32

Public key Y coordinate

getWalletPublicKey

function getWalletPublicKey(struct Wallets.Data self, bytes32 walletID) internal view returns (bytes)

Gets public key of a wallet with the given wallet ID. The public key is returned in an uncompressed format as a 64-byte concatenation of X and Y coordinates. Reverts if wallet with the given ID is not registered.

Parameters

Name
Type
Description

self

struct Wallets.Data

walletID

bytes32

ID of the wallet

Return Values

Name
Type
Description

[0]

bytes

Uncompressed public key of the wallet

PreviousWalletRegistryGovernanceNextT Token

Last updated 1 year ago

Was this helpful?