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.

utxo

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).

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 system memory.
  • A current balances of any P2PKH, P2SH or P2WPKH address is kept in memory for a quick access.
  • 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% of space. They can also be purged (entirely or partially) from the disk.
  • Up till version 1.6.4 it supported monitoring and fetching balance of stealth addresses (the ones implemented in Dark Wallet)
  • From version 1.9.4 onward, both the wallet and the client, support native segwit addresses (P2WPKH encoded as bech32)

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 (partial) signing of P2SH multisig transactions (the ones that use OP_CHECKMULTISIG opcode).
  • Supports spending to stealth addresses as implemented in Dark Wallet

Node-less mode

It is possible to use Gocoin's wallet, without a need to have a running client node. This may come handy since the node requires quite an advanced hardware and a large amount of time for the initial bootstrap.

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

Requirements

Client

Requires 64-bit platform and at least 8GB 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 which acts like a GUI
  • 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