Pages:
Author

Topic: Exploring alternative full node implementations - Gocoin - page 2. (Read 399 times)

legendary
Activity: 2842
Merit: 7333
Crypto Swap Exchange
Intro

Inspired by tiltedIceCream reply[1] on thread "Why aren't alternative implementations encouraged?"[2], i'm inspirited to try alternative Bitcoin full node implementation. Based on Jameson Lopp benchmark[3], Gocoin seems to have good performance so i decide to give a try.

Basic info

  • It's written in Go language (golang).
  • It's solely developed by piotr_n[4].
  • It has both full node and wallet functionally.
  • It's developed since 2013[5].
  • Gocoin load all UTXO to RAM.

My system

  • Debian-based OS
  • Old 6 core CPU
  • 32GB RAM
  • 3.5" HDD (Both Bitcoin Core and Gocoin data stored here)
  • Bitcoin Core 23.0
  • Gocoin 1.10.1

Compile and installation

The documentation[6] only mention i need git and golang on my system. Since it doesn't mention required golang version, i just use golang provided my distro. I receive golang 1.18.1 which is only slightly older than newest version (1.18.4[7]).

Code:
sudo apt update && sudo apt install golang-go
go version

When i read tweak page[8], Gocoin also support using external secp256k1 library from Bitcoin Core. So i decide to install secp256k1 on my system and clone Gocoin 1.10.1.

Code:
sudo apt-get install gcc automake autoconf libtool make git libgmp-dev
git clone --depth 1 --branch v23.0 https://github.com/bitcoin/bitcoin.git
cd bitcoin/src/secp256k1/
./autogen.sh
./configure --enable-module-schnorrsig
make
sudo make install

Using Gocoin built-in benchmark, external secp256k1 library have 40% faster performance on my system. So i decide to use external secp256k1 library by copying sipasec.go to parent directory.

Code:
git clone --depth 1 --branch 1.10.1 https://github.com/piotrnar/gocoin
cd lib/others/cgo/ec_bench/
go run gonative.go
go run sipasec.go

cd ../../../../client/speedups/
cp sipasec.go ..

Finally it's time to compile Gocoin. You could just compile the client to run full node, but i try to compile everything. It's straightforward and only took few seconds. Both client and wallet compiled with no problem, although 5 external Gocoin failed to compile. I only managed to fix utxo_compress and utxo_decompress after using latest code from Gocoin latest commit.

Code:
cd /path/to/gocoin
cd client/
go build
cd ../wallet/
go build
cd ../tools/
for item in *go; do go build $item; done;

Code:
# command-line-arguments
./utxo_benchmark.go:33:38: invalid operation: cannot slice k (variable of type int)
./utxo_benchmark.go:43:37: cannot use v (variable of type map[utxo.UtxoKeyType][]byte) as type []byte in argument to binary.LittleEndian.Uint32
./utxo_benchmark.go:51:32: cannot use k (variable of type int) as type utxo.UtxoKeyType in argument to utxo.NewUtxoRecStatic
./utxo_benchmark.go:51:35: cannot use v (variable of type map[utxo.UtxoKeyType][]byte) as type []byte in argument to utxo.NewUtxoRecStatic
./utxo_benchmark.go:59:26: cannot use k (variable of type int) as type utxo.UtxoKeyType in argument to utxo.NewUtxoRec
./utxo_benchmark.go:59:29: cannot use v (variable of type map[utxo.UtxoKeyType][]byte) as type []byte in argument to utxo.NewUtxoRec
# command-line-arguments
./verify_script.go:19:54: undefined: syscall.Proc
./verify_script.go:35:22: undefined: syscall.Syscall9
./verify_script.go:45:21: undefined: syscall.LoadDLL
# command-line-arguments
./verify_tx.go:24:42: undefined: syscall.Proc
./verify_tx.go:37:22: undefined: syscall.Syscall9
./verify_tx.go:47:21: undefined: syscall.LoadDLL

Initial Block Download (IBD)

Here's my gocoin.conf which mashed together from Jameson Lopp blog[3] and Gocoin documentation[9-10]. I also configure Gocoin only connect to my Bitcoin Core node. gocoin.conf should be located on directory where you run/launch client file.

Code:
{
    "Memory.CacheOnDisk": false,
    "LastTrustedBlock": "00000000000000000000dbf2ac1b8bbebf83f8d3bd9f9c4a6a5a250548291224",
    "AllBalances.AutoLoad": false,
    "UTXOSave.SecondsToTake": 0,
    "Net.ListenTCP": false,
    "Net.MaxOutCons": 20,
    "Memory.GCPercTrshold": 100,
    "Memory.UseGoHeap": true,
    "Stat.NoCounters": true,
    "Datadir":"/path/to/my/hdd",
    "ConnectOnly": "127.0.0.1:8333",
    "WebUI.ServerMode": true
}

The sync process took about 6.8 hours. As expected, HDD is the only bottleneck on sync process where my Bitcoin Core report sent speed 11-18MB/s speed. Gocoin RAM usage after IBD is 23.1GB, although it's reduced to 19GB after i close and open Gocoin again. Directory size of Gocoin is about 354GB, while Bitcoin Core is about 493GB (txindex, blockfilterindex, coinstatsindex enabled). I have to say Gocoin web UI is rather nice.





[1] https://bitcointalksearch.org/topic/m.60608073
[2] https://bitcointalk.org/index.php?topic=5406961.20
[3] https://blog.lopp.net/2021-bitcoin-node-performance-tests-2/
[4] https://bitcointalksearch.org/topic/gocoin-totally-different-bitcoin-client-with-deterministic-cold-wallet-199306
[5] https://github.com/piotrnar/gocoin/tree/aae8e1774fdfe8bae99bccb5c3fd6113ad7fbc95
[6] https://gocoin.pl/gocoin_installation.html
[7] https://go.dev/dl/
[8] https://gocoin.pl/gocoin_tweaks.html
[9] https://gocoin.pl/gocoin_performance.html
[10] https://gocoin.pl/gocoin_manual_config.html
Pages:
Jump to: