当前位置: 首页>>代码示例>>Python>>正文


Python BDM.TheBDM类代码示例

本文整理汇总了Python中armoryengine.BDM.TheBDM的典型用法代码示例。如果您正苦于以下问题:Python TheBDM类的具体用法?Python TheBDM怎么用?Python TheBDM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TheBDM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

 def setUp(self):
    self.verifyBlockHeight()
    # Load the primary file from the test net in a box
    self.fileA    = os.path.join(self.tiab.tiabDirectory, 'tiab\\armory\\armory_%s_.wallet' % TEST_WALLET_ID)
    self.wlt = PyBtcWallet().readWalletFile(self.fileA, doScanNow=True)
    self.jsonServer = Armory_Json_Rpc_Server(self.wlt)
    TheBDM.registerWallet(self.wlt)
开发者ID:AndyOfiesh,项目名称:BitcoinArmoryTest,代码行数:7,代码来源:ArmoryDTiabTest.py

示例2: stopBitcoind

   def stopBitcoind(self):
      LOGINFO('Called stopBitcoind')
      if self.bitcoind == False:
         self.bitcoind = None
         return
      try:
         if not self.isRunningBitcoind():
            LOGINFO('...but bitcoind is not running, to be able to stop')
            return
         
         from armoryengine.BDM import TheBDM
         cookie = TheBDM.getCookie()
         TheBDM.bdv().shutdownNode(cookie);

         #poll the pid until it's gone, for as long as 2 minutes
         total = 0
         while self.bitcoind.poll()==None:
            time.sleep(0.1)
            total += 1

            if total > 1200:
               LOGERROR("bitcoind failed to shutdown in less than 2 minutes."
                      " Terminating.")
               return

         self.bitcoind = None
      except Exception as e:
         LOGERROR(e)
         return
开发者ID:Rudd-O,项目名称:BitcoinArmory,代码行数:29,代码来源:SDM.py

示例3: setUpClass

 def setUpClass(self):
    # This is not a UI so no need to worry about the main thread being blocked.
    # Any UI that uses this Daemon can put the call to the Daemon on it's own thread.
    TheBDM.setBlocking(True)
    TheBDM.setOnlineMode(True)
    while not TheBDM.getBDMState()=='BlockchainReady':
       time.sleep(2)
开发者ID:aburan28,项目名称:BitcoinArmory,代码行数:7,代码来源:ArmoryDTest.py

示例4: createNewWalletFromWizard

   def createNewWalletFromWizard(self):
      self.newWallet = PyBtcWallet().createNewWallet( \
                     securePassphrase=self.setPassphrasePage.pageFrame.getPassphrase(), \
                     kdfTargSec=self.walletCreationPage.pageFrame.getKdfSec(), \
                     kdfMaxMem=self.walletCreationPage.pageFrame.getKdfBytes(), \
                     shortLabel=self.walletCreationPage.pageFrame.getName(), \
                     longLabel=self.walletCreationPage.pageFrame.getDescription(), \
                     doRegisterWithBDM=False, \
                     extraEntropy=self.main.getExtraEntropyForKeyGen())

      self.newWallet.unlock(securePassphrase=
               SecureBinaryData(self.setPassphrasePage.pageFrame.getPassphrase()))
      # We always want to fill the address pool, right away.  
      fillPoolProgress = DlgProgress(self, self.main, HBar=1, \
                                     Title="Creating Wallet") 
      fillPoolProgress.exec_(self.newWallet.fillAddressPool, doRegister=False,
                             Progress=fillPoolProgress.UpdateHBar)

      # Reopening from file helps make sure everything is correct -- don't
      # let the user use a wallet that triggers errors on reading it
      wltpath = self.newWallet.walletPath
      walletFromDisk = PyBtcWallet().readWalletFile(wltpath)
      self.main.addWalletToApplication(walletFromDisk, walletIsNew=True)
      if TheBDM.getBDMState() in ('Uninitialized', 'Offline'):
         TheBDM.registerWallet(walletFromDisk, isFresh=True, wait=False)
      else:
         self.main.newWalletList.append([walletFromDisk, True])
