Bitcoin Forum
November 07, 2024, 03:52:38 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What would you like to see in armoryd?  (Read 1381 times)
doug_armory (OP)
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
April 28, 2014, 09:33:26 PM
 #1

Hi. As some of you already know, Armory has an analog vis-a-vis Bitcoin-Qt/BC Core. There's armoryd, which uses JSON-RPC to interface with bitcoind. armoryd is a useful tool. It also lacks some features. I've been asked to give armoryd some TLC.

I'd like to know what users would like to see in armoryd. I have a few ideas already but would love to know what others would find useful. Posts here are preferred but PMs are fine too.

Thanks!

Senior Developer -  Armory Technologies, Inc.
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
April 29, 2014, 04:04:00 AM
 #2

I'm not a direct user of armoryd.py, but I list here's the first couple "obvious" ones:

  • Multiple wallets with context swtiching "showwalletlist" and "selectwallet 2xT9gxNq"
  • Add a call for creating unsigned transactions just like creating regular transactions.
  • Add a call for signing such a transaction (can copy code from extras/cli_sign_txdp.py)


Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
doug_armory (OP)
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
April 30, 2014, 12:56:35 PM
 #3

Thanks. I've been thinking about it the past couple of days and am slowly compiling a list of ideas.

Anybody else? If you haven't played with armoryd, give it a shot. It's a little bare-bones at the moment but it could be really useful for those of you who like to automate things and/or not deal with a GUI. If you can think of it and Armory already does it via the GUI, there's a decent chance it can be done. Smiley

Senior Developer -  Armory Technologies, Inc.
RoadStress
Legendary
*
Offline Offline

Activity: 1904
Merit: 1007


View Profile
May 01, 2014, 01:01:20 AM
 #4

Can we leave any kind of message in the blockchain when we send a transaction?

po0kie
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
May 08, 2014, 02:45:58 PM
 #5

Hi there!

I am working since severl months on armoryd, I am on work and have not enough time to compare code files and i dont know which are implemented right now on Armoryd (current version)
here some functions which I have implemented:


Unsigned Transaction (but I use always same change address as fromAddress)
Code:

   ##############################################################################
   def jsonrpc_sendtoaddressfromaddress(self, addrFrom, addrTo, amount):
      if CLI_OPTIONS.offline:
         raise ValueError('Cannot create transactions when offline')


      amtCoin = long(round(float(amount))) #ya nos vienen en satoshi
      return  self.create_unsigned_transaction_address(addrFrom, addrTo, amtCoin)

   #############################################################################


   def create_unsigned_transaction_address(self, fromAddress, toAddress, amount):
      # Get unspent TxOutList and select the coins
      #addr160_recipient = addrStr_to_hash160(bitcoinaddress_str)

      totalSend = long(amount)
      fee = 0
      if not checkAddrStrValid(fromAddress):
         raise InvalidBitcoinAddress

      if not checkAddrStrValid(toAddress):
         raise InvalidBitcoinAddress

      atype, addr160 = addrStr_to_hash160(fromAddress)
      if atype==P2SHBYTE:
         raise P2SHNotSupportedError

      atype, recip160 = addrStr_to_hash160(toAddress)
      if atype==P2SHBYTE:
         raise P2SHNotSupportedError
 
      fromAddrScript = hash160_to_p2pkhash_script(addr160)
      toAddrScript = hash160_to_p2pkhash_script(recip160)

      cppAddr = self.wallet.cppWallet.getScrAddrObjByKey(Hash160ToScrAddr(addr160))

      spendBal = cppAddr.getSpendableBalance()
      utxoList = self.wallet.getAddrTxOutList(addr160, 'Spendable')
      utxoSelect = PySelectCoins(utxoList, totalSend, fee)


      minFeeRec = calcMinSuggestedFees(utxoSelect, totalSend, fee, 1)[1]
      if fee<minFeeRec:
         if totalSend + minFeeRec > spendBal:
            raise NotEnoughCoinsError, "You can't afford the fee!"
         utxoSelect = PySelectCoins(utxoList, totalSend, minFeeRec)
         fee = minFeeRec

      if len(utxoSelect)==0:
         raise CoinSelectError, "Somehow, coin selection failed.  This shouldn't happen"

      totalSelected = sum([u.getValue() for u in utxoSelect])
      totalChange = totalSelected - (totalSend  + fee)

      recipValuePairs = []

      recipValuePairs.append([toAddrScript, totalSend])
 
      if totalChange > 0:
         changeAddress = fromAddress
         recipValuePairs.append( [fromAddrScript, totalChange] )

      txdp = PyTxDistProposal().createFromTxOutSelection(utxoSelect, recipValuePairs)
      utxoList = []
      for i in range(len(utxoSelect)):
        utxo = utxoSelect[i]

        a160 = CheckHash160(utxo.getRecipientScrAddr())
        OwnerAddress =  hash160_to_addrStr(a160)
        Value = AmountToJSON(utxo.getValue())
        Confirmmations = utxo.getNumConfirm()
        txHashBin = utxo.getTxHash()
        txHashHex = binary_to_hex(txHashBin, BIGENDIAN)
        TxHash = txHashHex
        TxOutIndex = utxo.getTxOutIndex()
        TxHeight = utxo.getTxHeight()

        utxoList.append(  { 'OwnerAddress' : OwnerAddress,
                            'Value' : Value,
                            'Confirmmations' : Confirmmations,
                            'TxHash' : TxHash,
                            'TxOutIndex' : TxOutIndex,
                            'TxHeight' : TxHeight
                          })

      jutxoList = {}
      jutxoList['utxos'] = utxoList
      jutxoList['txAscii'] = txdp.serializeAscii()


      return jutxoList

   #########################################################################

   def jsonrpc_sendmanyfromaddress(self, address, args):
      if CLI_OPTIONS.offline:
         raise ValueError('Cannot create transactions when offline')

      scraddrValuePairs = []
      dic = json.loads(args)
      for a in dic.keys():
         scraddrValuePairs.append([a, long(dic[a])])

      return self.create_unsigned_transaction_many_address(address, scraddrValuePairs)

