Bitcoin Forum
May 06, 2024, 12:07:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Local / Новички / Интеграция FluxBB и BitCoin on: March 02, 2011, 08:31:21 PM
Решил попробовать сделать на основе биткойновского JSON-RPC и движка FluxBB полноценный форум с торговлей "цифровыми товарами" через биткойны (идея магазина походу эволюционировала Smiley )

https://web-attack.org/dev/

Собственно, основных отличий два:
1. В профиле появилась вкладка BitCoin, являющая собой полноценный web-клиент для биткойнов. Доступны почти все возможности стандартного клиента, из отсутствующих фич можно назвать лишь генерацию монет Smiley
2. Появился новый тэг [pay=xxx] и соответствующая система payID. С её помощью можно быстро и удобно торговаться любой цифровой информацией с другими пользователями форума. Чтобы начать торговлю, нужно создать payID для каждого отдельного товара во вкладке BitCoin профиля, указать название товара, его описание, цену, является ли он одноразовым (т.е. может ли его купить только один юзер, напр. номер ICQ или пароль к какому-либо серверу; либо его может купить сколько угодно юзеров -- напр. какая-либо инструкция или ссылка на какой-либо файл). После этого вы выбираете ваш payID и информацию, которую вы хотите продавать, кладёте в тэг [pay=xxx][/pay], где xxx -- номер вашего payID.

Пока у системы могут быть баги, которые, собственно, будут исправляться; если смогу дочистить и дофиксить код, скорее всего, опубликую модификации под GPL (хотя гарантировать не могу, тут нужно будет договариваться Sad )

Форум тестовый, разделов пока нет, для серьёзной торговли не подойдёт.
2  Bitcoin / Development & Technical Discussion / BitCoin + FluxBB = Trade forum? on: March 02, 2011, 08:16:48 PM
Here is my little test project. A FluxBB forum with added BitCoin client (via JSON-RPC, of course) and payID functionality.

https://web-attack.org/dev/

The client works just like the desktop one, except without generating coins, of course. Be sure to add a BitCoin address when first visiting the BitCoin tab in the profile.

PayIDs, on the other hand, allow one to easily sell access to any information to any other forum user. Basically, you register as a forum user, add yourself a payID for each item you are selling, then put the data to be sold inside the [pay=xxx]data[/pay] tags, replacing xxx by your payID number.

Soon after I'll clean and polish the code it will be opened under the terms of GNU GPL.
3  Local / Новички / Предложение интерфейса on: January 27, 2011, 07:06:23 PM
В некоторой степени вдохновлено виндовым WM Keeper'ом и Keeper Light'ом.
http://bitcointalk.org/index.php?topic=2022.0

Вместо вкладок с выбором, какие переводы отображать -- фильтры (по типу, по дате, и по адресу отправки/получения).
Вместо "x/unconfirmed" или "x confirmations" -- число подтверждений с соответствующей иконкой. Для ОЧЕНЬ большого числа подтверждений иконка не отображается.
Вторая вкладка -- адресная книга. При выборе в ней адреса (будь это адрес собственный или адрес получателя) и нажатии на кнопку "Transactions..." должен быть переход на первую вкладку и установка фильтров на показ только переводов соответствующего типа на этот адрес.
Третья -- настройки переводов. Предложенные тогда настройки были:
[ ]Добавлять комиссию без подтверждения (автоматически)
[0.01] Сумма комиссии за один килобайт (это если увеличение суммы действительно влияет на скорость обработки).
[ ]Разрешить точную настройку комиссии в окне отправки платежа (с предупреждением о том, что если будет слишком мало, перевод затянется)
[X]Создавать новый адрес после каждого полученного перевода (если выключить, то адреса автоматом создаваться не будут)
4  Bitcoin / Development & Technical Discussion / Interface Optimization on: November 30, 2010, 03:38:15 PM
Bitcoin is a very nice system, but the program's interface could have a little work. Here is my concept of the interface (somewhat inspired by a some proprietary payment system's Windows interface):

