Is it possible to decode block height from a blockhash?



The block hash is a hash of the block header... but even if you could reverse the hash function (which is impossible, or Bitcoin would be broken), you wouldn't know the height, as the height is not stored in the header.

The header does contain a hash of the transaction Merkle root... but even if you could reverse the hash functions in the transaction Merkle tree, you wouldn't know the height, as the height is not stored in the transaction Merkle tree.

The Merkle tree does contain transaction ids... and if you could reverse the hash function used for computing the transaction ids, you would could learn the height, as since BIP34, the block height is stored in the input of the first transaction of a block (the coinbase transaction).

So, if you want to know a block's height for sure, you need to request at least its coinbase transaction, the Merkle path from the coinbase to the root, and the full block header. If they all match, you can be pretty...

0 0
0 0

Transactions are always executed in the block being mined. So, at any time, block.number will return the block height in which the transaction is being mined.

However, the hash of the block is not known until it is mined, and the output of transactions is part of the hash calculation, so the transaction has no access to the hash of the block being mined.

If this is any consolation, you can get the hash of the latest mined block, i.e. the one right before this block being mined with block.blockhash(block.number - 1).

Try this:

contract Test { uint public blockNumber; bytes32 public blockHashNow; bytes32 public blockHashPrevious; function setValues() { blockNumber = block.number; blockHashNow = block.blockhash(blockNumber); blockHashPrevious = block.blockhash(blockNumber - 1); } }

Make a transaction to setValues() then you will see that:

blockNumber is set at that number it was mined in blockHashNow is set at 0x...
0 0
0 0
""" Data structures to model bitcoin blockchain objects. """ import bitcoin.core import bitcoin.core.serialize import bitcoin.rpc from toposort import toposorted def script_to_raw_address(script): # extract the destination address from the scriptPubkey if script[:3] == "\x76\xa9\x14": return script[3:23] else: return None class COutpoint(object): def __init__(self, hash, n): self.hash = hash self.n = n class CTxIn(object): def __init__(self, op_hash, op_n): self.prevout = COutpoint(op_hash, op_n) self.nSequence = None def get_txhash(self): if self.prevout.hash == 'coinbase': return self.prevout.hash else: return self.prevout.hash.decode('hex')[::-1] def get_outpoint(self): return (self.prevout.hash, self.prevout.n) def set_nSequence(self, nSequence): self.nSequence = nSequence class CTxOut(object): def __init__(self, value, script): self.value = value self.script = script self.raw_address =...
0 0

You can block access to a port on a server with ufw. man ufw has a whole raft of examples but assuming it's enabled, it should be like this:

sudo ufw deny out to port 80

I've just tested this against my own server and it works. Remember that port 443 is used for SSL so that might want blocking too.

Remember, this blocks the whole of port 80 on this server.

If you want to start filtering based on subfolders (allowing some paths but not others) you're going to need something that proxies the requests. A firewall doesn't look at the content, it looks at the connections. To a firewall, a request for /subfolder is the same as a request to /a-different-subfolder.

So what you're looking for is a transparent proxy that you can twist into nixing some of your traffic. Parental-control software is probably your best bet for a quick setup. Something like dansguardian certainly used to be popular and I would say it warrants exploration. More information is available...

0 0

I have an element of initially unknown width, specifically a MathJax equation supplied by the user. I have the element set as inline-block to ensure that the width of the element fits its contents and so that it has a defined width. However, this prevents traditional methods of centering. That is, the following does not work:

.equationElement { display: inline-block; margin-left: auto; margin-right: auto; }

And the solution cannot be:

.equationElement { display: block; width: 100px; margin-left: auto; margin-right: auto; }

Because I have no idea what the width should actually be beforehand and if the user clicks on the equation, I need the entire equation highlighted, so I cannot set the width to 0. Does anyone have a solution to centering this...

0 0

The Block Withholding Attack should NOT be a concern. Here's why.

The Attack

A miner who finds a valid block can choose not to broadcast it. Say Alice is a miner and the block she just generated settles a dice roll. She wins if the coin lands on heads (H) but her newly discovered block landed on tails (T). She can broadcast this block, but then she'll lose the coin flip. To have a chance of still winning the coin flip, she therefore better NOT broadcast the block.

The Probabilities

A fair coin has a 50/50 chance of H or T. It's trivial to make any newly discovered blockhash determine a coin flip with these probabilities. However, with the Withholding Attack, Alice skews these probabilities. If she controls 10% of the hashing power, these are the possibilities:

45% some other miner finds a H block 45% some other miner finds a T block 5% Alice finds a H block, so she wins, and naturally broadcasts 5% Alice finds a T block which she withholdsThe block...
0 0

Command: getblock

