Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - alt

Pages: 1 ... 6 7 8 9 10 11 12 [13] 14 15 16
181
Stakeholder Proposals / b solution for hot standby(From BitSuperLab)
« on: July 30, 2014, 05:53:35 am »
here is another solution for hot standby, detected with a heartbeat signal.

master and slave exchange  some data in real time, include: blockchain_head_block_num, network_num_connections.
they'll change block production flag automatic, depend on  a rule to select which one should active.

we use a pusher service from PubNub to exchange data, this can avoid open a public service, and can still run behind a tor net.

so you need to register a free account in PubNub if you decide to use this. the demo account maybe not stable.
here is the command
Code: [Select]
./heartbeat.py master  # run on master side
./heartbeat.py slave  # run on slave side
here is the source code heartbeat.py,  you need to install pubnub first
Code: [Select]
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8

## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 Stephen Blum
## http://www.pubnub.com/

#### required:
#### aptitude install python-pip
#### pip install pubnub==3.5.2

import requests
import json
import os

from pprint import pprint

import sys
from Pubnub import Pubnub
import datetime, threading, time

node_type = len(sys.argv) > 1 and sys.argv[1] or 'master'
if node_type == 'master':
    node_type_other = 'slave'
else:
    node_type =  'slave'
    node_type_other = 'master'

print "node typ is " + node_type

config_data = open('config.json')
config = json.load(config_data)
config_data.close()
node_state = {'master':{'connect_num':100,'block_num':100000000}, 'slave':{'connect_num':0,'block_num':0}}

#pprint(config)

## -----------------------------------------------------------------------
## function about bts rpc
## -----------------------------------------------------------------------
auth = (config["bts_rpc"]["username"], config["bts_rpc"]["password"])
url = config["bts_rpc"]["url"]

def get_state():
    global node_state
    headers = {'content-type': 'application/json'}
    info = {
        "method": "get_info",
        "params": [],
        "jsonrpc": "2.0",
        "id": 1
        }
    info_res = requests.post(url, data=json.dumps(info), headers=headers, auth=auth)
    info_json = json.loads(vars(info_res)["_content"])
    node_state[node_type]["block_num"]  = info_json["result"]["blockchain_head_block_num"]
    node_state[node_type]["connect_num"]  = info_json["result"]["network_num_connections"]
    node_state[node_type]["wallet_next_block_production_timestamp"] = info_json["result"]["wallet_next_block_production_timestamp"]

def is_active():
    global node_state
    return node_state[node_type]["wallet_next_block_production_timestamp"] != None

# unlock the delegate first in nodes
def set_delegate_production(enable):
    if is_active() == enable:
        return
    headers = {'content-type': 'application/json'}
    set_delegate = {
        "method": "wallet_delegate_set_block_production",
        "params": ["ALL", enable],
        "jsonrpc": "2.0",
        "id": 1
        }

    set_res = requests.post(url, data=json.dumps(set_delegate), headers=headers, auth=auth)
    set_json = json.loads(vars(set_res)["_content"])
    print 'set_delegate_production', enable, 'result:',set_json
def switch_active(type):
    #print "switch active to", type
    if node_type ==  type:
        set_delegate_production(True)
    else:
        set_delegate_production(False)

def select_active():
    # TODO check the next bock production timestamp of antoher node, require enough time (at least 2 min) for switch
    if node_state["master"]["connect_num"] < 20 and node_state["slave"]["connect_num"] > 22:
        switch_active("slave")
    elif node_state["master"]["block_num"] + 2 < node_state["slave"]["block_num"]:
        switch_active("slave")
    else:
        switch_active("master")



## -----------------------------------------------------------------------
## function about pubnub
## -----------------------------------------------------------------------
# Asynchronous usage
def callback(message, channel):
    global node_state
    node_state[node_type_other] = message
    print datetime.datetime.now(), 'receive', node_state[node_type_other]

def error(message):
    print("ERROR : " + str(message))

def state_publish():
    global node_state
    global next_call
    get_state()
    print datetime.datetime.now(), 'publish', node_state[node_type]
    pubnub.publish(node_type, node_state[node_type])
    select_active()
    next_call = next_call + 10
    threading.Timer( next_call - time.time(), state_publish).start()