Instead of separate tabs for 4 kinds of transactions, we have four "filter" options":
1. All transactions / Sent or Received transactions / Sent only / Received only.
These work just like the tabs above.
2. Today / Last 3 days / Last week / Last month / Last quarter / Last year / All time
This filter allows you to see only the recent transactions, and also is a nice way of cleaning the transaction list for the user.
3. All receiving addresses (works only when "Received only" is chosen) / (list of receiving addresses)
Allows you to easily sort received transactions by the address they were sent to.
4. All recipient addresses (works only when "Send only" is chosen, supposed to take the place of button #3)
Allows you to sort the transactions by the address you sent them to.

The text boxes "n/unconfirmed" and "n confirmations" are replaced by images, followed by a number of confirmations. There is no image for transaction with extensively large amount of confirmations (it may be 100 or 1000, but for sake of illustration, the "secure" icon is just at last 3 "confirmed" transactions)

(those grey transactions are NOT supposed to be shown at all, but are shown semitransparent for the sake of illustration)

The balance needs some currency indication, so the new users don't think the balance is in dollars/euros/pounds/yen/anything else.

The second tab is "Address Book". It works the same way as the "Sending" part of the address book button on the toolbar. An extra button "Transactions..." switches to the first tab, sets the filter 1 to "Sent only" and filter 4 to the address that was selected by the time the button is pressed.

The third tab is "Transaction Options". It probably will contain such options as:
"[X] Add transaction fees to transactions automatically" (with no extra message box)
"Default transaction fee per KB: [0.01]"
"[ ] Allow modifying transaction fees for separate transactions" (with a message box like "Warning! Setting transaction fees as too low will result in your transactions being done slower." and respectively a new input field in "Send Coins" dialog)
"[X] Create a new receiving address after each transaction received" (so if someone turns it off, no extra addresses will be automatically created)
and others.
5  Local / Разное / Цифровой магазин BitCoin on: October 07, 2010, 05:13:40 PM
При поддержке форума web-attack.org, представляю вам так называемый "цифровой магазин", основанный на BitCoin.

https://web-attack.org/bitcoin/

"Цифровой" магазин отличается от остальных тем, что продаваемым товаром является некоторая информация: номер ICQ, регистрационный ключ к программе, код карты пополнения баланса для чего-либо, или данные для доступа к какому-либо серверу.

На данный момент регистрация пользователей отсутуствует, и добавлять товары может любой, но при этом все товары проходят премодерацию. Комиссия на данный момент отсутствует.

Движок открыт (GPLv2), но пока что вследствие активной разработки нигде не опубликован. На данный момент вы можете запросить у меня исходный код скрипта, в будущем планируется опубликовать его на sourceforge либо Google Code.

Надеюсь, вам (вне зависимости от того, покупатель вы или продавец) понравится этот магазин.
6  Bitcoin / Development & Technical Discussion / A PHP digital bitcoin store on: September 14, 2010, 03:58:29 PM
This is a (very bad) piece of PHP code that uses JSON-RPC to create a bitcoin store for digital information (For example, a password to a certain file or log-in info for a certain site). It uses JSON-RPC PHP client script to connect with bitcoind.

Code:
<?php
// (c) MrBison [m.zubrov@gmail.com], 2010
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful (and fun!),
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

require_once ('./includes/jsonRPCClient.php');

function 
randomseed()
{
  list(
$tmp1$tmp2) = explode(' 'microtime());
  return (float) 
$tmp1 + ((float) $tmp2 100000);
}
mt_srand(randomseed());

if (!isset(
$_COOKIE["bitcoinsessionid"])) { $session mt_rand() + (int)(microtime()*1000); } else { $session = (int) $_COOKIE["bitcoinsessionid"]; }
if (!
is_numeric($session)) die ("This looks like an SQL injection attempt.");
setcookie("bitcoinsessionid"$sessiontime()+2592000); //the cookie is valid for 30 days.

$bitcoin = new jsonRPCClient("http://rpcuser:rpcpassword@127.0.0.1:8332/") or die("Cannot connect"); 
$link mysql_connect("mysqlserver""mysqluser""mysqlpass") or die("Could not connect: " mysql_error());
mysql_select_db("bitcoin");

if ((isset(
$_GET["getaddress"])) && (is_numeric($_GET["getaddress"]))) {
// if we are asked for an address
$id $_GET["getaddress"];

$query "SELECT address FROM addresses WHERE id = "$id " AND sessionid = " $session;

$result mysql_query($query) or die("Query failed : " mysql_error());

$row mysql_fetch_array($resultMYSQL_ASSOC); if (isset($row["address"])) { $address $row["address"]; } else {
$address $bitcoin->getnewaddress("Temporary address") or die ("Sorry, cannot create an address");
$query "INSERT INTO addresses (id, address, sessionid) VALUES (" $id ", \"" $address "\"," $session ")";
mysql_query($query) or die("Query failed : " mysql_error()); }

//here we check if someone else didn't already purchase this item
$query "SELECT address FROM addresses WHERE id = "$id " AND sessionid != " $session;
$result mysql_query($query) or die("Query failed : " mysql_error());
$row mysql_fetch_array($resultMYSQL_ASSOC); if (isset($row["address"])) die("Sorry, this item is already being partially or fully paid by someone else."); 

$query "SELECT price FROM goods WHERE id = " $id;
$pricex mysql_query($query);
$row mysql_fetch_array($pricexMYSQL_ASSOC);
$price $row["price"];

$paid = (float)$bitcoin->getreceivedbyaddress($address1);

echo 
"Please send " $price " to BitCoin address " $address " . <br />";
echo 
"Already sent: " $paid "<br />";
echo 
"<a href='?getaddress=" $id "'>Refresh</a>";
if (
$price <= $paid) {
echo 
"Paid fully.<br />";
$result mysql_query("SELECT name, description, price FROM goods WHERE id = " $id) or die("Query failed 0: " mysql_error());
$row mysql_fetch_array($resultMYSQL_ASSOC);
echo 
"Your password is: <b>" $row["password"] . "</b><br /><a href='?delete=" $id "'>Confirm and delete</a><br />"; }
else {
echo 
"You have "$price $paid " left to pay. <br />"; }

else

if ((isset(
$_GET["delete"])) && (is_numeric($_GET["delete"]))) {
$id $_GET["delete"];
$query "SELECT address FROM addresses WHERE id = "$id " AND sessionid = " $session//Only the ones who paid fully can delete items
$result mysql_query($query) or die("Query failed : " mysql_error()); $row mysql_fetch_array($resultMYSQL_ASSOC);
if (isset(
$row["address"])) { $address $row["address"]; } else echo "Sorry, this operation is permitted only to users that purchased the item.";
$query "SELECT price FROM goods WHERE id = " $id;
$pricex mysql_query($query);
$row mysql_fetch_array($pricexMYSQL_ASSOC);
$price $row["price"];
$paid = (float)$bitcoin->getreceivedbyaddress($address1);
if (
$paid >= $price) {
//if this user really purchased it
$query "DELETE FROM goods WHERE id = "$id;
$result mysql_query($query) or die("Cannot delete the item: " mysql_error());
}
}

else if(!isset(
$_GET["show"]) || !is_numeric($_GET["show"])) {
$result mysql_query("SELECT id, name, description, price FROM goods") or die("Query failed 1: " mysql_error()); 
while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
printf ("<a href='bitcoin.php?show=%s'><b>%s</b></a><br />%s<br />Price: <b>%s</b>"$row["id"], $row["name"], $row["description"], $row["price"]); }
} else {
$id $_GET["show"];
$result mysql_query("SELECT name, description, price FROM goods WHERE id = " $id) or die("Query failed 2: " mysql_error());
while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
printf ("<b>%s</b><br />%s<br />Price: <b>%s</b><br /><a href='bitcoin.php?getaddress=%s'>Buy with BitCoin</a>"$row["name"], $row["description"], $row["price"], $id); }

}

mysql_free_result($result);
mysql_close($link);
?>

The system is supposed to be anonymous (so it uses SessionIDs) and probably even secure (since all data sent by user are numeric (ID of an item or SessionID), they are filtered).

It uses two MySQL tables: "goods" and "addresses". The first one contains 5 fields, "id" (int), "name" (varchar), "description" (mediumtext), "price" (double) and "password" (mediumtext, this field contains the information user gets when he pays for an item fully). "addresses" contains of "id" (the ID of an item), "address" (bitcoin address used to receive money for that item) and "sessionid" (SessionID of a user who decides to buy an item).

I know, this code is bad, but 1) it works (it was tested Smiley ), 2) I just don't know where should I use it Smiley
Maybe this will serve as some kind of a tutorial to some bitcoiners wishing to use JSON-RPC and PHP, or anything else, I don't know.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!