nullgetblock "blockhash" ( verbose ) If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block . Arguments: 1. "blockhash" (string, required) The block hash 2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data Result (for verbose = true): { "hash" : "hash", (string) the block hash (same as provided) "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain "size" : n, (numeric) The block size "strippedsize" : n, (numeric) The block size excluding witness data "weight" : n (numeric) The block weight as defined in BIP 141 "height" : n, (numeric) The block height or index "version" : n, (numeric) The block version "versionHex" : "00000000", (string) The block version formatted in hexadecimal "merkleroot" :...
0 0

My Wallet users can interact with their wallet using our JSON RPC api. It is intended to be fully compatible with the original Bitcoind RPC protocol however some method calls are not supported.

No Blockchain Download - Save on bandwidth and disk space. No Need to run Bitcoind - Some VPS and shared hosting plans do not allow you to run custom processes Use Existing software - Most existing software that uses the bitcoind rpc calls will work transparently using Payment notifications Live synchronization with the web interface

Original Documentation available at


-rpcuser Should be set to your wallet identifier. This is a 36 character random string which can be found on your wallet login page.
-rpcpassword Should be set to your main wallet password. If double encryption is enabled your second password will need to be set using...

0 0

This is a perceptual image hash calculation tool based on algorithm descibed in Block Mean Value Based Image Perceptual Hashing by Bian Yang, Fan Gu and Xiamu Niu.


This module is installed via npm:

$ npm install blockhash-js

Use in the browser

To use this library in the browser, you can build it with Browserify with something like browserify index.js --standalone blockhashjs > blockhash.js

Include it and zlib.js on your page:

Blockhash var blockhash = blockhashjs.blockhash;

Call blockhash(src, bits, method, callback), where src is an image URL, bits is the number of bits in a row, method is a number 1-2 (see below), and callback is a function with (error, result) signature. On success, result will be array of binary values.

The available methods are:

Quick and crude, non-overlapping blocks Precise but slower, non-overlapping blocks

Method 2 is recommended as a good tradeoff between speed...

0 0

I added a person to my friends list a couple days ago and last week that same person decided to throw a big fuss over something really stupid (and this had already happened at least twice before that in the same week), which led me to block him.
Then, that man (the person I'm mentioning here) disturbed me and kept sending me private messages on facebook by using another profile (with fake pics) to continue this discussion. This time I reported this new profile of his and blocked him right after telling him a few things about why I had blocked him, but then he used another two brand-new profiles (again, with fake pics) to keep harassing me and disturb me - and I already reported those and blocked him again as well.
Now my question here is: Is there a way to block this person's IP in order to stop him from harassing me and disturbing me by sending me stupid messages? I'd really appreciate it if someone helped me with this :\

0 голосов · 1 подписчик · Просмотрено...

0 0

Hello everybody,

I've been doing a lot of hacking on DisplayLink USB graphics cards. I'm
not an expert on video decoding, so I'd like to hear your opinion on my

The acceleration capabilities of these devices are pretty limited: they
can basically do arbitrary framebuffer writes (pixel data can be
compressed with a custom Huffman code) and bitblt inside the
framebuffer. So any sort of conventional video streaming won't work, at
least not really well.

However, I've been thinking that at least 720p video might be possible
if some of the advanced compression techniques of, e.g., MPEG could be
used directly on the device. So what I'd like to get from ffmpeg is the
block motion information and not whole frames, but just the pixel data
for new blocks.

Is this possible/does it make sense?

Many thanks, Florian
0666 - Filemode of the...

0 0

Novacoind & GUI console commands

In command line:

novacoind help



in console.

For get help for command

novacoind help



in console


addmultisigaddress [account] Add a nrequired-to-sign multisignature address to the wallet" each key is a NovaCoin address or hex-encoded public key If [account] is specified, assign address to [account]. addnode Attempts add or remove from the addnode list or try a connection to once. addredeemscript [account] Add a P2SH address with a specified redeemScript to the wallet. If [account] is specified, assign address to [account]. backupwallet Safely copies wallet.dat to destination, which can be a directory or a path with filename. checkwallet Check wallet for integrity. ...
0 0

So, I am writing a webapp in python Flask with sqlite3 database. I am using SQLAlchemy. As part of my database I have these three tables. Here, table DisasterEvent has many to many relationship with Location Table(a disaster event occur in many locations and many disaster could have happened in that particular location. Is there a way to automatically populate association table when I insert data in DisasterEvent and Location table or should I do it populate it myself? Even if you guys haven't have sql alchemy experience, I would love to hear how it is done usually?

class DisasterEvent(Base): '''Disaster Event Table''' __tablename__ = 'DisasterEvent' id = Column(Integer, primary_key = True, autoincrement = True) title = Column(String(80), nullable = False) glide = Column(String, nullable = False) status = Column(Enum('current', 'alert', 'past')) description = Column(String) date_occured = Column(String(11), nullable = False) date_ended =...
0 0