Bitcoin Forum
April 08, 2020, 06:50:11 AM *
News: Latest Bitcoin Core release: 0.19.1 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 [55] 56 57 58 »
1081  Bitcoin / Bitcoin Discussion / Re: Who's the Spanish jerk draining the Faucet? on: August 06, 2010, 05:15:22 PM
If he/she lives near me I can pay him a visit... just saying.  Roll Eyes
Put up a bounty for the faucet thief......hmm....  Lips sealed

in bitcoins ^_^  good idea!
1082  Bitcoin / Bitcoin Discussion / Re: Who's the Spanish jerk draining the Faucet? on: August 04, 2010, 11:56:42 PM
Also dropping the coins being given out to 1 or 0.5 would significantly decrease the incentive of doing such a thing.

The incentive will always exist.  It just makes it harder/take longer, more effort and creativity involved.
1083  Bitcoin / Bitcoin Discussion / Re: Bitcoin graphics on: August 04, 2010, 04:15:44 PM
anyone wanna make a Bitcoin vehicle with Bitcoins as wheels?  http://nullvoid.org/bitcoin/cars.php <-- This may be a nice advertisement if a car dealer were to sell vehicles and accept Bitcoins as payment.

1084  Bitcoin / Development & Technical Discussion / Re: Difficulty on: August 04, 2010, 02:45:46 PM
Thanks ArtForz! ^_^

Code:
import struct

def SetCompact(nCompact):
"""convert bc compact uint to number"""
nSize = (nCompact >> 24) & 0xFF
tbuf = "\x00\x00\x00" + chr(nSize)
if nSize >= 1:
tbuf += chr((nCompact >> 16) & 0xFF)
if nSize >= 2:
tbuf += chr((nCompact >> 8) & 0xFF)
if nSize >= 3:
tbuf += chr((nCompact >> 0) & 0xFF)
tbuf += "\x00" * (nSize - 3)
return mpi2num(tbuf)

Code:
def uint256_from_compact(c):
nbytes = (c >> 24) & 0xFF
v = (c & 0xFFFFFFL) << (8 * (nbytes - 3))
return v

I confirmed again that both of these produce same output when using 0x1d00ffff
1085  Bitcoin / Bitcoin Discussion / Re: Bitcoin graphics on: August 04, 2010, 01:56:45 PM
A golden Bitcoin:

I used your design for my donation page. ^_^

http://nullvoid.org/bitcoin/donate.php?d
1086  Economy / Marketplace / Re: We accept Bitcoins on: August 04, 2010, 09:48:13 AM
Perhaps it would be useful to extract the information here and to put it in a wiki for easier review and updating?
1087  Bitcoin / Development & Technical Discussion / Re: Difficulty on: August 04, 2010, 09:06:57 AM
If C++ SetCompact(unsigned int nCompact) function is
Code:
CBigNum& SetCompact(unsigned int nCompact) {
    unsigned int nSize = nCompact >> 24;
    std::vector<unsigned char> vch(4 + nSize);
    vch[3] = nSize;
    if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
    if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
    if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
    BN_mpi2bn(&vch[0], vch.size(), this);
    return *this;
}

With Python equivalent of
Code:
def uint256_from_compact(c):
nbytes = (c >> 24) & 0xFF
v = (c & 0xFFFFFFL) << (8 * (nbytes - 3))
return v

And PHP equvalent of
Code:
function uint256_from_compact($c) {
$nbytes = ($c >> 24) & 0xFF;
return bcmul($c & 0xFFFFFF,bcpow(2,8 * ($nbytes - 3)));
}




then for C++ Getcompact() function
Code:
unsigned int GetCompact() const {
    unsigned int nSize = BN_bn2mpi(this, NULL);
    std::vector<unsigned char> vch(nSize);
    nSize -= 4;
    BN_bn2mpi(this, &vch[0]);
    unsigned int nCompact = nSize << 24;
    if (nSize >= 1) nCompact |= (vch[4] << 16);
    if (nSize >= 2) nCompact |= (vch[5] << 8);
    if (nSize >= 3) nCompact |= (vch[6] << 0);
    return nCompact;
}

how can I produce simplistic code for python/php to produce equivalent function?


