understanding bits and difficulty in a block header

This block:
https://blockchain.info/block/00000000000000000025c089d0a7b2bf6241888c4dd90ab7a4c4baa6a2823551

Shows difficulty at 3,007,383,866,429.73, and bits at 392009692.

If I want to see how many zeros need to be in the hash, I believe I can just do:

(log2(3007383866429.73) + 32) / 4) => 18.362911541451258

Which is correct.. But how does bits come from difficulty? How can I calculate the number of zeros from the bits instead of the difficulty?

Kucoin API buy and sell

Why, when I using Kucoin API, get_tick, for market info, I see, that sell is bigger buy?

Example from oficcial API Documentation:
With a symbol param

{
    "coinType": "KCS",
    "trading": true,
    "lastDealPrice": 5040,
    "buy": 5000,
    "sell": 5040,
    "coinTypePair": "BTC",
    "sort": 0,
    "feeRate": 0.001,
    "volValue": 308140577,
    "high": 6890,
    "datetime": 1506050394000,
    "vol": 5028739175025,
    "low": 5040,
    "changeRate": -0.2642
}

block decode failed (-22) error solo mining while submitting block

Hi I have developed hardware/software to mine bitcoin it’s working and getting me the results (getting nonce since the design takes only .2sec to complete the task)i am trying to submit in my local bitcoin wallet its error message is

Traceback (most recent call last):
  File "./submit_b.py", line 282, in <module>
    rpc_submitblock(rpc_con(),block_miner(rpc_getblocktemplate(rpc_con()),binascii.b2a_hex('Bitmatriz'.encode()).decode(), "19DvxDw7zfiBDcvZCyhboNjJ2VW6d2mD2P"))
  File "./submit_b.py", line 124, in rpc_submitblock
    message = rpc_con.submitblock(param)
  File "/home/bitmatriz/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 141, in __call__
    raise JSONRPCException(response['error'])
bitcoinrpc.authproxy.JSONRPCException: -22: Block decode failed

Below is the data generated from the script