开发者ID:AsherBond,项目名称:BitcoinArmory,代码行数:27,代码来源:Wizards.py

示例5: setUp

   def setUp(self):
      self.verifyBlockHeight()
      self.fileA    = os.path.join(self.armoryHomeDir, 'armory_%s_.wallet' % TEST_WALLET_ID)
      self.fileB    = os.path.join(self.armoryHomeDir, 'armory_%s_backup.wallet' % TEST_WALLET_ID)
      self.fileAupd = os.path.join(self.armoryHomeDir, 'armory_%s_backup_unsuccessful.wallet' % TEST_WALLET_ID)
      self.fileBupd = os.path.join(self.armoryHomeDir, 'armory_%s_update_unsuccessful.wallet' % TEST_WALLET_ID)

      self.removeFileList([self.fileA, self.fileB, self.fileAupd, self.fileBupd])
   
      # We need a controlled test, so we script the all the normally-random stuff
      self.privKey   = SecureBinaryData('\xaa'*32)
      self.privKey2  = SecureBinaryData('\x33'*32)
      self.chainstr  = SecureBinaryData('\xee'*32)
      theIV     = SecureBinaryData(hex_to_binary('77'*16))
      self.passphrase  = SecureBinaryData('A self.passphrase')
      self.passphrase2 = SecureBinaryData('A new self.passphrase')

      self.wallet = PyBtcWallet().createNewWallet(withEncrypt=False, \
                                          plainRootKey=self.privKey, \
                                          chaincode=self.chainstr,   \
                                          IV=theIV, \
                                          shortLabel=TEST_WALLET_NAME, \
                                          longLabel=TEST_WALLET_DESCRIPTION,
                                          armoryHomeDir = self.armoryHomeDir)
      self.jsonServer = Armory_Json_Rpc_Server(self.wallet)
      TheBDM.registerWallet(self.wallet)
开发者ID:AsherBond,项目名称:BitcoinArmory,代码行数:26,代码来源:testArmoryD.py

示例6: distributeBtc

def distributeBtc(masterWallet, amount, sendingAddrList):
   pytx = None
   setupTheBDM()
   try:
      recipValuePairs = []
      utxoList = []
      for sendingAddr in sendingAddrList:
         addr160 = sendingAddr.getAddr160()
         # Make sure the sending addresses are in the masterWallet
         if not masterWallet.hasAddr(addr160):
            raise WalletAddressError, 'Address is not in wallet! [%s]' % sendingAddr.getAddrStr()
         utxoList.extend(masterWallet.getAddrTxOutList(addr160))
   

      for importedAddr in masterWallet.getLinearAddrList():
         if importedAddr.chainIndex<0:
            recipValuePairs.append((importedAddr.getAddr160(),amount))
      totalSpend = len(recipValuePairs)*amount
      fee = calcMinSuggestedFees(utxoList, totalSpend, MIN_RELAY_TX_FEE, len(recipValuePairs))
      # Get the necessary utxo list
      selectedUtxoList = PySelectCoins(utxoList, totalSpend, fee)
      # get total value   
      totalAvailable = sum([u.getValue() for u in selectedUtxoList])
      totalChange = totalAvailable - (totalSpend + fee)

      # Make sure there are funds to cover the transaction.
      if totalChange < 0:
         print '***ERROR: you are trying to spend more than your balance!'
         raise NegativeValueError
      recipValuePairs.append((masterWallet.getNextUnusedAddress().getAddr160(), totalChange ))

      # ACR:  To support P2SH in general, had to change createFromTxOutSelection
      #       to take full scripts, not just hash160 values.  Convert the list
      #       before passing it in
      scrPairs = [[hash160_to_p2pkhash_script(r), v] for r,v in recipValuePairs]
            # we're providing a key map for the inputs.
      pubKeyMap = {}
      for utxo in selectedUtxoList:
         scrType = getTxOutScriptType(utxo.getScript())
         if scrType in CPP_TXOUT_STDSINGLESIG:
            scrAddr = utxo.getRecipientScrAddr()
            a160 = scrAddr_to_hash160(scrAddr)[1]
            addrObj = masterWallet.getAddrByHash160(a160)
            if addrObj:
               pubKeyMap[scrAddr] = addrObj.binPublicKey65.toBinStr()

      ustx = UnsignedTransaction().createFromTxOutSelection(selectedUtxoList, scrPairs, pubKeyMap)
      
      masterWallet.unlock(securePassphrase = SecureBinaryData(getpass('Enter your secret string:')))
      # Sign and prepare the final transaction for broadcast
      masterWallet.signUnsignedTx(ustx)
      pytx = ustx.getPyTxSignedIfPossible()
   
      print '\nSigned transaction to be broadcast using Armory "offline transactions"...'
      print ustx.serializeAscii()
   finally:
      TheBDM.beginCleanShutdown()
   return pytx
