@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
What info specifically are you looking for?
Height mostly, to ensure that my mining thread has generated enough blocks to confirm something.
There is a bunch of stuff in get node status
Honestly last block hash and height are the most important to me, but I didn't see them in get_status
if is in there: jq .result.node_status.headSummary.header.blockHeight
ugly, the understores are me, the camel case is protobuf converted to json
Ah, my bad, must've missed it, thanks.
no problem, it is a dump truck of data in there
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}}```
interesting
it shouldn't ever omit that...that would mean that the latest block summary in the BlockIngester was null for some reason
ah, I see, that is the header for block 0
for some damn reason
protobuf omits things that are default value (like zero)
so in the places where I am just converting a proto to json it can be a little confusing
{'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}}
Yeah that looks right, not a big deal then.
Thought it might be a race condition thing.
Did a bit more testing with my harness and couldn't get it to happen past height 2.
yeah, I am having a hard time seeing how it would happen
Is there an RPC call for address history? I saw it mentioned in #111 but not seeing it in the wiki.
No, I wasn't sure it would be needed. I can add it quickly.
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.
I was expecting you would use listunspent
But depends on your flow
That would work better honestly
I just didn't see reference to it, one second
list unspent should be fast and work on all nodes
Ah, I just missed it, sorry.
History will need a node with addr_idx turned on
No worries
Oh yeah, in latest update getunspent verifies proofs all the way back to utxo root for the block
you want to see stuff from the mempool as well?
That would be nice. I'm seeing mempool txs right now I think.
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?
oh, yeah you are
sorry, confused myself for a minute
probably way wiser to do unique addresses per end user
while the feature exists in the protocol, it isn't very accessible
Got it. Are all wallets HD? And if so, is there a way to export the root key?
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
Gotchya. Are all addresses currently using ECDSA secp256k1?
default, yes. There is a key_mode=qhard where the keys are ECDSA, RSA-8192bit and DSTU4145 in 3of3 multisig
Neat
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.
cool, let me know if I can do anything to help
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.
yeah, can do
if you went that route, what format would the keys be in?
I could probably just match the encoding that you're using. We're already doing that for Amoveo and it's working well.
BTW, is your address format checksummed? Looks similar to bech32
in that case, just 'import' command and creating a json file with public/private key pair and an address spec would work
yeah, it is checksummed
Excellent. I was always surprised that ETH launched w/o checksums.
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.
so it has error detection, but not correction
Ah, I gotchya. You may be able to use an off the shelf library, I know BitcoinJ is well built out.
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.
But I understand that switching address formats is a serious undertaking...
@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
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.
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.
@Fireduck Cool, good to know we have the performance headroom.
@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
but, as said, a sidenote, which i’ve now voiced
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?
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
just to make it a pain so people don't do it unless they actually care
also then if someone is using a stable address for real, a single post auth session capture will not enable to burn that one
ux and security are an unhappy marriage and marketing is the old salt, or somesuch
@bitbumper get
get_unspent on a wallet with 10,000 address is taking about 15 seconds on a virt with a really questionable cpu
Cool, good to have a ballpark number. Is that scaling on number of accounts or UTXOs?
Accounts
One account with 24,000 utxos is a second