###############################################################################

   def create_unsigned_transaction_many_address(self, fromAddress, scraddrValuePairs):
      # Get unspent TxOutList and select the coins
      #addr160_recipient = addrStr_to_hash160(bitcoinaddress_str)

      totalSend = long(sum([rv[1] for rv in scraddrValuePairs]))
      fee = 0
      if not checkAddrStrValid(fromAddress):
         raise InvalidBitcoinAddress

      toAddrScripts = []
      for rv in scraddrValuePairs:
      # Verify validity of address strings
        toAddress = rv[0]
        if not checkAddrStrValid(toAddress):
         raise InvalidBitcoinAddress
        atype, recip160 = addrStr_to_hash160(toAddress)
        if atype == P2SHBYTE:
          raise P2SHNotSupportedError
        toAddrScripts.append([hash160_to_p2pkhash_script(recip160), rv[1]])


      atype, addr160 = addrStr_to_hash160(fromAddress)
      if atype == P2SHBYTE:
         raise P2SHNotSupportedError

      fromAddrScript = hash160_to_p2pkhash_script(addr160)

     
      cppAddr = self.wallet.cppWallet.getScrAddrObjByKey(Hash160ToScrAddr(addr160))
 
      spendBal = cppAddr.getSpendableBalance() #getAddrBalance(addr160) #getAddrBalance(self, addr160, balType="Spendable",
                                               #currBlk=UINT32_MAX)
      utxoList = self.wallet.getAddrTxOutList(addr160, 'Spendable')
      utxoSelect = PySelectCoins(utxoList, totalSend, fee)


      #minFeeRec = calcMinSuggestedFees(utxoSelect, totalSend, fee)[1] // OLD !!! This Branch requieres 4 Parameters.
      minFeeRec = calcMinSuggestedFees(utxoSelect, totalSend, fee, len(toAddrScripts))[1]
      if fee < minFeeRec:
         if totalSend + minFeeRec > spendBal:
            raise NotEnoughCoinsError, "You can't afford the fee!"
         utxoSelect = PySelectCoins(utxoList, totalSend, minFeeRec)
         fee = minFeeRec

      if len(utxoSelect) == 0:
         raise CoinSelectError, "Somehow, coin selection failed.  This shouldn't happen"

      totalSelected = sum([u.getValue() for u in utxoSelect])
      totalChange = totalSelected - (totalSend + fee)

      recipValuePairs = []
      for i in range(len(toAddrScripts)):
        recipValuePairs.append([toAddrScripts[i][0], toAddrScripts[i][1]])
 
      if totalChange > 0:
         changeAddress = fromAddress
         recipValuePairs.append([fromAddrScript, totalChange])

 
      #Armory changed logic on Addresses, now only Script addresses
      txdp = PyTxDistProposal().createFromTxOutSelection(utxoSelect, recipValuePairs)


      utxoList = []
      for i in range(len(utxoSelect)):
        utxo = utxoSelect[i]

        a160 = CheckHash160(utxo.getRecipientScrAddr())
        OwnerAddress =  hash160_to_addrStr(a160)
        Value = AmountToJSON(utxo.getValue())
        Confirmmations = utxo.getNumConfirm()
        txHashBin = utxo.getTxHash()
        txHashHex = binary_to_hex(txHashBin, BIGENDIAN)
        TxHash = txHashHex
        TxOutIndex = utxo.getTxOutIndex()
        TxHeight = utxo.getTxHeight()

        utxoList.append(  { 'OwnerAddress' : OwnerAddress,
                            'Value' : Value,
                            'Confirmmations' : Confirmmations,
                            'TxHash' : TxHash,
                            'TxOutIndex' : TxOutIndex,
                            'TxHeight' : TxHeight
                          })

      jutxoList = {}
      jutxoList['utxos'] = utxoList
      jutxoList['txAscii'] = txdp.serializeAscii()


      return jutxoList
   ################################################################################