My intention is to use the function in this php snippet
Code:
function GetNextWorkRequired($block, $bits, $nActualTimespan) {
$nTargetTimespan = 60 * 60 * 24 * 14; // 2 weeks
if ($nActualTimespan < $nTargetTimespan / 4) { $nActualTimespan = $nTargetTimespan / 4; }
if ($nActualTimespan > $nTargetTimespan * 4) { $nActualTimespan = $nTargetTimespan * 4; }
$bits = uint256_from_compact($bits);
$bits = bcmul($bits,$nActualTimespan);
$bits = bcdiv($bits,$nTargetTimespan);
$bits = uint256_to_compact($bits); // <-- Need to translate C++ code for GetCompact()
return $bits;
}
1088  Other / Off-topic / Re: The Wolf Game, 1 players required, 1 day remaining on: August 04, 2010, 08:51:36 AM
X . . . X  *glances at Quantumplation and Kiba suspiciously*
1089  Bitcoin / Development & Technical Discussion / Re: Some Statistics on: August 03, 2010, 10:11:54 PM
If you have a local ap (apache+php) server, you can run this code and keep it open in browser window and it should update approximately every second.  It isn't 100% precise, but fairly close.

This statement is no longer accurate.  Initially I had been generating my own timestamps based on when the script would see a new block.  Now the timestamp data is extracted from the database and is precise as possible. 
1090  Bitcoin / Development & Technical Discussion / Request For Designs: Bitcoin Client User Interface on: August 03, 2010, 09:21:39 PM
I propose for the community to establish ideas and designs on how to present an implementation of a Bitcoin client.

For Bitcoin to establish successfully throughout the world there must be a variety of clients, each designed to satisfy to a particular market or community.

In my opinion, the primary, official client design is focused more on developing Bitcoin than to offer usability to satisfy expectancies of users.  And anyone in the community can and are encouraged to contribute to provide more and better clients.

Some ideas for clients/interfaces:
  • web browser extensions
  • web-based or site-specific (e.g. fb app)
  • software-specific plugins (e.g. pidgin)
  • pda, mobile phone

Existing clients: http://www.bitcoin.org/wiki/doku.php?id=bitcoin_clients
1091  Bitcoin / Development & Technical Discussion / Re: Bitcoin 0.3.2 released on: August 02, 2010, 07:01:02 AM
The icon STILL doesn't appear in KDE environment anymore ever since 0.3.0 and not in 0.3.7.  What happened?  This is a nuisance because whenever I minimize Bitcoin I cannot rrecover it and must kill the process and restart it.
1092  Bitcoin / Bitcoin Discussion / gkrellm/conky on: July 28, 2010, 04:55:28 AM
Does anyone have any need/use for any data/information to appear in gkrellm or conky?  If so, perhaps suggest here and I or someone else can offer assistance with implementing types of information to become available.
1093  Bitcoin / Development & Technical Discussion / Re: Difficulty on: July 28, 2010, 01:44:28 AM
It appears that block 70718 was found two hours in the future and followed with block 70719 being found about two hours in the past (from the future date of previous block).

Code:
-7017 seconds to find block 70719
  8153 seconds to find block 70718
    49 seconds to find block 70717
   524 seconds to find block 70716

Code:
block timestamp
70715 1280275621
70716 1280276145
70717 1280276194
70718 1280284347
70719 1280277330

This doesn't seem to have any effect on things so much other than providing a kind of inaccurate depiction of statistical results every now and then (when a block is claimed to be from the future or the past), however what would happen if either the first or second (whichever one triggers new difficulty being established) of a new set of 2016 blocks is generated  to have a timestamp 2+ weeks in the past or the future?  If in the past, I presume according to the code in main.cpp: GetNextWorkRequired function that the lowest accepted interval is 3.5 days.  And if in the future I presume according to the code the lowest accepted interval is 56 days.
1094  Bitcoin / Development & Technical Discussion / Re: Difficulty on: July 28, 2010, 12:31:31 AM
Actually, calculating with another digit comes out to 244.213223092375323881335701184896212407930361873708113773326734402748260502489 1554339282075169582811726687822061777635447902413461818393548574922122914786456 6654051064077556842993973623686279076537890477160907158869253835628402573582928 178404029229380767999068 and thus could be rounded up to the value you suggested Insti.
1095  Bitcoin / Development & Technical Discussion / Re: Running on a port other than 8333 on: July 27, 2010, 02:53:46 PM
Satoshi pointed out that allowing bitcoin/bitcoind to run on a non-standard port could be dangerous, because if misconfigured two bitcoins might both open and write to the same database.  To prevent that, the <datadir>/db.log file is used as a lock so only one bitcoin can access the same datadir at a time (uses boost::interprocess::file_lock, which is purported to be cross-platform and well-behaved, even if bitcoin crashes).