000000200b19cbe6b745a8ecc66bdd8e23cc84159701fdfd7dae5300000000000000000014e87cb06ddef0a2c7d74c1c3af82bcde4da560624fb4d3462e093a92b68c329bbb9965adc975d170fd01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff110364cd074269746d617472697a43f740c0ffffffff014b46df011976a9145a3308e6ef31335c46c807a23134dc2142bd4dd288ac000000000200000001cd796d7718307fd1107dac22d847e256e3f5573244fdb407e1828395c541cff5010000006b483045022100a11cdfcc5b93e79dc20a8cc94aef3f0176642fba8ba1aa8b610711ef2d233ff602205d9ab01f4461b7244fa4516ed8e4a71dd169ad0c8d61a74ef689638a9fa9770c012102f07c0940fcb4487c83cb4c2712c65d50d43778dfc2aa2e41afe1ad2fc8284aeaffffffff020051e90b000000001976a9143da76c020f5010b668e1831abc41b74b6759a48b88ac1163d11a000000001976a91432eb719e44987559d33e324edc03922c9f45ff9388ac0000000002000000013a916bdec8b9825e8244ac9be4589f561e98e9091914e0e2514c4dd8579cfddd010000006b483045022100e763bf000a6d463b2efdd974e66cad650e2cf0099beb4c363be8fe04b151cd5602201d36992639ead345ab17ccf5a8017b6d5b0291d424f6559a65edf77f7ea2193f012103409891d09a784928c14c94798b8b772705a1555cee27a312878ed0f3de7b177dffffffff022080df11000000001976a9143da76c020f5010b668e1831abc41b74b6759a48b88acc9a72507000000001976a914df1451dc57e93b6effd78426d8bbe624fc8e2c9788ac00000000020000000278a17fb798fb15efd6fdba6a8c368618598a9e90a2841e13b02d42a8ace45b79000000006a4730440220693536f3f1778a5bfd753e65e3400ede2c89db95454643517329436f46873ce602207b55054a899e34dc974055bb9f036ae68d0cf9ceab09757d3a54e0851292e663012103112149665e33e8615678ef32ac70a31f6e21e5d63f102ef612eaa291b7c8ea3ffeffffff2a3e97ee64583bd8309ca3f036b5ef449471052b20127b9736528f5218ddbc6f5e0000006a47304402205ee2d6638b8ca5351ce3f4dcf85ceab1e908874d8b0e96f03a2e6203e5f3c973022004a9959d502c75e4edb80902f6ad5c94d6cd294d99a42bedaf317859b2b7de38012103d79f0989e26b0fd05b0c26890c68eb8462fa64143ac5461cf9cf826e87a499d9feffffff02a3d90b00000000001976a914a6517ba1358cd2c8bd9efeea034666cff705ffb588ac232620000000000017a91429fe11644440db7358be3797e8e646aba4854fea8761cd07000200000003ecd72647b39d7e6501042c03331d52621f2baf290f0fcbae28e129605258a5a5530100006a47304402204f94267ff3d32027eebed4970fe6a3ad0777deb42901ef3c2ad561daefd88c8e022027168797fb959036ca795a66e27fbb6cebbac8f00a5ac9dbc6d6b70f4c4b6350012103f16891bc25b64d37ce1a3f0a226025224e74de16c74d585cb6862cad2a2b3891feffffff38638063f840f8ddb625c48af30ccbe5b4c0be57a7f18158c849b9628690c8607b0100006b4830450221008ed743837a4f64b68e2a6892b813990c40c7ffa9c35e5c434812d66a48189eb302207861fc3bf3369ceb9d290223cce89997a2fd66792a3c492f390fe1bba233ba34012103408e1981ee02bff847768056d5f2ff3d641074a26561fb1a82f60d0a50d1f36efeffffff3f1e7f5b0f6cbf3ac58d0b2cfb2927d15517af78e690c65a631f122fba205bdb010000006a473044022056c44992ef795ef6dfe8fbb635a25581b646e8c9a0718f4e51f5c49b81fab6af0220511f7159c352c553c4694e7bb9e9653f0148221bf9832e95a231d3cff602c16f0121023f053b81f7c056db9d3cfa1e43b63067c72b757903b745fca4d1944f998a65b7feffffff02c0af1c00000000001976a914825558a5137ad409de081d1bab50d2c81aa114a488accf790a00000000001976a914d7476512c5cce597952dab791507e985cbbeaee888ac61cd0700020000000326ff1010699c89dfd699d9ff902d143fe8a787c023ff2af04865d226e47fc1e5550000006b483045022100c527eeb2c90170093e93dd8f20c64337dfd0daa939f5d648db872f6ec064627702206f35bd8fb109cb3a1836853acc3f9632b79905828e882c1361710358a79fdd250121024f37e81077a802bc809ce265648ac286572ed1d5fd252af2fc63ffe73c87431efeffffff637bcb526b59974c8665922a3597a743792781686d0358f493a25e99c4d4a9fc010000006a4730440220469d67f1f0b55cdd33ea2a150b0ff1c565a2d7751e905f3c020577abd6c15768022033d89aa192ae4f084284f4900a15f03c830762d5b44c91b38b60846f116b74a3012103781c5037b192928351b09b5e1bb4ab5fc0852089913069bbab1c86e271a9e82ffeffffffae035761ad9e625ae4a48d877f56d667febb16e2833119f2c30db7f7be3208a9380000006a473044022022397103c17ba4699bdd6bb8dac2358d604bd8aa7f0674a0460388009d3b6a00022048b8100c7a41e897e37d6a7d1127be318d74392a47654408b9fa42b50856d2c901210342971a8d79776e84673b1b6602670fda7f90a6f89fa1742a376060f120dadff4feffffff02c6780a00000000001976a914f53526f0a5cf575fccb7246efb4eda006fcae7aa88ac5c3b2d20000000001976a9142ea84977ee79a11c425e7acb4252e7aba48be9a488ac61cd07000200000002ac33eb581f2cb876d19dba0378a91b09db45d8bb2bab9146039b816b4509f339390000006a47304402207404eafa0392b466558bcf7e4d3014c13c5b54dbf343cb627bbd06e846c395c4022036bd8121f4dc7d220e7450120ababa99b3fbe0c764365207fd82f7799dc6e18a0121025df903b4a47675330267a1fca1488ade240d3068002d0e1ad96b508c69ae2b57feffffff5f377e25b750102242b6f202a1543d74d259282514fd5b6031f58c3e879f4658110000006b483045022100d517a1301bbadd8f6565bb089ddddfacff8bc5a7ab6e16a57a117192836dfc0602203dc0773f380a1f4b8e701bd418b3fdad36dd715291baa0595de2cf2f532b41740121031cc432fb07d5844e0c8f7d5d41fc61a20912cea6722ed9435be7b1ea0fea53b2feffffff0224a60f00000000001976a914584ab36305080d7949e1c09ec7a8786d0728193e88ac20d50b00000000001976a9147a623d6db1e73a2417c6b2c46ab8da023161426388ac61cd0700020000000238638063f840f8ddb625c48af30ccbe5b4c0be57a7f18158c849b9628690c860b50000006b48304502210090925ad8c919efa945bbf3f7a43bcff97aba6a51b428660e50b06bc28dcac54c0220589b20a6c5c05d262e26b8e02b9cf0e164ff4ce8a2b6a1c34ce0d46950dab21d012103a2e1fc8239500ea0fe10adff2e28a526e8c7aa4dd0b93d25ad71ff3f513cf066feffffff965eaa5a0709f4e24253dce250fe35b1089e65f98638c5711f1f783bc0eb8368010000006b483045022100b8d39ec9e47c3f9cba1c4713e57d0ea65c229252d5e441f1dc9febdb9489767902207750f4ee26e1ae4f50cc0596e59aae0dbc7973504d63a0179fea1b970d4d961601210361693c29640428069fd93fcac5e81defc8c49238e9a16ebd26e84ed66ea2beb4feffffff0221db0b00000000001976a914fe64ac29365b7e3278603aa133102d2957d274b288ac90ab1e00000000001976a9148eb23a0151482cdccde9577d6dad727b0148077e88ac62cd070001000000019668f4943ba630c233632d22513e8cacd065dca41f38d6815da06b70c118e915000000006a4730440220505b58dc693411127b43bf9d0d575e292d8714f8a61d0873be4da01059c7d4da02203fe8811a37e81570e7f2a9ed9f3a0ef78f4edda38327103281702a3a2d89a40401210289cd7d41dd230abf51e7e7f94d1a3dc7e08eb25a0e11a5f4d032d2620ec01e7effffffff029d580600000000001976a914d9f950ac7ea4853df9ff3c8598f5de5b615fb24f88ace8123c00000000001976a914db7459757a54efff1f749162ae5a955e1d3821e588ac000000