## -----------------------------------------------------------------------
## Initiate Pubnub State
## -----------------------------------------------------------------------
publish_key = config["pubnub_auth"]["publish_key"]
subscribe_key = config["pubnub_auth"]["subscribe_key"]
secret_key = config["pubnub_auth"]["secret_key"]
cipher_key = config["pubnub_auth"]["cipher_key"]
ssl_on = False
pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key,
    secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)

pubnub.subscribe(node_type_other, callback=callback, error=error)

next_call = (int (time.time() / 10)) * 10 + 5
state_publish()

here is the config file: config.json
Code: [Select]
{
  "pubnub_auth": {
    "_comment": "demo is for test, you should register from https://admin.pubnub.com, and set this key to yourself",
    "publish_key" : "demo",
    "subscribe_key" : "demo",
    "secret_key" : "demo",
    "cipher_key" : ""
  },
  "bts_rpc": {
    "url": "http://localhost:9989/rpc",
    "username": "user",
    "password": "pass"
  }
}

182
中文 (Chinese) / Delegate双机热备方案1(BitSuperLab 出品)
« on: July 30, 2014, 05:39:54 am »
hi, delegates. we have a solution for hot standby.

set up delegate wallet in 2 machines. one is master, and the other is slave.
master run  delegate_loop task at seconds 0,10,20 ....
slave run the task with 5 seconds delay, at 5, 15, 25 .....
Normally master will generate block in time, slave will receive the block less than 5 seconds, than slave will not generate block.
If for some reason, master missed generation, slave didn't receive block from master in 5 seconds, slave will generate.

here is the patch for slave program:
Code: [Select]
--- a/libraries/client/client.cpp
+++ b/libraries/client/client.cpp
@@ -729,6 +729,7 @@ config load_config( const fc::path& datadir )
 
           uint32_t slot_number = blockchain::get_slot_number( now );
           time_point_sec next_slot_time = blockchain::get_slot_start_time( slot_number + 1 );
+          next_slot_time += 5;
           ilog( "Rescheduling delegate loop for time: ${t}", ("t",next_slot_time) );
 
           time_point scheduled_time = next_slot_time;

183
Stakeholder Proposals / a solution for hot standby(From BitSuperLab)
« on: July 30, 2014, 05:33:00 am »
hi, delegates. we have a solution for hot standby.

set up delegate wallet in 2 machines. one is master, and the other is slave.
master run  delegate_loop task at seconds 0,10,20 ....
slave run the task with 5 seconds delay, at 5, 15, 25 .....
Normally master will generate block in time, slave will receive the block less than 5 seconds, than slave will not generate block.
If for some reason, master missed generation, slave didn't receive block from master in 5 seconds, slave will generate.

here is the patch for slave program:
Code: [Select]
--- a/libraries/client/client.cpp
+++ b/libraries/client/client.cpp
@@ -729,6 +729,7 @@ config load_config( const fc::path& datadir )
 
           uint32_t slot_number = blockchain::get_slot_number( now );
           time_point_sec next_slot_time = blockchain::get_slot_start_time( slot_number + 1 );
+          next_slot_time += 5;
           ilog( "Rescheduling delegate loop for time: ${t}", ("t",next_slot_time) );
 
           time_point scheduled_time = next_slot_time;

184
中文 (Chinese) / delegate 自动重启钱包 [BitSuperLab 出品]
« on: July 29, 2014, 01:26:47 am »
for now, delegate will miss blocks after long time running.
BM suggest to restart client every day.
here is a method for automatic restart.
1. run wallet with this expect script, you should change "wallet_name" and "command line"
this script will start client automatic while it's quit.
......

目前delegate长时间运行会大量丢块,BM建议每天重启一次钱包,所以我们提供了这个自动重启的方案。
接下去我们会把漏块检测和自动重启工具结合起来,提供更强大的自修复能力。

185
Stakeholder Proposals / automatic restart tools (From BitSuperLab)
« on: July 29, 2014, 01:20:30 am »
for now, delegate will miss blocks after long time running.
BM suggest to restart client every day.
here is a method for automatic restart.
1. run wallet with this expect script, you should change "wallet_name" and "command line"
this script will start client automatic while it's quit.
Code: [Select]
#!/usr/bin/expect -f