开发者ID:CarltonCode,项目名称:BitcoinArmory,代码行数:58,代码来源:PromoKit.py

示例7: setupTheBDM

def setupTheBDM():
   TheBDM.setBlocking(True)
   if not TheBDM.isInitialized():
      TheBDM.registerWallet(masterWallet)
      TheBDM.setOnlineMode(True)
      # Only executed on the first call if blockchain not loaded yet.
      LOGINFO('Blockchain loading')
      while not TheBDM.getBDMState()=='BlockchainReady':
         LOGINFO('Blockchain Not Ready Yet %s' % TheBDM.getBDMState())
         time.sleep(2)
开发者ID:007pig,项目名称:BitcoinArmory,代码行数:10,代码来源:PromoKit.py

示例8: __init__

    def __init__(self, parent, main):
        super(WalletWizard, self).__init__(parent, main)
        self.newWallet = None
        self.isBackupCreated = False
        self.setWindowTitle(tr("Wallet Creation Wizard"))
        self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
        self.setOption(QWizard.IgnoreSubTitles, on=True)

        # Page 1: Create Wallet
        self.walletCreationPage = WalletCreationPage(self)
        self.addPage(self.walletCreationPage)

        # Page 2: Set Passphrase
        self.setPassphrasePage = SetPassphrasePage(self)
        self.addPage(self.setPassphrasePage)

        # Page 3: Verify Passphrase
        self.verifyPassphrasePage = VerifyPassphrasePage(self)
        self.addPage(self.verifyPassphrasePage)

        # Page 4: Create Paper Backup
        self.walletBackupPage = WalletBackupPage(self)
        self.addPage(self.walletBackupPage)

        # Page 5: Create Watching Only Wallet -- but only if expert, or offline
        self.hasCWOWPage = False
        if self.main.usermode == USERMODE.Expert or TheBDM.getState() == BDM_OFFLINE:
            self.hasCWOWPage = True
            self.createWOWPage = CreateWatchingOnlyWalletPage(self)
            self.addPage(self.createWOWPage)

        self.setButtonLayout([QWizard.BackButton, QWizard.Stretch, QWizard.NextButton, QWizard.FinishButton])
开发者ID:IcantBelieveItsNotMoney,项目名称:BitcoinArmory,代码行数:32,代码来源:Wizards.py

示例9: updateOnCoinControl

   def updateOnCoinControl(self):
      useAllAddr = (self.altBalance == None)
      wlt = self.main.walletMap[self.getSelectedWltID()]
      fullBal = wlt.getBalance('Spendable')
      if useAllAddr:
         self.dispID.setText(wlt.uniqueIDB58)
         self.dispName.setText(wlt.labelName)
         self.dispDescr.setText(wlt.labelDescr)
         if fullBal == 0:
            self.dispBal.setText('0.0', color='TextRed', bold=True)
         else:
            self.dispBal.setValueText(fullBal, wBold=True)
      else:
         self.dispID.setText(wlt.uniqueIDB58 + '*')
         self.dispName.setText(wlt.labelName + '*')
         self.dispDescr.setText('*Coin Control Subset*', color='TextBlue', bold=True)
         self.dispBal.setText(coin2str(self.altBalance, maxZeros=0), color='TextBlue')
         rawValTxt = str(self.dispBal.text())
         self.dispBal.setText(rawValTxt + ' <font color="%s">(of %s)</font>' % \
                                    (htmlColor('DisableFG'), coin2str(fullBal, maxZeros=0)))

      if not TheBDM.getState() == BDM_BLOCKCHAIN_READY:
         self.dispBal.setText('(available when online)', color='DisableFG')
      self.repaint()
      if self.coinControlCallback:
         self.coinControlCallback(self.sourceAddrList, self.altBalance)
开发者ID:Groestlcoin,项目名称:GroestlcoinArmory,代码行数:26,代码来源:WalletFrames.py

示例10: searchItem

 def searchItem():
    searchString = str(self.searchEntry.text())
    if len(searchString) > 0:
       likelyDataType = isLikelyDataType(searchString)    
       for wltID, wlt in self.main.walletMap.iteritems():
          if wlt.hasAddr(searchString):
             searchHash = searchString if likelyDataType == DATATYPE.Hex \
                   else addrStr_to_hash160(searchString)[1]
             dialog = DlgAddressInfo(wlt, searchHash, main=self.main)
             dialog.exec_()
             break
          if likelyDataType == DATATYPE.Hex:
             walletLedger = wlt.cppWallet.getTxLedger()
             txHashToFind = hex_to_binary(searchString, endOut=BIGENDIAN)
             txFound = False
             for entry in walletLedger:
                if entry.getTxHash() ==  txHashToFind:
                   cppTx = TheBDM.getTxByHash(txHashToFind)
                   serializedCppTx = cppTx.serialize()
                   pytx = PyTx().unserialize(serializedCppTx)
                   DlgDispTxInfo(pytx, wlt, self.main, self.main).exec_()
                   txFound = True
                   break
             if txFound:
                break
开发者ID:Bitcoinsulting,项目名称:BitcoinArmorydev,代码行数:25,代码来源:SearchPlugin.py

示例11: distributeBtc

def distributeBtc(masterWallet, amount, sendingAddrList):
   pytx = None
   setupTheBDM()
   try:
      recipValuePairs = []
      utxoList = []
      for sendingAddr in sendingAddrList:
         addr160 = sendingAddr.getAddr160()
         # Make sure the sending addresses are in the masterWallet
         if not masterWallet.hasAddr(addr160):
            raise WalletAddressError, 'Address is not in wallet! [%s]' % sendingAddr.getAddrStr()
         utxoList.extend(masterWallet.getAddrTxOutList(addr160))
   

      for importedAddr in masterWallet.getLinearAddrList():
         if importedAddr.chainIndex<0:
            recipValuePairs.append((importedAddr.getAddr160(),amount))
      totalSpend = len(recipValuePairs)*amount
      fee = calcMinSuggestedFees(utxoList, totalSpend, MIN_RELAY_TX_FEE, len(recipValuePairs))[1]
      # Get the necessary utxo list
      selectedUtxoList = PySelectCoins(utxoList, totalSpend, fee)
      # get total value   
      totalAvailable = sum([u.getValue() for u in selectedUtxoList])
      totalChange = totalAvailable - (totalSpend + fee)

      # Make sure there are funds to cover the transaction.
      if totalChange < 0:
         print '***ERROR: you are trying to spend more than your balance!'
         raise NegativeValueError
      recipValuePairs.append((masterWallet.getNextUnusedAddress().getAddr160(), totalChange ))

      # ACR:  To support P2SH in general, had to change createFromTxOutSelection
      #       to take full scripts, not just hash160 values.  Convert the list
      #       before passing it in
      scrPairs = [[hash160_to_p2pkhash_script(r), v] for r,v in recipValuePairs]
      txdp = PyTxDistProposal().createFromTxOutSelection(selectedUtxoList, scrPairs)
      
      masterWallet.unlock(securePassphrase = SecureBinaryData(getpass('Enter your secret string:')))
      # Sign and prepare the final transaction for broadcast
      masterWallet.signTxDistProposal(txdp)
      pytx = txdp.prepareFinalTx()
   
      print '\nSigned transaction to be broadcast using Armory "offline transactions"...'
      print txdp.serializeAscii()
   finally:
      TheBDM.execCleanShutdown()
   return pytx
开发者ID:007pig,项目名称:BitcoinArmory,代码行数:47,代码来源:PromoKit.py

示例12: getTxFee

 def getTxFee(tx):
    btcIn, btcOut = 0,0
    
    for i in range(tx.getNumTxIn()):
       btcIn += TheBDM.getSentValue(tx.getTxIn(i))
    for i in range(tx.getNumTxOut()):
       btcOut += tx.getTxOut(i).getValue()
    return (btcIn - btcOut)
开发者ID:waldoalvarez00,项目名称:BitcoinArmory,代码行数:8,代码来源:sample_armory_code.py

示例13: tearDownClass

 def tearDownClass(self):
    def tiabBDMShutdownCallback(action, arg):
       global doneShuttingDownBDM
       if action == STOPPED_ACTION:
          doneShuttingDownBDM = True
    
    TheBDM.registerCppNotification(tiabBDMShutdownCallback)
    TheBDM.beginCleanShutdown()
    
    i = 0
    while not doneShuttingDownBDM:
       time.sleep(0.5)
       i += 1
       if i >= 40:
          raise RuntimeError("Timeout waiting for TheBDM to shutdown.")
    
    self.tiab.clean()
开发者ID:Bitcoinsulting,项目名称:BitcoinArmorydev,代码行数:17,代码来源:Tiab.py

示例14: setUpClass

 def setUpClass(self):
    global doneShuttingDownBDM
    doneShuttingDownBDM = False
    
    # Handle both calling the this test from the context of the test directory
    # and calling this test from the context of the main directory. 
    # The latter happens if you run all of the tests in the directory
    if os.path.exists(TIAB_ZIPFILE_NAME):
       tiabZipPath = TIAB_ZIPFILE_NAME
    elif os.path.exists(os.path.join('pytest',TIAB_ZIPFILE_NAME)):
       tiabZipPath = (os.path.join('pytest',TIAB_ZIPFILE_NAME))
    else:
       self.fail(NEED_TIAB_MSG)
    self.tiab = TiabSession(tiabZipPath=tiabZipPath)
    
    newTheBDM()
    self.armoryHomeDir = os.path.join(self.tiab.tiabDirectory,'tiab','armory')
    TheBDM.setSatoshiDir(os.path.join(self.tiab.tiabDirectory,'tiab','1','testnet3'))
    TheBDM.setArmoryDBDir(os.path.join(self.tiab.tiabDirectory,'tiab','armory','databases'))
    TheBDM.goOnline(armoryDBDir=self.armoryHomeDir)
    
    i = 0
    while not TheBDM.getState()==BDM_BLOCKCHAIN_READY:
       time.sleep(2)
       i += 1
       if i >= 60:
          raise RuntimeError("Timeout waiting for TheBDM to get into BlockchainReady state.")
开发者ID:Bitcoinsulting,项目名称:BitcoinArmorydev,代码行数:27,代码来源:Tiab.py

示例15: setUp

 def setUp(self):
    self.verifyBlockHeight()
    # Load the primary file from the test net in a box
    self.fileA = os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory', \
                              'armory_%s_.wallet' % FIRST_WLT_NAME)
    self.wltA  = PyBtcWallet().readWalletFile(self.fileA, doScanNow=True)
    self.fileB = os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory', \
                              'armory_%s_.wallet' % SECOND_WLT_NAME)
    self.wltB  = PyBtcWallet().readWalletFile(self.fileB, doScanNow=True)
    self.fileC = os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory', \
                              'armory_%s_.wallet' % THIRD_WLT_NAME)
    self.wltC  = PyBtcWallet().readWalletFile(self.fileC, doScanNow=True)
    self.jsonServer = Armory_Json_Rpc_Server(self.wltA, \
                                  inWltMap={SECOND_WLT_NAME : self.wltB, \
                                            THIRD_WLT_NAME : self.wltC}, \
                     armoryHomeDir=os.path.join(self.tiab.tiabDirectory, \
                                                'tiab','armory'))
    TheBDM.registerWallet(self.wltA)
开发者ID:AsherBond,项目名称:BitcoinArmory,代码行数:18,代码来源:testArmoryDTiab.py


注:本文中的armoryengine.BDM.TheBDM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。