Utxo List by address
Code:
   ##############################################################################
   def jsonrpc_utxolistbyaddress(self, addr58, txType):
      atype, a160 = addrStr_to_hash160(addr58, False)
      if atype==P2SHBYTE:
         raise P2SHNotSupportedError
     
      utxos = self.wallet.getAddrTxOutList(a160, txType)
      utxoList = []
      for i in range(len(utxos)):
        utxo = utxos[i]
        outPoint = utxo.getOutPoint()

        a160 = CheckHash160(utxo.getRecipientScrAddr())
        OwnerAddress =  hash160_to_addrStr(a160)
        Value = AmountToJSON(utxo.getValue())
        Confirmmations = utxo.getNumConfirm()
        txHashBin = utxo.getTxHash()
        txHashHex = binary_to_hex(txHashBin, BIGENDIAN)
        TxHash = txHashHex
        TxOutIndex = utxo.getTxOutIndex()
        TxHeight = utxo.getTxHeight()

        utxoList.append(  { 'OwnerAddress' : OwnerAddress,
                             'Value' : Value,
                             'Confirmmations' : Confirmmations,
                             'TxHash' : TxHash,
                             'TxOutIndex' : TxOutIndex,
                             'TxHeight' : TxHeight
                           })

      jutxoList = { 'utxos' : utxoList }
      return jutxoList

Get HexTx so then you can broadcast it over BitcoinD
Code:
   ##############################################################################
   def jsonrpc_gethextxtobroadcast(self, txASCII):
       
      ############################## COMMENTED PARA PROBAR CON COLA INTERNA HEARTBEAT
      txdp = PyTxDistProposal().unserializeAscii(txASCII)
      finalTx = txdp.getBroadcastTxIfReady()
      newTxHash = finalTx.getHash()
      LOGINFO('Sending Tx, %s', binary_to_hex(newTxHash))
      print 'Segun armory Tx, %s', binary_to_hex(newTxHash)
      return binary_to_hex(finalTx.serialize())


