I think the Raspberry Pi uses the ARM processor. If you manage to get libbitcoin compiled and running on there, I'll happily add you a remove(tx_hash) method.
SQL is too slow when validating the blocks. Loading the entire blockchain into SQL will take a very long time. However there's a ready made schema there for you if you like.
libbitcoin uses a blockchain interface with different backends. As long as you implement the interface, you should be fine. If you're not too worried about validating blocks, then it should be quite easy (a week(end) of work).
I should comment that part. There's lots of comments in the API, but less so in the deeper parts of the internal machinery. I will get around to that.
You need to close the database handle before writing to it from an external context. That's dangerous otherwise. There should be a single environment open with LevelDB, and you don't want other async writes to conflict while you're doing stuff to the DB.
Finding unspent outputs means doing a linear scan through every output and seeing which ones do not have a corresponding spend entry. The comments for what the tables (called databases in LevelDB) do is in leveldb_blockchain.hpp
|
|
|
Yeah you can do that if you rebuild the database. That means creating a new database (see examples/initchain.cpp), then importing the old blocks into the new one. However block headers are only 80 bytes so you should keep those. In Bitcoin, this is what pruning outputs means (libbitcoin by default doesn't do that). I personally believe that disk space is not a big deal (current unmodified chain is 15 Gb). I'm more worried about fetch speed (not writes) and scalability. I had a PostgreSQL database in the beginning (hence the bitcoin.sql file in the repo) but eventually moved to bdb. The postgres backend became unmaintained, the API changed a lot and it fell out of development before I dropped it entirely. SQL is too slow for blockchains. There is a method to delete from the blockchain directly, but I haven't exposed that. It's used for blockchain reorgs. You can use that same code, but make sure you stop the blockchain object before modifying the database. You can then reopen it after: leveldb_blockchain* chain = new leveldb_blockchain(pool); chain->start(dbpath, blockchain_started); // ... do stuff // stop/join threadpools using the blockchain. chain->stop(); delete chain; // open database, delete whatever you want. leveldb_blockchain* chain = new leveldb_blockchain(pool); chain->start(dbpath, blockchain_started); // continue from where you left off...
something like that. see the method called "end_slice" https://github.com/spesmilo/libbitcoin/blob/master/src/blockchain/leveldb/leveldb_chain_keeper.cppIt's deleting a bunch of blocks from the end of the blockchain. Also `bool leveldb_chain_keeper::clear_transaction_data(leveldb_transaction_batch& batch, const transaction_type& remove_tx)' (same file) might interest you too. It's deleting specific transactions from the database.
|
|
|
fullnode example using the python bindings: https://gitorious.org/libbitcoin-bindings/libbitcoin-bindings/blobs/master/tests/fullnode.pyalso if you expose libbitcoin through an RPC interface like Apache Thrift, and publish new confirmed blocks and new validated unconfirmed txs using ZeroMQ, then you get a nice piece of server middleware: https://github.com/genjix/qlayer/tree/master/srcI've made this before in C++: https://github.com/genjix/query but I think it'd better be served being done in Python. Also if you have an bunch of dumb slaves with their own blockchain, and they just synchronise with the master (see https://github.com/genjix/slave ) then it's a really fast way to serve the blockchain to tons of people. Since everything runs in its own process too, it's resilient and stable (parts can go offline and everything still functions). On the front you have a load balancer selecting which slave to distribute requests to. We are porting this to a Python libbitcoin and Twisted (or maybe gevent) architecture. Not sure if we'll stick with Thrift/ZeroMQ. import sys
from bitcoin import threadpool, hosts, handshake, network, protocol, session from bitcoin import leveldb_blockchain, poller, transaction_pool, create_session_params from bitcoin import hash_transaction import time
def print_block(block): time.ctime(block.timestamp), block.merkle.encode('hex')
class fullnode(object): def __init__(self): self._net_pool = threadpool(1) self._disk_pool = threadpool(1) self._mem_pool = threadpool(1) self._hosts = hosts(self._net_pool) self._handshake = handshake(self._net_pool) self._network = network(self._net_pool) self._protocol = protocol(self._net_pool, self._hosts, self._handshake, self._network) self._chain = leveldb_blockchain(self._disk_pool) self._poller = poller(self._mem_pool, self._chain) self._txpool = transaction_pool(self._mem_pool, self._chain) pars = create_session_params(self._handshake, self._protocol, self._chain, self._poller, self._txpool) self._session = session(self._net_pool, pars) print "[fullnode] ok"
def start(self): self._protocol.subscribe_channel(self.monitor_tx) self._chain.start('database', self.on_chain_start) self._chain.subscribe_reorganize(self.on_reorganize) self._txpool.start() self._session.start(self.on_session_start) print "[fullnode.start] ok"
def stop(self): self._session.stop(self.on_session_stop) self._net_pool.stop() self._disk_pool.stop() self._mem_pool.stop() self._net_pool.join() self._disk_pool.join() self._mem_pool.join() self._chain.stop() print "[fullnode.stop] ok"
def on_chain_start(self, ec): print "[fullnode.chain] started", ec
def on_session_stop(self, ec): print "[fullnode.session] stopped", ec
def on_session_start(self, ec): print "[fullnode.session] started", ec if ec: self.stop() sys.exit(1)
def on_reorganize(self, ec, height, arrivals, replaced): print '[fullnode.reorganize]', height, str(ec), len(arrivals), len(replaced) if len(arrivals): print ' arrival', print_block(arrivals[0]) if len(list2): print ' replaced', print_block(arrivals[1]) self._chain.subscribe_reorganize(self.on_reorganize)
def monitor_tx(self, node): print "(fullnode.tx)", node node.subscribe_transaction(lambda ec, tx: self.recv_tx(node, tx, ec)) self._protocol.subscribe_channel(self.monitor_tx)
def handle_confirm(self, ec): print "(fullnode.store) confirm", ec
def recv_tx(self, node, tx, ec): print "(fullnode.recv_tx)", ec, tx if ec: print "error", ec return print ' *', len(tx.inputs), len(tx.outputs) self._txpool.store(tx, self.handle_confirm, lambda _ec, u: self.new_unconfirm_valid_tx(node, tx, u, _ec)) node.subscribe_transaction(lambda _ec, _tx: self.recv_tx(node, _tx, _ec))
def new_unconfirm_valid_tx(self, node, tx, unconfirmed, ec): print "(fullnode.valid_tx)", ec, tx, unconfirmed tx_hash = hash_transaction(tx) if ec: print "Error", ec else: print "Accepted transaction" print unconfirmed.__class__ if not unconfirmed.empty(): print "Unconfirmed" for idx in unconfirmed: print ' ', idx print tx_hash
if __name__ == '__main__': app = fullnode() app.start() raw_input() app.stop()
|
|
|
Yes it can.
You create a transaction as you would with an output sending to a script hash address. You broadcast it to the network. To verify it was sent, you might listen to see if nodes respond back with an inventory and if not resend the transaction within a certain time. Then to release the funds, you'd all need to sign a transaction according to its rules.
|
|
|
Correct. Also you need to run: $ ./initchain database/ to initialize the blockchain. Also if you want to full blockchain then it's available at: http://46.4.92.107/database.tar.bz2
|
|
|
He thinks he can do more good for the world by staying in the party. Maybe he has too much to lose and is willing to compromise over that.
|
|
|
This post is by Donald. This whole thing caused him a lot of stress and paranoia.
|
|
|
Squatting is not illegal in the UK. Squatting commercial properties is fine. It's the police that are breaking the law. I've seen them do it many times against other people with no recourse against them. And no, I won't stop talking about Bitcoin or my views to anyone who asks. Otherwise Bitcoin will become co-opted. The personal computer revolution of the 70s was hijacked in a similar way. The people who built the early technology failed to speak up, and the movement became co-opted by corporations. I could maybe buy the argument we should play it safe when Bitcoin was small, but not anymore. Everyone knows it exists. The highest echelons of government are inviting us to give presentations about Bitcoin to them (see http://www.ft.com/cms/s/2/42ca6762-bbfc-11e2-82df-00144feab7de.html#axzz2TGGzzaez ). Now is the time to push our message loudly. Bitcoin is a revolution in finance that undermines the whole industry. We are not aiming to make banking more efficient - we want to get rid of them. If you want to lie or say anything opposite then you are already co-opted and working against Bitcoin. Don't end the FED, bypass the FED. Real change comes from bottom up. If you're trying to convince people, then you won't do that by dressing the same as every other banker on TV and saying Bitcoin is this new safe payments option. You have to be true to yourself. To speak with passion about things you feel, and tell people how it actually is. I don't buy this talk of hiding your true thoughts and feelings. Maybe you lose some votes, but you also gain the trust of the true people out there who are able to see you are a real person speaking truth, not a diplomat in a suit. I get emails from people reaching out to me from the darkness, and thanking me for my appearances. People see I'm carrying a message from the heart. When I met Birgitta Jonsdottir (Icelandic politician), she was totally messy with torn clothes. I asked her doesn't she need to put on a show and dress nicely to win votes. She told me that's absolute rubbish. Real support is created by being open as a person, and not hiding who you are. And she has strong support globally because she's such a cool person that people trust her. She talks about things personal to herself. It comes from her heart. That's my aim with unSYSTEM: http://unsystem.net - I want to make a conference which shows Bitcoin as cultural movement. Not a conference which is giving facts and info, but something which people feel and intuitively understand. Nothing will slow Bitcoin's adoption now. It will grow regardless of what people say. The technology is so strong that it will win out by itself. If not Bitcoin, then another cryptocurrency. The idea is here to stay. What is dangerous is how it will grow. If Bitcoin grows completely in white market, becomes totally regulated and everything then we lose any power that we gained with Bitcoin. We have to stress and force its growth in the right direction otherwise the movement will become hijacked and amount to nothing useful whatsoever. You know sometimes I go to these hackerspaces, and I see people working with technology, electronics, programming, industry, ... and I see powerful guys which can topple states or delete entire industries. Instead they waste their skill making pointless toys like moving cat ears. I want nothing to do with them. They are a waste of space and total zombies. You have such a big power and then use it to make toys instead of tools for people. The reason we have the internet now, and the reason it's so great is because the guys who made the internet imbued it with their ethics and morals. The internet could've turned out very differently. Instead we have an amazing world-changing tool for humanity. We have co-opted mercenary programmers making proprietary crap that goes into a corporate blackholes. They rationalise destruction of the world as saying they need to pay bills to look after their kids and wife. And loads of zombies do the same helping empower states and overly powerful corporations to oppress people. They're idiots, and if you have this amazing skill then you should be carrying the torch of the same scientists and technologists before you who created all this wealth for everyone. What are you doing with your life otherwise? Making money and getting along? Come on. Waste of space. http://en.wikipedia.org/wiki/Community_Memory
|
|
|
Lots of new things coming. I'm at a basic milestone where I'm content with the overall internal architecture of the library now. https://github.com/spesmilo/libbitcoin/commits/masterNext steps is Python bindings, and a blockchain query API. The Python bindings were done before but were experimental. We had some issues with asynchronous calls and the GIL. I'm thinking to simply turn all async calls into sync blocking ones for Python anyway (keep it simple). The query layer is something really nice: https://github.com/genjix/query-layer(see the tutorial.py) You can move around and examine it using logical Python constructs. I want to expand upon this and also give access to new blocks and verified transactions in the memory pool. Then create an Electrum server protocol implementation chained to this. Also subvertx (command line tools for Bitcoin using libbitcoin) is a bit out of date and not actively developed. I would like to take that to something serious too but it needs time (if someone wants to volunteer, this is a cool project) to firstly create how the tools should look and then implement them. I can help someone with that if they know C++. https://github.com/genjix/subvertxhttps://bitcointalk.org/index.php?topic=50721.0Finally I'm working on an Android wallet. It's not using libbitcoin currently, but eventually that will be needed in the future. There's some other various small tools I've made too. One is a fast-monitor tool which sits in the Bitcoin network and looks at transaction outputs in new blocks and unconfirmed transactions for an address so it can tell a website of a new deposit. The tool doesn't validate the new blocks or transactions and is only meant to be a lightweight thing. I don't see it having too many uses except where a website has TONS of Bitcoin addresses and can't afford to poll the balance for all of them or something.
|
|
|
BTW, I understand what some of you are going through. My father is nearly 70, and just lost all his money to property investments that never got built. The person responsible took lots of money from many people and ran away. He has nothing left anymore and cannot pay his mortgage on his home. He worked hard his whole life, and now is bust at an age where he cannot work. Now he wants to run off to a small remaining plot of land he has in Iran in some village and live out the rest of his days. He never had a boss and installed a hard work ethic in me and honest morals. We hadn't been speaking for many years before this because he never understood what I was about (why I preferred to write opensource for free instead of make money and get a degree).
|
|
|
My explanation is to read my full post instead of taking snippets out of context.
|
|
|
|