Bitcoin Forum
May 04, 2024, 02:22:44 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: armoryd.py sendasciitx times out when trying to broadcast fully signed tx  (Read 134 times)
XeuDrANiKoN (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
September 11, 2018, 12:49:30 AM
Last edit: September 11, 2018, 05:00:49 AM by XeuDrANiKoN
 #1

Hey guys,

just looking for quick assistance in reviewing what I have here. I'm running the code in regtest and it seems that whenever I try to broadcast a tx signed by all parties of a lockbox but it seems to always time out in one of these two ways:

Code:
(ERROR) armoryd.py:3353 - failed to broadcast tx 7b6b6c70f235e192275f2017e7939ab8a6e8c57f64c4710bed90bb1fbffb5913
(ERROR) armoryd.py:3354 - error message: tx broadcast timed out (get)

or

Code:
(ERROR) armoryd.py:3353 - failed to broadcast tx 73e21413fbb4a7e71ed8b1e3a0368b7ea8723821f3bf1cf52c656282d219bc67
(ERROR) armoryd.py:3354 - error message: tx broadcast timed out (send)

Could someone explain the difference between the "get" and "send" time out. Also any idea why this would continuously time out? It use to work and I suspect a bitcoin.conf or armory config issue, that said I'm not sure. Any help is welcome. Here are more information to help you assist me Smiley

  • I run armory 0.96.4
  • I run bitcoin core 0.16.1
  • bitcoind is launched in command line this way: ~/bitcoin-0.16.1/bin/bitcoind -regtest -daemon
  • ArmoryDB is launched like this: ~/BitcoinArmory/ArmoryDB --regtest --db-type="DB_FULL" --cookie --satoshi-datadir="~/.bitcoin/regtest/blocks" --fcgi-port="19002";
  • Armoryd is launched like this: python ~/BitcoinArmory/armoryd.py --regtest --debug
  • Everything runs on the same box aside from 1 signature of that lockbox being done 'offline' on a separate device. The other 2 signatures for the lb are done on the same machine that's running armoryd & bitcoind

~/.bitcoin/bitcoin.conf
Code:
regtest=1
listen=1
server=1
rpcuser=<redacted>
rpcpassword=<redacted>
rpcclienttimeout=100

~/.armory/regtest/armoryd.conf
Code:
<redacted user>:<redacted password>

ArmorySetting.txt
Code:
Default_FeeByte                      | 200
ManageSatoshi                        | False
AdjustFee                            | True
MainWalletCols                       | ff0500004100820057009401
NotifyBlkFinish                      | False
MainGeometry                         | 01d9d0cb0001000000000057000000590000045200000312000000610000007f0000044800000308000000000000
LastBlkRecvTime                      | 1536545446.98
LastDirectory                        | ~/.armory/regtest
Agreed_to_EULA                       | True
NotifyBtcIn                          | True
First_Load                           | False
Wallet_29xhD7eNA_LedgerShow          | True
AddrBookGeometry                     | 01d9d0cb0001000000000034000000630000033f0000030e0000003e000000890000033500000304000000000000
SyncSuccessCount                     | 2
FeeOption                            | Auto
MainLedgerCols                       | ff0d14000000a7004800720098007200000000000000000000000000
LockboxAddrCols                      | ff0c8f006400640003010000000000000000000064005c010000
DNAA_UnlockTimeout                   | False
WltPropAddrCols                      | ff046400640064000101
AddrBookTxTbl                        | ff04a100000065007801
LockboxGeometry                      | 01d9d0cb00010000000000060000002f0000044f000002e1000000100000005500000445000002d7000000000000
NotifyDiscon                         | True
Wallet_36TAV3Zhp_LedgerShow          | True
NotifyIgnore                         |
DNAA_IntroDialog                     | True
AddrBookRxTbl                        | ff052100be00de004000db00
AddrBookWltTbl                       | ff050000c000800080000f01
DNAA_AllBackupWarn                   | False
Default_FeeByte_BlocksToConfirm      | 2
Default_ReceiveType                  | P2PKH
AdvFeature_UseCt                     | 0
LockboxLedgerCols                    | ff0d14000000a7004800720098007200000000000000000000000000
UnlockTimeout                        | 10
Default_Fee                          | 20000
LastFilterState                      | 0
MinimizeOrClose                      | Close
User_Mode                            | Expert
Load_Count                           | 13
First_Load_Date                      | 1531464992
NotifyBtcOut                         | True
MinimizeOnOpen                       | False
FailedLoadCount                      | 3
Wallet_2bVtn7SnS_LedgerShow          | True
DateFormat                           | 25592d25622d25642025493a254d2570
Default_ChangeType                   | P2PKH
Wallet_6N8Pz4op_LedgerShow           | True
IgnoreAlerts                         |
Wallet_3Bkd5eYWz_LedgerShow          | True
LastBlkRecv                          | 4700
DNAA_DeleteLevelDB                   | False
NotifyReconn                         | True
WltPropGeometry                      | 01d9d0cb00010000fffffff600000013000003470000022600000000000000390000033d0000021c000000000000
DNAA_DefaultApp                      | False
LastVersionLoad                      | v0.96.4

~/.armory/regtest/armorylog.txt
Code:
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:679 - Executing popen: free -m
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:679 - Executing popen: ['cat', '/proc/cpuinfo']
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1271 -
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1272 -
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1273 -
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1274 - ************************************************************
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1275 - Invoked: ~/<redacted>/BitcoinArmory/armoryd.py --regtest sendasciitransaction ~/<redacted path to signed tx>/2af658c061552dfacc328618e910865b_20180910074824.tx
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1276 - ************************************************************
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1277 - Loading Armory Engine:
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1278 -    Armory Version        : 0.96.4
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1279 -    Armory Build:         : None
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1280 -    PyBtcWallet  Version  : 1.35
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1281 - Detected Operating system: Linux
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1282 -    OS Variant            : Ubuntu-18.04-bionic
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1283 -    User home-directory   : ~
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1284 -    Satoshi BTC directory : ~/.bitcoin/regtest
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1285 -    Armory home dir       : ~/.armory/regtest
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1286 - Detected System Specs    :
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1287 -    Total Available RAM   : 7.68 GB
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1288 -    CPU ID string         : Intel(R) Core(TM) i5-7260U CPU @ 2.20GHz
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1289 -    Number of CPU cores   : 4 cores
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1290 -    System is 64-bit      : True
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1291 -    Preferred Encoding    : UTF-8
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1292 -    Machine Arch          : x86_64
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1293 -    Available HDD (ARM)   : 432 GB
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1294 -    Available HDD (BTC)   : 432 GB
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1295 -
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1296 - Network Name: Regtest Network
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1297 - Satoshi Port: 18444
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1298 - Do wlt check: True
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1299 - Named options/arguments to armoryengine.py:
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     force_segwit    : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     nettimeout      : 2
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     rescan          : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     force_fcgi      : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     ignoreAllZC     : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     rescanBalance   : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     disableModules  : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     port            : None
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     interport       : 8224
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     coverageOutputDir: None
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     forceWalletCheck: False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     regtest         : True
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     rebuild         : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     thread_count    : -1
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     datadir         : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     clearMempool    : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     offline         : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     armoryDBDir     : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     armorydb_port   : 9001
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     satoshiPort     : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     disableConfPermis: False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     useTorSettings  : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     netlog          : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     keypool         : 100
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     coverageInclude : None
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     forceOnline     : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     disableWalletCheck: False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     redownload      : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     rpcBindAddr     : 127.0.0.1
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     armorydb_ip     : 127.0.0.1
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     multisigFile    : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     ram_usage       : -1
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     ignoreZC        : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     logDisable      : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     settingsPath    : ~/.armory/regtest/ArmorySettings.txt
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     language        : en
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     db_type         : DB_FULL
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     doDebug         : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     enableDetSign   : True
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     mtdebug         : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     testnet         : False
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     rpcport         : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     satoshiHome     : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     satoshiRpcport  : DEFAULT
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     logFile         : ~/.armory/regtest/armoryd.py.log.txt
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1301 -     verbosity       : None
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1302 - Other arguments:
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1304 -     sendasciitransaction
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1304 -     ~/<redacted path to signed tx>/2af658c061552dfacc328618e910865b_20180910074824.tx
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1305 - ************************************************************
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:1708 - C++ block utilities loaded successfully
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:3566 - Using settings file: ~/.armory/regtest/ArmorySettings.txt
2018-09-10 03:48:34 (ERROR) -- ArmoryUtils.py:3723 - Unsupported language  specified. Defaulting to English (en)
2018-09-10 03:48:34 (INFO) -- ArmoryUtils.py:3726 - Using Language: en
2018-09-10 03:48:34 (INFO) -- BDM.py:361 - Using the asynchronous/multi-threaded BlockDataManager.
2018-09-10 03:48:34 (INFO) -- BDM.py:362 - Blockchain operations will happen in the background.
2018-09-10 03:48:34 (INFO) -- BDM.py:363 - Devs: check TheBDM.getState() before asking for data.
2018-09-10 03:48:34 (INFO) -- BDM.py:364 - Registering addresses during rescans will queue them for
2018-09-10 03:48:34 (INFO) -- BDM.py:365 - inclusion after the current scan is completed.
2018-09-10 03:48:53 (ERROR) -- armoryd.py:3353 - failed to broadcast tx 7b6b6c70f235e192275f2017e7939ab8a6e8c57f64c4710bed90bb1fbffb5913
2018-09-10 03:48:53 (ERROR) -- armoryd.py:3354 - error message: tx broadcast timed out (get)
2018-09-10 03:58:25 (DEBUG) -- PyBtcWallet.py:2868 - Attempting to lock wallet: 6N8Pz4op
2018-09-10 03:58:25 (DEBUG) -- PyBtcWallet.py:2887 - Wallet locked: 6N8Pz4op
2018-09-10 03:58:30 (DEBUG) -- PyBtcWallet.py:2868 - Attempting to lock wallet: 3Bkd5eYWz
2018-09-10 03:58:30 (DEBUG) -- PyBtcWallet.py:2887 - Wallet locked: 3Bkd5eYWz

~/.armory/regtest/dbLog.txt
Code:
Log file opened at 03:26:40: ~/.armory/regtest/dbLog.txt
-INFO  - 03:26:40: (main.cpp:32) Running on 4 threads
-INFO  - 03:26:40: (main.cpp:33) Ram usage level: 50
-INFO  - 03:26:40: (BlockUtils.cpp:915) blkfile dir: ~/.bitcoin/regtest/blocks
-INFO  - 03:26:40: (BlockUtils.cpp:916) lmdb dir: ~/.armory/regtest/databases
-INFO  - 03:26:40: (lmdb_wrapper.cpp:388) Opening databases...
-INFO  - 03:26:40: (BDM_Server.h:263) Listening on port 19002
-INFO  - 03:26:40: (BlockUtils.cpp:1108) Executing: doInitialSyncOnLoad
-INFO  - 03:26:40: (DatabaseBuilder.cpp:199) Reading headers from db
-INFO  - 03:26:40: (DatabaseBuilder.cpp:238) Found 4701 headers in db
-INFO  - 03:26:40: (DatabaseBuilder.cpp:64) Rewinding 100 blocks
-INFO  - 03:26:40: (DatabaseBuilder.cpp:71) updating HEADERS db
-INFO  - 03:26:40: (DatabaseBuilder.cpp:493) Found next block after skipping 1018bytes
-INFO  - 03:26:40: (DatabaseBuilder.cpp:281) parsed block file #0
-INFO  - 03:26:40: (Blockchain.cpp:248) Organizing chain
-INFO  - 03:26:40: (Blockchain.cpp:370) Organized chain in 0s
-INFO  - 03:26:40: (DatabaseBuilder.cpp:76) updated HEADERS db in 0s
-INFO  - 03:26:40: (lmdb_wrapper.cpp:388) Opening databases...
-INFO  - 03:26:40: (DatabaseBuilder.cpp:1231) verifying txfilters integrity
-INFO  - 03:26:40: (DatabaseBuilder.cpp:1314) done checking txfilters
-INFO  - 03:26:40: (DatabaseBuilder.cpp:134) scanning new blocks from #4701 to #4700
-INFO  - 03:26:40: (BlockchainScanner.cpp:52) no history to scan
-INFO  - 03:26:40: (BlockchainScanner.cpp:1021) no SSH to scan
-INFO  - 03:26:40: (lmdb_wrapper.cpp:388) Opening databases...
-INFO  - 03:26:40: (DatabaseBuilder.cpp:186) scanned new blocks in 0s
-INFO  - 03:26:40: (DatabaseBuilder.cpp:190) init db in 0s
-INFO  - 03:26:40: (BDM_supportClasses.cpp:1891) Enabling zero-conf tracking
-INFO  - 03:26:40: (BitcoinP2P.cpp:947) Connected to Bitcoin node
-INFO  - 03:26:52: (BDM_Server.cpp:1121) registered bdv: bf970b14151c0d5704d6
-INFO  - 03:29:24: (BDM_supportClasses.cpp:2098) sent inv packet
-INFO  - 03:29:24: (BDM_supportClasses.cpp:2117) got getData packet
-INFO  - 03:29:24: (BDM_supportClasses.cpp:2147) grabbing tx from node
[color=red]-ERROR - 03:29:34: (BDM_supportClasses.cpp:2159) tx broadcast timed out (get)[/color]
-INFO  - 03:37:52: (BDM_supportClasses.cpp:2098) sent inv packet
[color=red]-ERROR - 03:38:02: (BDM_supportClasses.cpp:2112) tx broadcast timed out (send)[/color]
-INFO  - 03:48:34: (BDM_supportClasses.cpp:2098) sent inv packet
-INFO  - 03:48:43: (BDM_supportClasses.cpp:2117) got getData packet
-INFO  - 03:48:43: (BDM_supportClasses.cpp:2147) grabbing tx from node
[color=red]-ERROR - 03:48:53: (BDM_supportClasses.cpp:2159) tx broadcast timed out (get)[/color]

Start bitcoinqt with -disablewallet and use the second GUI tab

I found this answer in an old post ..., but I have the same issue with 0.96.4 and core 0.16.1 ... I'm using armoryd rather than the UI and run on regtest. Seems like
 when it happens it corrupts the db (remove the databases folder and relaunching armorydb and armoryd --rebuild doesn't do the trick (gets to block 39 out of 289).

https://bitcointalk.org/index.php?topic=5026167.0 for my issue.

Also, tried to avoid the problem by not using sendasciitx on armoryd, but rather get the hex for the tx and then broadcast with bitcoin-qt and / bitcoin-cli. Results is a string saying it's missing inputs ?!?

Any help would be greatly appreciated!
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
bobulus
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
September 11, 2018, 07:33:11 PM
 #2

FWIW, I'm seeing the exact same timeout error as you, but the transaction appears to be picked up by the regtest node. If you mine on the regtest node, it updates the balance on your Armory wallet. i.e.:

Code:
bitcoin-cli -conf=bitcoin.conf -datadir=/bitcoin generate 1

My setup is very similar:
Armory 0.96.4
bitcoin core 0.16.1
Ubuntu 16.04
running regtest

Also, not to hijack your thread, but have you tried any of the other JSON-RPC calls? I'm seeing failures in many basic calls to `getblock`, `listtransactions` with errors about missing attributes. I believe it's because armoryd.py has basically been abandoned since it was broken out of the main Armory code base.
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3668
Merit: 1345

Armory Developer


View Profile
September 12, 2018, 12:00:46 PM
 #3

This will probably never work in regtest.

Armory has 2 paths to broadcast a transactions:

1) P2P

Armory is connected to your Bitcoin node as a node itself. It uses that to grab zero confirmation tx from the network, new block notifications as well as broadcasting transactions. The P2P layer is not meant to operate according to a client server paradigm however.

When a node broadcasts a transaction on the network, it first announces it has transactions by hash in an inv_tx packet. The recipient nodes then decide at their own discretion if they want any of the transactions in that inventory batch. They will request these tx by hash from the origin node. At this point, the exchange is over.

These 2 steps are the "send" mechanic, where Armory sends to the tx to the node.

Next is the "get" step. In a client/server setup (i.e. Armory operations), you want an ACK on whether the tx was accepted. What we are trying to achieve when broadcasting a transaction from Armory is to get that tx in the Bitcoin network's "mempool". Simply pushing that tx to our node is not enough, we need to know whether that tx was accepted by the node as well, which is a strong enough guarantee the tx will be passed around the entire network in consequence.

To do so, after the node has grabbed our tx, we then try to grab that tx back from the node's own mempool, which demonstrates the node has in fact accepted the new tx. The issue with this method is 2 fold.

a) First, the tx will not be available in the node's mempool until the node pushes the inv packet itself to its connected peers. This process can take a while, as Core like to batch their inv_tx together before pushing that stuff out. This is why P2P broadcast is unreliable on testnet/regtest, as there's not enough traffic to prompt quick inv_tx forwarding.