Get Balance by Address
Code:
 def jsonrpc_getbalancebyaddress(self, address, baltype='spendable'):
      if address == None:
         LOGERROR('jsonrpc_getbalancebyaddress address parameter is none')
         return -1
      if not baltype in ['spendable','spend', 'unconf', 'unconfirmed', \
                          'total', 'ultimate','unspent', 'full']:
         LOGERROR('Unrecognized getbalance string: "%s"', baltype)
         return -1
      if address == None:
        return -1
      if CLI_OPTIONS.offline:
         raise ValueError('Cannot get received amount when offline')

      atype, addr160 = addrStr_to_hash160(address)
      if atype == P2SHBYTE:
         raise P2SHNotSupportedError

      if (not TheBDM.getBDMState() == 'BlockchainReady' and not self.calledFromBDM) or \
                                                               not self.wallet.hasAddr(addr160):
         return -1

      cppAddr = self.wallet.cppWallet.getScrAddrObjByKey(Hash160ToScrAddr(addr160))
      currBlk = TheBDM.getTopBlockHeight()
      spendBal = 0
      if baltype.lower() in ('spendable','spend'):
         spendBal = cppAddr.getSpendableBalance(currBlk, IGNOREZC)
      elif baltype.lower() in ('unconfirmed','unconf'):
         spendBal =cppAddr.getUnconfirmedBalance(currBlk, IGNOREZC)
      elif baltype.lower() in ('ultimate','unspent','full'):
         spendBal = cppAddr.getFullBalance()
      else:
         raise TypeError('Unknown balance type!')

      return AmountToJSON(spendBal)



Hope noth that much errors in the code Smiley
doug_armory (OP)
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
June 05, 2014, 03:03:02 PM
 #6

Can we leave any kind of message in the blockchain when we send a transaction?

I don't think Armory lets you do that. I can look into it.

Hi there!

I am working since severl months on armoryd, I am on work and have not enough time to compare code files and i dont know which are implemented right now on Armoryd (current version)
here some functions which I have implemented:

Thanks! I haven't looked at this code yet but will do so soon. What you wrote looks really useful. I've just been focusing on getting armoryd back to a reasonably robust state and adding some more expansive features.



Everyone: Here's a quick update. As mentioned above, armoryd has been getting a fine tuning. I've expanded a fair amount of functionality and removed some hacks that made armoryd difficult to use - if not impossible to use - out of the box. Among other things, I've added or greatly expanded:

-Lockbox support. This is still very rudimentary but you can create lockboxes.
-E-mail support. Would you like to, say, e-mail some people whenever an address receives money? You can do that now. Again, this is a bit rudimentary and may need fine tuning in the future, but the basic functionality is there.
-Add support for multiple wallets. At the moment, you can still only have one active wallet at a time, but you can load multiple wallets and switch wallet contexts.
-Get a list of UTXOs for the current wallet or for the wallet associated with a given address.
-When a new block arrives, a chain of functions can be executed if desired. The functions can also be removed.
-I'll look at po0kie's code soon and will probably add it as is appropriate.

If anybody has any more ideas, please let us know! I don't know what exactly will make it into 0.92 but I'll do my best to squeeze in as much as possible.

Senior Developer -  Armory Technologies, Inc.
justusranvier
Legendary
*
Offline Offline

Activity: 1400
Merit: 1013



View Profile
June 05, 2014, 10:47:39 PM
 #7

If anybody has any more ideas, please let us know! I don't know what exactly will make it into 0.92 but I'll do my best to squeeze in as much as possible.
Is armoryd tied to bitcoind specifically, or can it be run against any full node implementation that is RPC compatible (btcd)?
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 07, 2014, 11:19:25 PM
 #8

If anybody has any more ideas, please let us know! I don't know what exactly will make it into 0.92 but I'll do my best to squeeze in as much as possible.
Is armoryd tied to bitcoind specifically, or can it be run against any full node implementation that is RPC compatible (btcd)?

Just like ArmoryQt, if you run Bitcoin Core manually, RPC isn't even used.  Armory connects to it as a peer.  So far, it does require access to the Core directory:  ~/.bitcoin/blocks/blk*.dat files to read the blockchain, but in the future we plan to remove that dependency and have it operate entirely over P2P messages.   Then it will easily allow remote Core instances.  And also anything else that allows the download of the full blockchain over P2P, not necessarily Bitcoin Core itself.

armoryd doesn't have an option to run Bitcoin Core automatically, but when you do this in ArmoryQt it does connect over RPC, but basically just to find out the synchronization state when you are initially downloading the blockchain. 


Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
halfawake
Hero Member
*****
Offline Offline

Activity: 490
Merit: 500


View Profile
June 24, 2014, 06:10:57 AM
 #9

I don't think it'd really be relevant in Armory itself since it kind of already does notify you of changes, if you have Armory open.  But I'd like to propose what this guy said as an additional feature for armoryd: http://bitcoin.stackexchange.com/questions/24387/listening-for-changes-to-my-own-wallet-in-the-blockchain