set timeout -1
set default_port 1776
set port $default_port

### change wallet_name here
set wallet_name "delegate"
send_user "wallet name is: $wallet_name\n"
send_user "wallet passphrase: "
stty -echo
expect_user -re "(.*)\n"
  stty echo
set wallet_pass $expect_out(1,string)

  proc run_wallet {} {
    global wallet_name wallet_pass default_port port
      ### change command line here
      spawn ./bitshares_client --data-dir=delegate --p2p-port $port --server --httpport 9989 --rpcuser user --rpcpassword pass

      expect -exact "(wallet closed) >>> "
      send -- "about\r"
      expect -exact "(wallet closed) >>> "
      send -- "wallet_open $wallet_name\r"
      expect -exact "$wallet_name (locked) >>> "
      send -- "wallet_unlock 99999999\r"
      expect -exact "passphrase: "
      send -- "$wallet_pass\r"
      expect -exact "$wallet_name (unlocked) >>> "
      send -- "wallet_delegate_set_block_production ALL true\r"
      expect -exact "$wallet_name (unlocked) >>> "
      send -- "info\r"
      expect -exact "$wallet_name (unlocked) >>> "
      send -- "wallet_list_my_accounts\r"
      interact
      wait

      if { $port == $default_port } {
        set port [expr $port+1]
      } else {
        set port [expr $port-1]
      }
  }

while true {
  run_wallet
}
2. kill the client every 24 hours.
call restart.py every 24 hours at crontab, this script will check next block generation timestamp, make sure there is enough time to restart client
Code: [Select]
#!/usr/bin/python

import requests
import json
import time
import os

safetime = 120  # safe time, 120 seconds is safe to restart client
auth = ('user', 'pass') ## user/pass for rpc service
url = "http://localhost:9989/rpc"  ## rpc url

def main() :
    headers = {'content-type': 'application/json'}
    info = {
        "method": "get_info",
        "params": [],
        "jsonrpc": "2.0",
        "id": 1
    }

    while True:
        info_res = requests.post(url, data=json.dumps(info), headers=headers, auth=auth)
        info_json = json.loads(vars(info_res)["_content"])
        if not "result" in info_json:
            return
        block_production_timestamp = info_json["result"]["wallet_next_block_production_timestamp"]
        safe_timestamp = time.strftime("%Y%m%dT%H%M%S", time.localtime(time.time()+safetime))
        if block_production_timestamp > safe_timestamp :
            break;
        #print("wait...")
        time.sleep(10)
    #print("kill...")
    time.sleep(10) ## wait 10 second make sure it's broadcast out
    os.system("killall -9 bitshares_client");

if __name__ == "__main__":
    main()
3. we'll provide more suitable tools to detect the missing block and restart automatic soon.

186
中文 (Chinese) / 提供丢块提醒服务[BitSuperLab 出品]
« on: July 28, 2014, 09:18:40 am »
HI, delegates

we'll provide a service for missing blocks notify.
post the delegate account and  email address here, we'll send you an email ASAP when you missed a block. :)
请在 Delegate 讨论区回复原帖,留下EMAIL和帐号
当您丢块后会在最短时间内收到我们的邮件提醒服务  :)

187
Stakeholder Proposals / missing blocks notify(From BitSuperLab)
« on: July 28, 2014, 09:06:30 am »
HI, delegates

we'll provide a service for missing blocks notify.
post the delegate account and  email address here, we'll send you an email ASAP when you missed a block. :)

BTW, donation account is "bitsuperlab", thx   :D

Please vote for our delegate "delegate.bitsuperlab", the origin "bitsuperlab" are going to retire after the sub account get voted in.