Additionally you could run each client as a different system user.
1096  Bitcoin / Development & Technical Discussion / Re: Difficulty on: July 27, 2010, 02:52:04 PM
Hehe, thanks. I could provide more accurate precision, but I think that is good enough.
1097  Bitcoin / Bitcoin Discussion / Re: Proof-of-work difficulty increasing on: July 27, 2010, 11:02:15 AM
I designed a page to show history of difficulty values and published the code at http://bitcointalk.org/index.php?topic=587.0
1098  Bitcoin / Development & Technical Discussion / Difficulty on: July 27, 2010, 10:11:51 AM
http://nullvoid.org/bitcoin/difficultiez.php

Code:
<?
header("Content-type: text/html");
require_once 'jsonRPCClient.php';
$data=new jsonRPCClient('http://127.0.0.1:8332');
$blockcount = $data->getblockcount();
$now = date("U");
$blockfile = "blockdata";
$data = file($blockfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); array_pop($data);
?><html>
 <head>
  <meta http-equiv="refresh" content="100000">
 </head>
 <body>
  <pre>
<?
function humantime($secs) {
if ($secs<0) return false;
$m = (int)($secs / 60); $s = $secs % 60; $s = ($s <= 9) ? "0$s" : $s;
$h = (int)($m / 60); $m = $m % 60; $m = ($m <= 9) ? "0$m" : $m;
$d = (int)($h / 24); $h = $h % 24; $h = ($h <= 9) ? "0$h" : $h;
$d = ($d <= 9) ? "0$d" : $d;
return $d."d $h:$m:$s";
}

// Converted from ArtForz's python code http://bitcointalk.org/index.php?topic=464.msg4080#msg4080
function uint256_from_compact($c) {
$nbytes = ($c >> 24) & 0xFF;
return bcmul($c & 0xFFFFFF,bcpow(2,8 * ($nbytes - 3)));
}

$tblock = 0;
$nTargetTimespan = 60 * 60 * 24 * 14;
bcscale(256);
foreach ($data as $line) {
$blocks = strtok($line, " ");
$date = strtok(" ");
$avghash = strtok(" ");
$bits = strtok(" ");
if ($blocks == 0 || $blocks == $tblock) {
$tblock = $blocks + 2016;
$blocknum = str_repeat(" ", 6 - strlen($blocks)).$blocks;
echo "Block $blocknum was generated at $date (".date("r", $date).")";
if ($blocks != 0) {
$intervalnum = $date - $lastdate;
$interval = str_repeat(" ", 9 - strlen($intervalnum)).$intervalnum;
echo "    $interval seconds interval (".humantime($intervalnum).")";
echo "   Difficulty: ".bcdiv(bcdiv(bcmul(uint256_from_compact(0x1D00FFFF),1000), uint256_from_compact($bits)), 1000);
$lastdate = $date;
}
echo "<br>";
}
}
?>
  </pre>
 </body>
</html>
1099  Bitcoin / Development & Technical Discussion / Re: Stealing Coins on: July 27, 2010, 06:14:38 AM
I'm glad that there's guys like Red out there keeping a sharp eye out on things! This thread also makes me appreciative of open source software, since there's so many smart and interested people on this forums that can validate the software and place an additional degree of trust in it. Not sure that Bitcoin could be too successful if it was closed source!

Actually, quite the opposite.  What you read may seem like intelligent conversation that makes sense and makes you feel more trustworthy, confident and excited about Bitcoin, but, like http://www.youtube.com/watch?v=lBp5ag6SJH4 it's just fabricated wording to sound good.</sarcasm>
1100  Other / Off-topic / Firefox Disable Ctrl-Q on: July 24, 2010, 11:23:33 PM
Pushing Ctrl-Q terminates Firefox even if "Warn me when closing multiple tabs" is enabled.  I found keyconfig which allows disabling it and it works!  This is very useful for those who have Firefox profiles designated for anonymous surfing and who may accidentally push Ctrl-q and lose their progress.

http://forums.mozillazine.org/viewtopic.php?t=72994
Pages: « 1 ... 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 [55] 56 57 58 »
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!