Keep in mind that your node thinks this tx is just one of many floating around the network, that it may or may not need to bounce it to other nodes for propagation. It has no sense of priority nor duty to push that stuff out. Your node just doesn't know this is its own original tx and it needs to propagate it ASAP, and there is no facility to convey that over the P2P.

b) Next, since Armory pushed that tx to your node, it will never see the inv_tx packet in return. From the perspective of your node, it is wasted bandwidth to return the inv of this tx to its point origin. Therefor, Armory has to poll your node's mempool blindly, hoping to find that tx in there. If it fails to, the result will be a "timeout (get)".

2) RPC

The tx is passed to your node's RPC interface. This is guaranteed behavior with ACK/nACK and error verbose.

-------------------------

- Why not always use the RPC?
   There's no guarantee the user has gone through the steps to enable the RPC, nor that it is desirable. Only the node is required to operate Armory, not the RPC. Also, in terms of performance, the RPC is at least an order of magnitude slower.

- Why use the RPC interface at all then?
   If the RPC is available, ArmoryQt will use it as fallback for tx broadcasting in case the P2P method fails.

- RPC broadcast in armoryd
   There's method for this in armoryd atm. You can add it easily by copying the code in jsonrpc_sendasciitransactionraw and replacing the one line with RPC broadcast (https://github.com/goatpig/armoryd/blob/master/armoryd.py#L323):