188
General Discussion / connect hang up again
« on: July 22, 2014, 02:43:44 pm »
sometimes the client just refuse to accept the connect from p2p network.
the connect number will drop to 0.
I have post at here: https://bitsharestalk.org/index.php?topic=5523.msg75899#msg75899
today I meet this again. all new connect request can't be service, the state  is always SYN_RECV.
Code: [Select]
tcp        0      0 106.185.26.162:1982     71.202.130.94:65418     SYN_RECV    -               
tcp        0      0 106.185.26.162:1982     84.227.113.44:50339     SYN_RECV    -               
tcp        0      0 106.185.26.162:1982     54.77.78.162:1776       SYN_RECV    -               
....
tcp       33      0 106.185.26.162:1982     123.6.148.246:51793     ESTABLISHED -               
I still keep the progress for now. here is some message from gdb.
let me know if you want more information.
Code: [Select]
(gdb) info threads
  Id   Target Id         Frame
  12   Thread 0x7f134ca32700 (LWP 10124) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  11   Thread 0x7f1347b93700 (LWP 10125) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  10   Thread 0x7f1347392700 (LWP 10126) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  9    Thread 0x7f1346b91700 (LWP 10127) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  8    Thread 0x7f1346042700 (LWP 10128) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  7    Thread 0x7f1344f20700 (LWP 10129) "bitshares_clien" 0x00007f134cd579a3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
  6    Thread 0x7f132ffff700 (LWP 10130) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  5    Thread 0x7f132f7fe700 (LWP 10131) "bitshares_clien" pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
  4    Thread 0x7f132effd700 (LWP 10132) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7f132e7fc700 (LWP 10157) "bitshares_clien" 0x00007f134dc5d3bd in read () at ../sysdeps/unix/syscall-template.S:81
  2    Thread 0x7f131ffff700 (LWP 10394) "bitshares_clien" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 1    Thread 0x7f134e686780 (LWP 10120) "bitshares_clien" pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
(gdb) thread 7
[Switching to thread 7 (Thread 0x7f1344f20700 (LWP 10129))]
#0  0x00007f134cd579a3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007f134cd579a3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
#1  0x000000000068abf5 in boost::asio::detail::epoll_reactor::run (this=0x2416ee0, block=<optimized out>, ops=...)
    at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:392
#2  0x000000000068b2dd in boost::asio::detail::task_io_service::do_run_one (this=this@entry=0x264c9a0, lock=..., this_thread=..., ec=...)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:368
#3  0x000000000068c621 in boost::asio::detail::task_io_service::run (this=0x264c9a0, ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:153
#4  0x000000000068c7ab in run (this=0x25f1000) at /usr/include/boost/asio/impl/io_service.ipp:59
#5  operator() (__closure=<optimized out>) at /home/alt/workspace/bitsharesx/libraries/fc/src/asio.cpp:102
#6  boost::detail::thread_data<fc::asio::default_io_service_scope::default_io_service_scope()::{lambda()#1}>::run() (this=<optimized out>)
    at /usr/include/boost/thread/detail/thread.hpp:117
#7  0x0000000000c7c4ba in thread_proxy ()
#8  0x00007f134dc56182 in start_thread (arg=0x7f1344f20700) at pthread_create.c:312
#9  0x00007f134cd5730d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) thread 3
[Switching to thread 3 (Thread 0x7f132e7fc700 (LWP 10157))]
#0  0x00007f134dc5d3bd in read () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007f134dc5d3bd in read () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f134e25aa7d in rl_getc () from /lib/x86_64-linux-gnu/libreadline.so.6
#2  0x00000000006ad80c in operator() (__closure=<optimized out>) at /home/alt/workspace/bitsharesx/libraries/cli/cli.cpp:1409
#3  fc::detail::functor_run<bts::cli::detail::get_character(FILE*)::__lambda5>::run(void *, void *) (functor=<optimized out>, prom=0x483f920)
    at /home/alt/workspace/bitsharesx/libraries/fc/include/fc/thread/task.hpp:48
#4  0x0000000000643cd3 in fc::task_base::run_impl (this=this@entry=0x483f870) at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/task.cpp:39
#5  0x0000000000644385 in fc::task_base::run (this=this@entry=0x483f870) at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/task.cpp:29
#6  0x000000000064253b in run_next_task (this=0x7f13180008c0) at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/thread_d.hpp:372
#7  fc::thread_d::process_tasks (this=0x7f13180008c0) at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/thread_d.hpp:395
#8  0x000000000063dd44 in fc::thread::exec (this=0x2677cb0) at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/thread.cpp:201
#9  0x000000000063e11c in fc::thread::thread(std::string const&)::{lambda()#1}::operator()() const ()
    at /home/alt/workspace/bitsharesx/libraries/fc/src/thread/thread.cpp:81
