Baidu Ban Makes Bitcoin’s Fate Unknown in Its Largest Market

The ban of all bitcoin and virtual currency-related advertising from the online portals of China’s largest search engine, Baidu, has thrown the fate of cryptocurrencies into a dicey state in the world’s largest market for bitcoin trading and mining. As China literally controls the bitcoin market, this move is likely to have a multiplier effect on the entire ecosystem. Though the reported […]

The post Baidu Ban Makes Bitcoin’s Fate Unknown in Its Largest Market appeared first on CCN: Financial Bitcoin & Cryptocurrency News.

News – CCN: Financial Bitcoin & Cryptocurrency News

Making peer connection in Python

I’m trying to make a simple peer connection using Python.

If I understand correctly communication begins by sending a “version” packet to the receiving node. The node then sends back a “verack” packet, afterwards you may begin querying for data/pushing txs.

Ken Shirriff’s blog has proved invaluable in getting me this far but I’m unable to get his code examples working, possibly because they’re dated?

In particular, when running:

https://github.com/shirriff/bitcoin-code/blob/master/minimalPeerConnection.py

the socket closes immediately. I fail to receive back a “verack” and am unable to proceed with pushing my tx. Note that I’ve replaced his hard-coded IP with a currently operating node (124.248.237.178:8333).

I’ve attempted to construct a more “up to date” version packet (70002) referencing these docs but run into the same issue:

import struct import socket import time import hashlib import binascii  magic = 0xd9b4bef9  def makeMessage(magic,command,payload):     checksum = hashlib.sha256(hashlib.sha256(payload).digest()).digest()[0:4]     return struct.pack('L12sL4s',magic,command,len(payload),checksum).encode("hex")+payload def makeVersionPayload():     version = 70002     services = 1     timestamp = int(time.time())      adr_u = "::ffff:127.0.0.1"     services_u = 1     port_u = 8333      adr_me = "::ffff:127.0.0.1"     services_me = 1     port_me = 8333      nonce = 0      user_agent_bytes = 0     start_height = 0     relay = 0      #https://bitcoin.org/en/developer-reference#version     payload_hex = "";     payload_hex += struct.pack("<L",version).encode("hex")     payload_hex += struct.pack("<Q",services).encode("hex")     payload_hex += struct.pack("<Q",timestamp).encode("hex")     payload_hex += struct.pack("<Q",services_u).encode("hex")     payload_hex += struct.pack(">16s",adr_u).encode("hex")     payload_hex += struct.pack(">H",port_u).encode("hex")     payload_hex += struct.pack("<Q",services_me).encode("hex")     payload_hex += struct.pack(">16s",adr_me).encode("hex")     payload_hex += struct.pack(">H",port_me).encode("hex")     payload_hex += struct.pack("<Q",nonce).encode("hex")     payload_hex += struct.pack("<B",user_agent_bytes).encode("hex")     payload_hex += struct.pack("<L",start_height).encode("hex")     payload_hex += struct.pack("<B",relay).encode("hex")     return payload_hex  ip = socket.gethostbyname("124.248.237.178") port = 8333 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print "connected to node..." sock.connect((ip,port))  hex_msg = makeMessage(magic,"version",makeVersionPayload()) print "sending version packet" sock.send(binascii.unhexlify(hex_msg))  while 1:     msg = sock.recv(4096)     if not msg:         print "disconnected"         exit()     else:         #expecting verack?         print "response: ",msg 

Can anyone point me in the right direction?

Recent Questions – Bitcoin Stack Exchange

Bank of Canada: “Our model predicts that, as virtual currency becomes more established, the exchange rate will become less sensitive to the impact of shocks to speculators’ beliefs. This undermines the notion that excessive exchange rate volatility will prohibit widespread use of virtual currency”

submitted by /u/FrancisPouliot
[link] [comments]
Bitcoin

why is double-spend not an issue for payment channels?

Micropayment Channels (MPC) cannot be used currently because of transaction malleability, I hear.

AFAIK, people saying that have in mind that the refund & payment tx, which have as input the deposit tx (Dtx), could be invalid if the deposit’s hash was changed. I m fine with this.

What I don’t understand: if the attacker manages to modify Dtx’ hash before it made it to the blockchain, I believe (s)he can equally manage to double spend the btcs supposed to go to Dtx. Thus, double spend seems as much a threat as malleability. Yet no one discusses it, so I suppose something is wrong with this reasoning. What?

Thanks

Recent Questions – Bitcoin Stack Exchange

US Health Department Blockchain Research Contest Sees 15 Winners

15 winners have been selected by the Office of the National Coordinator for Health Information Technology (ONC), a division of the Department of Health and Human Services (HHS) following its blockchain research challenge. Announced last month, the HHS sought whitepapers as a part of the “Use of Blockchain in Health IT and Health-related Research Challenge”, […]

The post US Health Department Blockchain Research Contest Sees 15 Winners appeared first on CCN: Financial Bitcoin & Cryptocurrency News.

News – CCN: Financial Bitcoin & Cryptocurrency News