Code:
         #TheBDM.bdv().broadcastZC(pytx.serialize()) #comment this out
         TheBDM.bdv().broadcastThroughRPC(pytx.serialize()) #use this instead

bobulus
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
September 12, 2018, 04:04:00 PM
 #4

I'm not the OP, but thanks for the extremely thorough explanation! Makes sense now why it wouldn't work.
XeuDrANiKoN (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
September 12, 2018, 05:14:23 PM
 #5

This will probably never work in regtest.

Armory has 2 paths to broadcast a transactions:

1) P2P

Armory is connected to your Bitcoin node as a node itself. It uses that to grab zero confirmation tx from the network, new block notifications as well as broadcasting transactions. The P2P layer is not meant to operate according to a client server paradigm however.

When a node broadcasts a transaction on the network, it first announces it has transactions by hash in an inv_tx packet. The recipient nodes then decide at their own discretion if they want any of the transactions in that inventory batch. They will request these tx by hash from the origin node. At this point, the exchange is over.

These 2 steps are the "send" mechanic, where Armory sends to the tx to the node.

Next is the "get" step. In a client/server setup (i.e. Armory operations), you want an ACK on whether the tx was accepted. What we are trying to achieve when broadcasting a transaction from Armory is to get that tx in the Bitcoin network's "mempool". Simply pushing that tx to our node is not enough, we need to know whether that tx was accepted by the node as well, which is a strong enough guarantee the tx will be passed around the entire network in consequence.