#10 0x0000000000c7c4ba in thread_proxy ()
#11 0x00007f134dc56182 in start_thread (arg=0x7f132e7fc700) at pthread_create.c:312
#12 0x00007f134cd5730d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

189
General Discussion / log message for missed block: not call on time
« on: July 22, 2014, 01:01:39 am »
hide

190
General Discussion / why the delegate always missed block?
« on: July 20, 2014, 11:41:50 pm »
delgate-alt always missed block, the  reliability  is only  59.49%.
I have see the debug message, every time when  I missed block, the rebraodcast_pending was called with a high latency.

not missed, block 15080
Code: [Select]
   20140720T231440.007245       th_a   apply_transactions ] Applying transactions from block: 15080      chain_database.cpp:962
  20140720T231440.007312       th_a      execute_markets ] execute markets []     chain_database.cpp:1182
  20140720T231441.788079       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857
  20140720T231441.788197       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857

missed, block 14971
Code: [Select]
   20140720T225620.008000       th_a   apply_transactions ] Applying transactions from block: 14971      chain_database.cpp:962
  20140720T225620.008105       th_a      execute_markets ] execute markets []     chain_database.cpp:1182
  20140720T225629.770625       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857
  20140720T225629.770730       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857

not missed, block 14888
Code: [Select]
  20140720T224220.008251       th_a   apply_transactions ] Applying transactions from block: 14888      chain_database.cpp:962
  20140720T224220.008319       th_a      execute_markets ] execute markets []     chain_database.cpp:1182
  20140720T224224.754508       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857
  20140720T224224.754577       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857
missed, block  14649
Code: [Select]
  20140720T220210.011105       th_a   apply_transactions ] Applying transactions from block: 14649      chain_database.cpp:962
  20140720T220210.012315       th_a      execute_markets ] execute markets []     chain_database.cpp:1182
  20140720T220210.012778       th_a store_balance_record ] balance record: {"balance":16394400,"condition":{"asset_id":0,"delegate_slate_id":5360468550988535606,"type":  "withdraw_signature_type","data":{"owner":"BTSXDAKNtbVobxaYtLTu4QqdKLsgh2dQA2F5P","memo":{"one_time_key":"B  20140720T220210.011105       th_a   apply_transactions ] Applying transactions from block: 14649      chain_database.cpp:962
TSX5pP2PcD7or578RUGu752Dgrh3TPnfawpFV2TBcQo5wFWmG9TGD","enc  rypted_memo_data":"53b5be02a0adc07bf331e2a7f5b2a7ad53aa16d88ba6b00be555b1a42b369131db17d2c3cff05118e212047f79cff39f25b60ba274e2aa535ded27d9542e1a2b"}}},"genesis_info"  :null,"last_update":"20140720T220  20140720T220210.012315       th_a      execute_markets ] execute markets []     chain_database.cpp:1182
200"}      chain_database.cpp:1816
  20140720T220219.703103       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857
  20140720T220219.703280       th_a  rebroadcast_pending ] rebroadcasting...      client.cpp:857

191
General Discussion / please vote delegate-alt
« on: July 20, 2014, 02:00:08 am »
I will try my best to guard the blockchain security.
vote for me please  :)
Thank you

192
中文 (Chinese) / 我给一个稳妥方案
« on: July 17, 2014, 02:52:11 pm »
现在的问题是抵押发行资产时,价格可以随意定,我可以抵押1XTS,发行1亿bitUSD,在精心设计的攻击下,可以让这个挂单成交获取很多bitUSD.
以下是我的修改
1. 首先对每个block,我们可以获取这个block内所有交易中,bitUSD 卖单的最高成交价。可以认为如果按这个价格抵押XTS发行USD,能把USD发行数量限制在安全值内。
2. 为进一步保证安全,可以扫描每个块的bitUSD最高成交价,按最近360个价格取最高值。对初始状态,没有360个块,可以设定一个安全的初始值,比如0.2USD/XTS。到此可以强制规定一个安全的资产发行价。
3. 现在举实例,假设按以上逻辑算出来的发行价为 0.2 USD/XTS
  1) 我要拿出20 XTS,按0.18 USD/XTS价格发行,这个价格小于 0.2,所以强制按 0.2USD/XTS发行,加上双倍抵押,只能创造 20 *(0.2/2) = 2 USD。这2个USD直接就创造出来,属于我了。同时按 0.18USD/XTS 挂 USD 卖单。
  2) 如果我设定按 0.22 USD/XTS 发行,这个价格本身就大于 0.2,是安全的,就直接按这个 0.22 的价格创造 USD,并挂USD卖单。

