2018-08-28 17:12:12
@Fireduck Is there a way to get chain info from RPC? Something similar to http://chainquery.com/bitcoin-api/getblockchaininfo would be great. Bitcoin API getblockchaininfo: A web based interface to the Bitcoin API JSON-RPC
bitbumper
2018-08-28 17:12:39
What info specifically are you looking for?
Fireduck
2018-08-28 17:12:57
Height mostly, to ensure that my mining thread has generated enough blocks to confirm something.
bitbumper
2018-08-28 17:13:01
There is a bunch of stuff in get node status
Fireduck
2018-08-28 17:13:37
Honestly last block hash and height are the most important to me, but I didn't see them in get_status
bitbumper
2018-08-28 17:14:42
if is in there: jq .result.node_status.headSummary.header.blockHeight
Fireduck
2018-08-28 17:15:06
ugly, the understores are me, the camel case is protobuf converted to json
Fireduck
2018-08-28 17:15:19
Ah, my bad, must've missed it, thanks.
bitbumper
2018-08-28 17:15:30
no problem, it is a dump truck of data in there
Fireduck
2018-08-28 17:36:56
I think I found what tripped me up. It appears that get_status sometimes omits this field, I think it's shortly after a new block is solved. I'm working around it in a simple hacky way, but it would be nice to be able to count on its presence.
```
{'node_status': {'headSummary': {'totalTransactions': '1', 'header': {'prevBlockHash': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=', 'powProof': [...], 'merkleRootHash': 'MHuw6LfN5sYWomgMF82/ylF2wVhEWO5fN4yfZC9tTsA=', 'utxoRootHash': 'wV7DoOvZ/IaH2ay3fJ7C9EzsgiT1ng6hPSGhiEDkUFg=', 'snowHash': 'AB6gRnrqYYrVFQk1E6S8I9SvPc7726A055lzt+sIqh4=', 'version': 1, 'nonce': 'dGXaWMC052sgSaWd', 'timestamp': '1535477134886', 'target': 'ACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='}, 'targetAverage': '56539106072908298546665520023773392506479484700019806659891398441363832832', 'workSum': '1024', 'blocktimeAverageMs': '1000'}, 'estimatedNodes': 1, 'nodeVersion': '1.3.2', 'versionMap': {'1.3.2': 1}}, 'balance': {'spendable': '100000000', 'unconfirmed_snow': 0.0, 'spendable_snow': 100.0, 'confirmed': '100000000', 'confirmed_snow': 100.0}}```
bitbumper
2018-08-28 17:37:19
*https://github.com/snowblossomcoin/snowblossom/compare/5fb76fb8dce7...b9479b2f6fe7*
https://github.com/snowblossomcoin/snowblossom/commit/0b2dcce4cd37de4c29ee325da0c403fca2d131db - Diffs for android build
https://github.com/snowblossomcoin/snowblossom/commit/b9479b2f6fe78bc767079a860a5f63cc261ebb96
GitHub
2018-08-28 17:37:21
interesting
Fireduck
2018-08-28 17:37:54
it shouldn't ever omit that...that would mean that the latest block summary in the BlockIngester was null for some reason
Fireduck
2018-08-28 17:38:31
ah, I see, that is the header for block 0
Fireduck
2018-08-28 17:38:36
for some damn reason
Fireduck
2018-08-28 17:39:30
protobuf omits things that are default value (like zero)
Fireduck
2018-08-28 17:39:43
so in the places where I am just converting a proto to json it can be a little confusing
Fireduck
2018-08-28 17:41:14
{'node_status': {'headSummary': {'totalTransactions': '1', 'header': {'prevBlockHash': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=', 'powProof': [...], 'merkleRootHash': 'MHuw6LfN5sYWomgMF82/ylF2wVhEWO5fN4yfZC9tTsA=', 'utxoRootHash': 'wV7DoOvZ/IaH2ay3fJ7C9EzsgiT1ng6hPSGhiEDkUFg=', 'snowHash': 'AB6gRnrqYYrVFQk1E6S8I9SvPc7726A055lzt+sIqh4=', 'version': 1, 'nonce': 'dGXaWMC052sgSaWd', 'timestamp': '1535477134886', 'target': 'ACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='}, 'targetAverage': '56539106072908298546665520023773392506479484700019806659891398441363832832', 'workSum': '1024', 'blocktimeAverageMs': '1000'}, 'estimatedNodes': 1, 'nodeVersion': '1.3.2', 'versionMap': {'1.3.2': 1}}, 'balance': {'spendable': '100000000', 'unconfirmed_snow': 0.0, 'spendable_snow': 100.0, 'confirmed': '100000000', 'confirmed_snow': 100.0}}
GitHub
2018-08-28 17:47:45
Yeah that looks right, not a big deal then.
bitbumper
2018-08-28 17:47:53
Thought it might be a race condition thing.
bitbumper
2018-08-28 17:48:13
Did a bit more testing with my harness and couldn't get it to happen past height 2.
bitbumper
2018-08-28 18:05:19
yeah, I am having a hard time seeing how it would happen
Fireduck
2018-08-28 20:32:49
Is there an RPC call for address history? I saw it mentioned in #111 but not seeing it in the wiki.
bitbumper
2018-08-28 20:35:47
No, I wasn't sure it would be needed. I can add it quickly.
Fireduck
2018-08-28 20:42:27
Yeah we need some way to check for new deposits. If there's a recommended alternative I'm happy to use it instead, but I didn't see any way to detect new transactions via RPC.
bitbumper
2018-08-28 20:43:10
I was expecting you would use listunspent
Fireduck
2018-08-28 20:43:24
But depends on your flow
Fireduck
2018-08-28 20:43:42
That would work better honestly
bitbumper
2018-08-28 20:43:51
I just didn't see reference to it, one second
bitbumper
2018-08-28 20:44:04
list unspent should be fast and work on all nodes
Fireduck
2018-08-28 20:44:26
Ah, I just missed it, sorry.
bitbumper
2018-08-28 20:44:28
History will need a node with addr_idx turned on
Fireduck
2018-08-28 20:44:39
No worries
Fireduck
2018-08-28 20:48:55
Oh yeah, in latest update getunspent verifies proofs all the way back to utxo root for the block
Fireduck
2018-08-28 21:02:31
you want to see stuff from the mempool as well?
Fireduck
2018-08-28 21:03:04
That would be nice. I'm seeing mempool txs right now I think.
bitbumper
2018-08-28 21:03:50
Is there a way for end users to attach 'extra' to their transactions? Or would it be wiser to generate unique addresses for each end user?
bitbumper
2018-08-28 21:03:51
oh, yeah you are
Fireduck
2018-08-28 21:03:57
sorry, confused myself for a minute
Fireduck
2018-08-28 21:04:37
probably way wiser to do unique addresses per end user
Fireduck
2018-08-28 21:05:01
while the feature exists in the protocol, it isn't very accessible
Fireduck
2018-08-28 21:06:08
Got it. Are all wallets HD? And if so, is there a way to export the root key?
bitbumper
2018-08-28 21:06:53
They are not HD, specifically because some of the key types are not HD compatible and I didn't want there to be confusion of some wallets working with HD and some not
Fireduck
2018-08-28 21:07:56
https://github.com/snowblossomcoin/snowblossom/wiki/Watch-only-Wallets might be helpful
Fireduck
2018-08-28 21:07:58
Gotchya. Are all addresses currently using ECDSA secp256k1?
bitbumper
2018-08-28 21:08:33
default, yes. There is a key_mode=qhard where the keys are ECDSA, RSA-8192bit and DSTU4145 in 3of3 multisig
Fireduck
2018-08-28 21:08:46
Neat
bitbumper
2018-08-28 21:09:24
I read through the import wallet guide. It's close to our flow, but I think some massaging will be needed. Still thinking on best way to proceed.
bitbumper
2018-08-28 21:10:09
cool, let me know if I can do anything to help
Fireduck
2018-08-28 21:10:29
Something like importaddress may work well since we already have infrastructure for generating from HD keys. I'll think on it more before I bother you.
bitbumper
2018-08-28 21:10:59
yeah, can do
Fireduck
2018-08-28 21:11:47
if you went that route, what format would the keys be in?
Fireduck
2018-08-28 21:13:28
I could probably just match the encoding that you're using. We're already doing that for Amoveo and it's working well.
bitbumper
2018-08-28 21:14:50
BTW, is your address format checksummed? Looks similar to bech32
bitbumper
2018-08-28 21:15:16
in that case, just 'import' command and creating a json file with public/private key pair and an address spec would work
Fireduck
2018-08-28 21:15:21
yeah, it is checksummed
Fireduck
2018-08-28 21:16:28
Excellent. I was always surprised that ETH launched w/o checksums.
bitbumper
2018-08-28 21:16:31
honestly, I couldn't understand the math for the bech32 error correction so did my own thing. The comments in Duck32.java spell it out.
Fireduck
2018-08-28 21:16:46
so it has error detection, but not correction
Fireduck
2018-08-28 21:17:34
Ah, I gotchya. You may be able to use an off the shelf library, I know BitcoinJ is well built out.
bitbumper
2018-08-28 21:18:18
Certainly using an established addressing standard helps a lot if in the future we want to setup cold storage. We can then use Trezor or similar without much fuss.
bitbumper
2018-08-28 21:18:46
But I understand that switching address formats is a serious undertaking...
bitbumper
2018-08-28 21:31:56
@bitbumper sidenote - as a user i’d like to be able to crank out more / throwaway receive addresses too, but sure, that costs you cpu time
Rotonen
2018-08-28 21:33:07
the new changes to get unspent make it very efficent, it caches results on the rpcserver per block (since they cannot change until there is a new block). It still checks the mempool again, but that is quite fast.
Fireduck
2018-08-28 21:33:35
Noted. It's actually not so much CPU time as it is simplifying secret management and backup. Juggling a lot of private keys becomes cumbersome to manage and maintain high security.
bitbumper
2018-08-28 21:34:00
@Fireduck Cool, good to know we have the performance headroom.
bitbumper
2018-08-28 21:35:18
@bitbumper limit it to rolling last 4 or so and eat some flakes / satoshi every time one generates a new one and demand the 2nd factor to create a new one and i’m a happy camper
Rotonen
2018-08-28 21:36:41
but, as said, a sidenote, which i’ve now voiced
Rotonen
2018-08-28 21:39:24
Appreciate the feedback. Right now we actually don't support getting a "new" deposit address, but it's on the radar. Why 2FA for generating a new deposit address?
bitbumper
2018-08-28 21:40:23
so there is both an inconvenience to it and a funnel for you to lock more behind the second factor to incentivize people using it
Rotonen
2018-08-28 21:40:26
just to make it a pain so people don't do it unless they actually care
Fireduck
2018-08-28 21:41:12
also then if someone is using a stable address for real, a single post auth session capture will not enable to burn that one
Rotonen
2018-08-28 21:42:14
ux and security are an unhappy marriage and marketing is the old salt, or somesuch
Rotonen
2018-08-28 21:49:09
@bitbumper get
Fireduck
2018-08-28 21:49:29
get_unspent on a wallet with 10,000 address is taking about 15 seconds on a virt with a really questionable cpu
Fireduck
2018-08-28 22:13:19
Cool, good to have a ballpark number. Is that scaling on number of accounts or UTXOs?
bitbumper
2018-08-28 22:32:21
Accounts
Fireduck
2018-08-28 22:32:38
One account with 24,000 utxos is a second
Fireduck