To do so, after the node has grabbed our tx, we then try to grab that tx back from the node's own mempool, which demonstrates the node has in fact accepted the new tx. The issue with this method is 2 fold.

a) First, the tx will not be available in the node's mempool until the node pushes the inv packet itself to its connected peers. This process can take a while, as Core like to batch their inv_tx together before pushing that stuff out. This is why P2P broadcast is unreliable on testnet/regtest, as there's not enough traffic to prompt quick inv_tx forwarding.

Keep in mind that your node thinks this tx is just one of many floating around the network, that it may or may not need to bounce it to other nodes for propagation. It has no sense of priority nor duty to push that stuff out. Your node just doesn't know this is its own original tx and it needs to propagate it ASAP, and there is no facility to convey that over the P2P.

b) Next, since Armory pushed that tx to your node, it will never see the inv_tx packet in return. From the perspective of your node, it is wasted bandwidth to return the inv of this tx to its point origin. Therefor, Armory has to poll your node's mempool blindly, hoping to find that tx in there. If it fails to, the result will be a "timeout (get)".

2) RPC

The tx is passed to your node's RPC interface. This is guaranteed behavior with ACK/nACK and error verbose.

-------------------------

- Why not always use the RPC?
   There's no guarantee the user has gone through the steps to enable the RPC, nor that it is desirable. Only the node is required to operate Armory, not the RPC. Also, in terms of performance, the RPC is at least an order of magnitude slower.

- Why use the RPC interface at all then?
   If the RPC is available, ArmoryQt will use it as fallback for tx broadcasting in case the P2P method fails.

- RPC broadcast in armoryd
   There's method for this in armoryd atm. You can add it easily by copying the code in jsonrpc_sendasciitransactionraw and replacing the one line with RPC broadcast (https://github.com/goatpig/armoryd/blob/master/armoryd.py#L323):

Code:
         #TheBDM.bdv().broadcastZC(pytx.serialize()) #comment this out
         TheBDM.bdv().broadcastThroughRPC(pytx.serialize()) #use this instead

Thanks a lot for the explanation goatpig! To me it wasn't clear from the documentation/source of sendasciitransaction() or even the raw variant that it was never going to work. I ended up hacking around my stuff by getting the raw hex for the tx and then broadcast via bitcoin-cli. I understand your point about blindly relying on the RPC though.

 The other thing I've noticed is that it desyncs ArmoryDB and seems to prevent armory (even after a fresh build and new .armory folder being created to ever catch up to the regtest blockchain. So basically if you, inadvertdly try it once, you are stuck redownloading/building/scanning.

I didn't care too much about the performances here as I only wanted to see that the tx that I was pushing was good enough.

Thanks for the clarifications once again.
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!