193
中文 (Chinese) / 想过重回中心化的BTS吗?
« on: July 07, 2014, 12:35:00 am »
拿支付宝举例,底层如果使用中心化的BTS toolchain会有怎样的结果?重回中心化需要做以下修改:
1. delegate 帐号不需要选举,可以固定下来,其网络地址也是明确指定的。
2. 底层P2P网络全部去掉,改为C/S结构,交易数据直接由 delegate 服务器提供。

重回中心化服务的优势很明确,就是效率的提高。阿里巴巴要做的话,提供 10000 tps 应该是不在话下,确认速度也就是1s吧
他跟传统的中心化服务有何区别?
1. 账户使用的个人私钥认证,不由中心节点控制。
2. 所有交易数据使用私钥加密,中心节点无法获取用户隐私。
3. 所有数据仍然是全网公开共享,大家信息对等

中心节点唯一能做的是双重支付,但此时的双重支付相当于服务商光天化日下抢钱,被双重支付欺骗的用户手上是有服务商的私钥签名证据的。
服务商的利润很单纯,赚手续费。

在追求去中心化的同时,这样的模式是否能异军突起?有创业意愿的同志们可以考虑一下。

194
When I register my ID  at btsx, I still need to register at loto, dns, or other dac.
do we need to merge the id chain? In my view, this should have be done with keyhotee.

195
中文 (Chinese) / 提高交易效率的方案
« on: July 02, 2014, 05:12:08 am »
现在测试网络DRYRUN7的两个主要指标:15秒出块,交易频率限制为 2trx/s。
我认为BTS XT第一次发布如果有这样的性能已经很好了,应对半年内的应用应该是没问题的。

为了应对以后大规模的交易应用,以下是我认为可行的改进方案:
1. 每个代理出块数及频率都改为动态自适应的。
1.1 首先确定本轮101个代理工作顺序,每个代理分配1分钟的可支配时钟片。
1.2 这里引进一个定义: heartbeat 心跳数据。每个代理在开始工作时广播心跳开始信号,结束时广播心跳结束信号(包含本轮自己生产了多少个块)。所有代理的心跳数据建立了代理协同工作的同步机制。因为心跳数据包很小,估计能保证 3s 的延时。
1.3 当前代理接收到上一个代理的心跳结束信号后,先发送心跳开始信号,等待接收完所有数据块后就可生产区块。这里等待心跳结束信号或者等待区块数据包到达都有超时机制,可设为 15s。
1.4 当前代理生产区块的频率不固定,满50个交易,或者1分钟时间到了就可以产生区块。当交易量很大时,每1秒钟就生成一个区块都有可能。
1.5 在结束本轮工作时广播一个心跳结束信号。
1.6 如果一个交易都没有就不要生产区块了,直接发送心跳结束信号
1.7 下一个代理开始工作

这个方案是我认为比较高效的协同工作机制。其性能会受到网络带宽、CPU等限制。以带宽来算,假设是10M网络,可稳定传输100K/秒的数据,一个交易250个字节,大概的处理能力是 400trx/秒。确认时间为 1秒 ~ 1分钟。

2. 这个性能还不足以和VISA竞争,为此要引入并行生产的方式,在每一个时刻能有多个代理同时工作。为了不因此增加协同工作的复杂性,需要严格分区,明确每个代理负责的区域。
一个简单的规则,比如分为100个块,按交易的HASH值除以100的余数分区域。这样能并行出块。这样处理能力就到40000trx/秒了。 :D

以上是个人理解,不知道是否准确

Pages: 1 ... 6 7 8 9 10 11 12 [13] 14 15 16