BTC: 13kJEpqhkW5MnQhWLvum7N5v8LbTAhzeWj
doug_armory (OP)
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
June 24, 2014, 02:02:22 PM
 #10

I don't think it'd really be relevant in Armory itself since it kind of already does notify you of changes, if you have Armory open.  But I'd like to propose what this guy said as an additional feature for armoryd: http://bitcoin.stackexchange.com/questions/24387/listening-for-changes-to-my-own-wallet-in-the-blockchain

That feature is already present. Smiley Well, maybe not to the fullest extent possible, but armoryd can send email notifications under certain circumstances. I'll squeeze in what I can for the 0.92 release and will see about adding more features in a follow-up release.

Speaking of armoryd, I urge everyone who's interested to check it out when 0.92 is ready for testing. It has changed an awful lot in the past month and should prove to be quite useful. As always, feedback will be welcome.

Senior Developer -  Armory Technologies, Inc.
halfawake
Hero Member
*****
Offline Offline

Activity: 490
Merit: 500


View Profile
June 24, 2014, 06:03:43 PM
 #11

That feature is already present. Smiley Well, maybe not to the fullest extent possible, but armoryd can send email notifications under certain circumstances. I'll squeeze in what I can for the 0.92 release and will see about adding more features in a follow-up release.

Speaking of armoryd, I urge everyone who's interested to check it out when 0.92 is ready for testing. It has changed an awful lot in the past month and should prove to be quite useful. As always, feedback will be welcome.

Oh, awesome.  By the way, out of curiosity, do you need to have the full bitcoin client running to run armoryd, or can it access it remotely?  Just wondering, I'd love to host it on a webserver for an e-commerce site I have planned, but if I need to host the full blockchain to do it, I'm probably not going to bother.

BTC: 13kJEpqhkW5MnQhWLvum7N5v8LbTAhzeWj
doug_armory (OP)
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
June 24, 2014, 11:54:07 PM
 #12

That feature is already present. Smiley Well, maybe not to the fullest extent possible, but armoryd can send email notifications under certain circumstances. I'll squeeze in what I can for the 0.92 release and will see about adding more features in a follow-up release.

Speaking of armoryd, I urge everyone who's interested to check it out when 0.92 is ready for testing. It has changed an awful lot in the past month and should prove to be quite useful. As always, feedback will be welcome.

Oh, awesome.  By the way, out of curiosity, do you need to have the full bitcoin client running to run armoryd, or can it access it remotely?  Just wondering, I'd love to host it on a webserver for an e-commerce site I have planned, but if I need to host the full blockchain to do it, I'm probably not going to bother.

As written, armoryd expects bitcoind to reside on the same server. I don't think one could easily employ a remote bitcoind solution. (It's certainly possible under Python, of course.) We may make such a setup easier to achieve in the future. It just hasn't been a focus for the 0.92 release.

Senior Developer -  Armory Technologies, Inc.
halfawake
Hero Member
*****
Offline Offline

Activity: 490
Merit: 500


View Profile
June 25, 2014, 07:58:34 AM
 #13

That feature is already present. Smiley Well, maybe not to the fullest extent possible, but armoryd can send email notifications under certain circumstances. I'll squeeze in what I can for the 0.92 release and will see about adding more features in a follow-up release.

Speaking of armoryd, I urge everyone who's interested to check it out when 0.92 is ready for testing. It has changed an awful lot in the past month and should prove to be quite useful. As always, feedback will be welcome.

Oh, awesome.  By the way, out of curiosity, do you need to have the full bitcoin client running to run armoryd, or can it access it remotely?  Just wondering, I'd love to host it on a webserver for an e-commerce site I have planned, but if I need to host the full blockchain to do it, I'm probably not going to bother.

As written, armoryd expects bitcoind to reside on the same server. I don't think one could easily employ a remote bitcoind solution. (It's certainly possible under Python, of course.) We may make such a setup easier to achieve in the future. It just hasn't been a focus for the 0.92 release.

Okay, that's good to know, thanks.

BTC: 13kJEpqhkW5MnQhWLvum7N5v8LbTAhzeWj
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!