How to get crypto currency wallet balances

I am trying to build an app that will pull in all my wallet balances. I can easily do this with exchange apis, but how do I get balances that are stored in wallet?

Do I need to set up bitcoind, litecoind, neo equivalent, and all of the rest? That sounds like a lot of work and A LOT of server space / resources?

I’m surprised I haven’t been able to find a single unified api provider, where I can just send a BTC address, or a LTC address or a NEO address and it returns me a balance. Does such a thing not exist?

Thanks 🙂

In what circumstances would a block appear in the Leveldb .ldb index but have no data in a .dat file?

I’ve observed this behavior with Bitcoin Core v0.15 while parsing the LevelDB index in .bitcoin/blocks/index. It is also a situation that is obviously accounted for in the Bitcoin Core source code here (See BLOCK_HAVE_DATA and BLOCK_HAVE_UNDO). I am just looking to understand what would cause this to happen? Can a peer receive the block header before receiving the block itself? I’m finding that only the top few blocks in the chain seem to be missing data; They appear in the index but not the .dat files.

Bitcoin Core data to csv

I would like to download the Bitcoin blockchain and use the data for machine learning purposes. For this, I have to get the data into a workable format like csv or a flat JSON etc.

I’ve read about approaches and the most common one seems to be through a monkeyDB. Do you know a source code that implements this method? Or do you know other methods that could be used to get the Ethereum blockchain data into a modeling friendly format?

Thanks!

How to unblock an account that is held to ransom

I have a blockchain account with bitcoins in but the account is held at ransom. I have to pay 2140$ to get a private key. Is there any way to report this to Blockchain.

I did a trading agreement. The dealer put my profits into a mining account on Blockchain. To retreive my funds I need to purchase a key from the dealer to have the funds released. Hope I am making sense

Refunding of payments made

I was scammed November 2017 by a woman called, Adele Johnson. I wanted to trade on bitcoin, but didn’t had the experience to do it myself. She offered her help to trade on behalf of me. I paid R8000 into my Luno account where she requested all my registration details as well my wallet address. She made use of Tradeway Option Platform to trade for me. According to her my money growth to $50 000 and for me to withdraw this money I need to pay $7000. I told her I don’t have such money, she got angry and blocked me.
A man, called Artem Vladys told me he can help me to trace this money through interpol. He requested a payment of $300 and he assured me that will be the only payment I had to make; which I made via Luno, I bought him bitcoin worth $300 and sent it to the wallet adress: 154oDjBXc1wSzYncP6YwrU7a9duVGd3J3. He requested another amound of $200, I unfortunately refused to make another payment before I haven’t seen what he did to assist me tracing my lost money. He got mad and he blocked me.
Both people said they work for bitcoin.
All the transactions shows in my luno account. Is there any possibility that I can trace this money? Is there not honarable people/organisation who can get my money back?