transactions in rpc block response sometimes have chain null and sometimes correct chain

when doing e.g. a blockByNumber rpc request I am getting a result like this from parity: https://gist.github.com/ligi/fbc7061d93f087cf0eb0f4db83d1fced what is puzzling me that some transactions have: chainId”:null and some have “chainId”:”0x1″ I do not see the pattern when either variant is returned. geth does not contain the chainId there at all. Can someone enlighten me what…

Bad randomness exploitation

There is a contract with a betting function that calculates a random number and send you back a reward if winning. The betting function looks like: function bet() public payable { if ((random()%2==1) && (msg.value == 1 ether)) { if (!msg.sender.call.value(2 ether)()) throw; } } function random() view returns (uint8) { return uint8(uint256(keccak256(block.timestamp, block.difficulty))%256); }…

BIP32 funds not appearing in wallet

So I’m developing a system that generates addresses for users to send bitcoins too in order for them to deposit on the system. I generate addresses using the following: var derivedPubKey = config.BIP32_DERIVED; if (!derivedPubKey) throw new Error(‘Must set env var BIP32_DERIVED_KEY’); var hdNode = bitcoinjs.HDNode.fromBase58(derivedPubKey); exports.deriveAddress = function(index) { return hdNode.derive(index).keyPair.getAddress().toString(); }; An example…

Verify Bitcoin Transaction

Following the great post [Redeeming a raw transaction step by step example required, I came up with code below but the verification failed. // pubkeyBytes, len: 65 // 042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9 // data, len: 32 // 30f10a6468b7d98257af63fb40dfcf2cefe991346fd37c67cf7b51ff8d4404d3 // signatureBytes, len: 71 // 30450220587ce0cf0252e2db3a7c3c91b355aa8f3385e128227cd8727c5f7777877ad772022100edc508b7c14891ed15ab38c687019d7ebaf5c12908cf21a83e8ae57e8c47e95c ECPublicKey publicKey = (ECPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC, KeyBuilder.LENGTH_EC_FP_256, false);; Secp256k1.setCommonCurveParameters(publicKey); publicKey.setW(pubkeyBytes, (short) 0, (short) pubkeyBytes.length); Signature eccSign…