Original Topic: Exploring alternative full node implementations - GocoinAuthor: ABCbits
IntroI dey inspire by di tiltedIceCream reply[1] for thread "Why dey no encourage other way to implement am?"[2], i dey inspirited to try another way Bitcoin full node to do am. Based on Jameson Lopp benchmark[3], Gocoin look to get good performance so i decide to give am a try.
Basic info- Dey write am for Go language (golang).
- dey only develop am by piotr_n[4].
- e get both full node and wallet function.
- dey develop am since 2013[5].
- Gocoin load all UTXO for 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 installationDi documentation[6] just mention i need git and golang for my system. Since e no mention required golang version, i just use golang provide for my distro. I receive golang 1.18.1 which na just small e old dan di new version (1.18.4[7]).
sudo apt update && sudo apt install golang-go
go version
As i read tweak page[8], Gocoin also support di use of external secp256k1 library from Bitcoin Core. So i decide to install secp256k1 for my system and clone Gocoin 1.10.1.
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
Use Gocoin to take build-in benchmark, external secp256k1 library get 40% faster performance for my system. So i decide to use di external secp256k1 library to take copy
sipasec.go to parent directory.
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 na time to compile Gocoin. You fit just compile di
client to run full node, but i try to compile everything. E dey straightforward and e only take few seconds. Both client and wallet compiled no get problem, although 5 external Gocoin fail to compile. I just manage fix
utxo_compress and
utxo_decompress after I use di latest code from Gocoin latest commit.
cd /path/to/gocoin
cd client/
go build
cd ../wallet/
go build
cd ../tools/
for item in *go; do go build $item; done;
# 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 na my
gocoin.conf wey mashed togeda from Jameson Lopp blog[3] and Gocoin documentation[9-10]. I also configure Gocoin only connect to my Bitcoin Core node.
gocoin.conf e should dey locate on directory whr you run/launch
client file.
{
"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
}
Di sync process dey take about 6.8 hours. As expected, HDD na di only bottleneck for sync process whr my Bitcoin Core report send speed na 11-18MB/s speed. Gocoin RAM usage after IBD na 23.1GB, although e dey reduce to 19GB after i close and open Gocoin again. Directory size of Gocoin na about 354GB, while Bitcoin Core na about 493GB (
txindex,
blockfilterindex,
coinstatsindex enabled). I go talk say Gocoin web UI e dey good.
https://bitcointalk.org/index.php?topic=5407675.msg60633040#msg60633040Dis link wey I add for up, e dey part of dis thread and e go help well well.
[1]
https://bitcointalk.org/index.php?topic=5406961.msg60608073#msg60608073[2]
https://bitcointalk.org/index.php?topic=5406961.20[3]
https://blog.lopp.net/2021-bitcoin-node-performance-tests-2/[4]
https://bitcointalk.org/index.php?topic=199306.0[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