Gocoin

From Bitcoin Wiki
Jump to navigation Jump to search

An open-source Bitcoin solution written in Go language (golang). It can be built for every platform that has a working Go compiler. It uses a proprietary license, though is free to use for non-commercial purposes.

Architecture

Gocoin's architecture is quite different from the reference implementation (of the Satoshi client).

Libraries

btc / chain / script

The core of the software is a library that essentially provides the blockchain protocol parser. That includes script parsing, ECDSA signature verification, but also things like address encoding, parsing of canonical signatures or extracting hashes that need to be signed for specific inputs of a given transaction.

It is a relatively big library, that contains many useful bitcoin function.

Inside the package, there is also a blocks persistent storage database (blockdb.go) - it is just a simple plain storage (that can only grow), with an index. It uses snappy compression, allowing to save about 30% of the disk space.

qdb

The core library interfaces directly with a UTXO database backed. For this purpose Gocoin uses its own database engine, that has been designed to deal with the specific characteristics of bitcoin's UTXO database.

secp256k1

To speed up the Elliptic Curve operations the secp256k1 library by sipa has been ported to Go.

Online client

The online client is a kind of a server software (or a peer-to-peer node) that is meant to be running all the time.

It handles the network related communication, feeds the core lib with new incoming blockchain data, monitors balances on the wallets' addresses, manages transaction memory pool and the peers database. It also provides an interactive user interface.

Offline wallet

The wallet application is responsible for creating private keys (from a seed password) and for signing transactions with them. It can also sign text messages with private keys and decode raw transactions.

Unlike the client, the wallet is not an app that is meant te be running continuously. A user runs it with the requested task - the wallet does the job and exits (back to the command prompt).

Blockchain downloader

For optimized initial blockchain download, Gocoin has a dedicated application called downloader.

Among other optimizations, the downloader allows a user to skip verification of all the blocks up to a certain one that he defines as trusted. This can speed up the bootstrap process significantly (e.g. from days to hours).

After it finishes downloading of all the blocks, it will exit automatically. In that moment the client should be started and it will keep up with all the new blocks, that will appear in the network.

Other tools

There is also a set of more and less useful tools (github.com/piotrnar/gocoin/tools) that are an integral part of the Gocoin bitcoin software.

For instance btcversig can verify a validity of a bitcoin signature - it is the substitute of the reference client's verifymessage RPC-API.

The tool type2determ can, at the other hand, calculate Type-2 deterministic addresses, without a need to access the wallet (the private keys).


Features

Gocoin has a several unique features, that distinguish it from the original bitcoin client.

Node / Client

  • All the unspent outputs are kept in memory, which makes switching between different wallets, as well as checking a balance of any address, relatively fast (few seconds max).
  • Allows a user to limit the upload and download network bandwidth used by the client.
  • Can be monitored and controlled through a web interface (from a web browser).
  • Works with its own implementation of a cold storage wallet.
  • Web interface allows a user to create raw transactions from specific inputs (Coin Control), as well as multisig transactions (P2SH)
  • The blocks are stored on the disk in a compressed form (using snappy compression) which saves 20-30% of space.
  • Supports monitoring and fetching balance of own stealth addresses (the ones implemented in Dark Wallet)

Wallet

  • For security reasons, it is supposed to be used with a PC that has never been (and will never be) connected to a network.
  • The wallet is deterministic and a seed-password based. As long as you can remember the password, there is no need for any backups.
  • Additionally it can import private keys from an existing bitcoin wallet (must be in Base 58 Wallet Import format format).
  • Has very low hardware requirements. Can be run on i.e. Raspberry Pi
  • Can generate Type-2 deterministic keys/addresses
  • Supports signing of P2SH multisig transactions (the ones that use OP_CHECKMULTISIG opcode).
  • Supports spending to stealth addresses as implemented in Dark Wallet
  • Supports Litecoin

Node-less mode

It is possible to use Gocoin's wallet, without a need to have a running client node, which may come handy since the node requires quite a decent hardware and the block chain takes a lot of time for the initial download.

In such a case the required balance files are fetched with a tool called balio, from a popular block explorer blockr.io

Note: using this tool you will not be able to monitor balance on your stealth addresses.

Requirements

Client

Requires 64-bit platform and at least 4GB of system memory.

The file system that stores the blockchain data must be able to handle files larger than 4GB.

Wallet

The wallet app has very little hardware requirements. As long as you can build it for a specific architecture, it should work there.

Gocoin wallet has been even used on Raspberry Pi model A.

For security reasons it is strongly recommended to run the wallet on an encrypted file system, with an encrypted swap file.

Limitations

  • No GUI, though the online node has web interface
  • No RPC API
  • No IPv6
  • No UPnP
  • No support for non-confirmed transactions (they are invisible in the balance)
  • No support for bloom filters protocol (BIP 0037) and the mempool command
  • No routing of alert messages
  • No support for multisig stealth addresses (yet)

History

Gocoin was written by a single person for a private purposes.

The software's first public release was announced in May 2013 on Bitcointalk forum.[1] Ever since then, the software has been actively maintained and further developed, being armed with new features, further optimized and cleaned up from issues.

It happened twice that the client wasn't able to catch up with the blockchain, because of the implementation difference of the chain parsing protocol that was causing it to reject a block (transaction) that the reference implementation would accept. In both cases the issue was fixed within single days. The fist case happened in July 2013 and the fix was introduced in version 0.5.7. The second time was in March 2014 - the fix came with release 0.9.3.

External Links

References