Giter VIP home page Giter VIP logo

gocoin's Introduction

About Gocoin

Gocoin is a full Bitcoin solution written in Go language (golang).

The software architecture is focused on maximum performance of the node and cold storage security of the wallet.

The wallet is designed to be used offline. It is deterministic and password seeded. As long as you remember the password, you do not need any backups ever. Wallet can be used without the client, but with the provided balio tool instead.

The client (p2p node) is an application independent from the wallet. It keeps the entire UTXO set in RAM, providing an instant access to all its records and - in consequece - an extraordinary blochchain processing performance.

System memory and time Gocoin client 1.10.1 needs to sync the blockchain up to the given block number, with comparision to Bitcoin Core 23.0:

SyncChart The above data was collected using Hetzner dedicated server with 3.6GHz Intel i7-7700 CPU, 2x512MB SSD and 1Gbit internet connection, running Debian 11 (bullseye). Clients using their default configuration, except for the second (blue) Bitcoin Core that is set to use dbcache=16384.
For other performance charts see gocoin.pl website.

Requirements

Hardware

client:

  • 64-bit architecture OS and Go compiler.
  • File system supporting files larger than 4GB.
  • At least 32GB of system RAM (you can try with less, but it may be a hassle).

wallet:

  • Any platform that you can make your Go (cross)compiler to build for (Raspberry Pi works).
  • For security reasons make sure to use encrypted swap file (if there is a swap file).
  • If you decide to store your password in a file, have the disk encrypted (in case it gets stolen).

Operating System

Having hardware requirements met, any target OS supported by your Go compiler will do. Currently that can be at least one of the following:

  • Windows
  • Linux
  • macOS
  • Free BSD

Build environment

In order to build Gocoin yourself, you will need the following tools installed in your system:

If the tools mentioned above are properly installed, you should be able to execute go and (optionally) git from your OS's command prompt without a need to specify full path to the executables.

Getting sources

Download the source code from github to a local folder of your choice by executing:

git clone https://github.com/piotrnar/gocoin.git

Alternatively - if you don't want to use git - download the code archive from github.com/piotrnar/gocoin using any web browser. Then extract the archive to your local disk.

Building

Client node

Go to the client/ folder and execute go build there.

Wallet

Go to the wallet/ folder and execute go build there.

Tools

Each sub-folder inside tools/ folder is a separate tool.

Go to a chosen sub-folder and execute go build there.

Binaries

Windows or Linux (amd64) binaries can be downloaded from

Please note that the binaries are usually not up to date. I strongly encourage everyone to build the binaries himself.

Development

Although it is an open source project, I am sorry to inform you that I will not merge in any pull requests. The reason is that I want to stay an explicit author of this software, to keep a full control over its licensing. If you are missing some functionality, just describe me your needs and I will see what I can do for you. But if you want your specific code in, please fork and develop your own repo.

Support

The official web page of the project is served at gocoin.pl where you can find extended documentation, including User Manual.

Please do not log github issues when you only have questions concerning this software. Instead see Contact page at gocoin.pl website for possible ways of contacting me.

If you want to support this project, I ask you to run your own Gocoin node, prefably with TCP port 8333 open for the outside world. Do not hestiate to report any issues you find.

gocoin's People

Contributors

philippgille avatar piotrnar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gocoin's Issues

No downloader in the repo?

The documentation mentions a downloader tool. I've searched the repository and can't find it.

Am I missing something?

secp256k1 implementation fails for certain inputs

copy and past the following unit tests as "misc_tests.go". Into /lib/secp255k1

https://gist.github.com/haltingstate/cf84b5418ac889d192a5

For some valid private keys, the generated public key fails "pubkey2.IsValid()". SIPA's library works for those private keys. A valid public key is not generated for a valid seckey (even through the public key appears to be valid according to sipa's implementation).

About 1 in 1500 keys.

also, for func Multiply(xy, k, out []byte) bool {..}

Multiply(pubkey1, privatekey2) should equal Multiple(pubkey2, privatekey1), fails for these keys.

SIPA said you ported an early version of the library. I cleaned up the library and improved interface, but cannot find the source of these errors.

Format Code

Hello Piotr, Could u Go fmt the source maybe?

Documentation on account management system?

Is there an account management system in this? Is there documentation for it?

I was thinking about forking this and making it more coin neutral and adding an account management system do you feel that is within the scope of this project or do you see it as a wallet for only bitcoin and litecoin?

Unexpected errors BlkTxnNoBIP

We get these errors even from own peers, so there must be some bug.

It seem to be happening only on Windows.

Added a new structure LastAAA and some extra debugs, to investigate it.

Headers-first support?

I was wondering how efficiently this client syncs.

  • Does it implement header-first download?
  • Does it download headers from multiple peers simultanously?

Build fetchbal failed

Hey can't build fetchbal.go tool

selivanov@vs01:~/go/src/github.com/piotrnar/gocoin/tools$ go build fetchbal.go
# command-line-arguments
./fetchbal.go:133: undefined: wallet.NewWallet

panic in network.LimitRejectedSize()

Panic seen:

> main panic recovered: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack(0xd90dc0, 0xc000010018, 0xc1efef94b8)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
main.main.func1()
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/main.go:282 +0x137
panic(0x7fda20, 0x10fa230)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/piotrnar/gocoin/client/network.LimitRejectedSize()
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_sort.go:206 +0x135
github.com/piotrnar/gocoin/client/network.RejectTx(0xc1fb292120, 0xc000c325d5, 0xd5b1bb53dc3165ba)
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_core.go:193 +0x11a
github.com/piotrnar/gocoin/client/network.(*OneTxToSend).Delete(0xc15a3a5ad0, 0xc12c1cd500)
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_core.go:607 +0x271
github.com/piotrnar/gocoin/client/network.HandleNetTx(0xc0d4298300, 0x0, 0x1008e00)
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_core.go:496 +0x1997
main.main()
        /home/piotr/GOPATH/src/github.com/piotrnar/gocoin/client/main.go:470 +0xb94


Fork/Update/Replace GoBit

The GoBit library you seem to be using hasn't been updated in 2 years and seems to be implementing it's own ECDSA and eliptic curve cryptography libraries (probably because the standard library implementations didn't exist yet 2 years ago.) Cryptography is notoriously hard to get right, it would probably be a much better idea to use the crypto/ecdsa and crypto/eliptic standard library implementations now that they exist weather that entails a pull request/fork on GoBit or replacing it entirely with something else.

Invalid memory address or nil pointer dereference on weird TxOut

Hi,

I'm trying to parse the blockchain using gocoin, but I got a panic: runtime error: invalid memory address or nil pointer dereference when I try to decode address for weird TxOut.

Here is my code (https://gist.github.com/tsileo/8008319), and here is the exception I'm getting:

2013/12/17 17:56:54 128233
2013/12/17 17:56:54 128234
2013/12/17 17:56:54 128235
2013/12/17 17:56:54 128236
2013/12/17 17:56:54 128237
2013/12/17 17:56:54 128238
2013/12/17 17:56:54 128239
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x50 pc=0x44796a]

goroutine 1 [running]:
github.com/piotrnar/gocoin/btc.(*BtcAddr).String(0x0, 0x1a, 0x1a)
    /work/opensource/blockchain_playground_golang/src/github.com/piotrnar/gocoin/btc/addr.go:134 +0x2a
main.main()
    /work/opensource/blockchain_playground_golang/dat2.go:75 +0x250e

goroutine 2 [syscall]:
exit status 2

It happens on weird TxOut, when it can't decode/compute address, I found some explanations here and here.

I see it at block:

Even blockchain.info can't handle these TxOuts, I think it's missing some error checking, maybe it should return nil ?

I just started learning Go, so let me know if I missed something,

Thanks!

Error when start wallet "ERROR: open balance/unspent.txt: no such file or directory"

Hi,
I try to run your application.
I want to understand how bitcoing works.
I compiled wallet and executed

Got output

$ ./wallet 
Gocoin Wallet version 1.9.3
This program comes with ABSOLUTELY NO WARRANTY

Using config file wallet.cfg
Seed file .secret not found
Enter your wallet's seed password: 
ERROR: open balance/unspent.txt: no such file or directory 

Did i do something wrong? or it is expected behavior and i have todo something before to run it?

panic upon receiving a corrupt block

> NewTx failed
Corrupt block received from 34.74.46.5:8333 NewTx failed
GetMerkle(): tx missing 0


********************** THIS SHOULD NOT HAPPEN **********************
Please report by sending email to [email protected]
or by logging new issue at https://github.com/piotrnar/gocoin/issues

Make sure to include the data below:

runtime error: invalid memory address or nil pointer dereference
goroutine 3474354 [running]:
runtime/debug.Stack(0x151ef40, 0xc000010018, 0xc19c42b788)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9f
github.com/piotrnar/gocoin/client/network.(*OneConnection).Run.func1()
        /Users/piotr/gocoin/client/network/tick.go:593 +0x36c
panic(0x141c560, 0x17faea0)
        /usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/piotrnar/gocoin/lib/btc.(*Tx).IsCoinBase(0x0, 0xfa36dabbeb826c8e)
        /Users/piotr/gocoin/lib/btc/tx.go:313 +0x26
github.com/piotrnar/gocoin/lib/chain.(*Chain).PostCheckBlock(0xc00015a240, 0xc0b5f79d40, 0x5c1b126c4f00b53d, 0xc24a17a438)
        /Users/piotr/gocoin/lib/chain/block_check.go:149 +0x8a
github.com/piotrnar/gocoin/client/network.netBlockReceived(0xc20e850000, 0xc1aa77c000, 0x1207ec, 0x1207ec)
        /Users/piotr/gocoin/client/network/data.go:184 +0x2c5
github.com/piotrnar/gocoin/client/network.(*OneConnection).Run(0xc20e850000)
        /Users/piotr/gocoin/client/network/tick.go:727 +0x6ee
github.com/piotrnar/gocoin/client/network.DoNetwork.func1(0xc1851c74d0, 0xc20e850000)
        /Users/piotr/gocoin/client/network/tick.go:234 +0x3fa
created by github.com/piotrnar/gocoin/client/network.DoNetwork
        /Users/piotr/gocoin/client/network/tick.go:215 +0x24b


The node will likely malfunction now - it is advised to restart it.
************************ END OF REPORT ****************************

definitely bad

ex_cmd := exec.Command("C:\\Tools\\DEV\\Git\\mingw64\\bin\\curl.EXE",

exactly this line and approach itself
i'm C programmer and just examine go for now. in C i've done this stuff with sockets only(after some research).
what stops you from doin it over http request engine? only two unusual things there are http auth(drags in base64 stuff with tricks needed) and that thing that json part hooks in as a binary block. Latter is np to implement ,just unexpected
C sample is here https://github.com/alexeyneu/json-demo/blob/master/json_c.cpp

ERROR: Incorrect AllowedIP: 0.0.0.0/0

Hi there,

I've found an issue when allowing everyone to use the webui.

ERROR: Incorrect AllowedIP: 0.0.0.0/0

It looks like the issue is located in this function and the netmask /0 is not parsed correctly

func str2oaa(ip string) (res *oneAllowedAddr) {

my gocoin.conf

{"Testnet":false,"ConnectOnly":"","Datadir":"","TextUI_Enabled":false,"UserAgent":"","UTXOSaveSec":0,"WebUI":{"Interface":":8833","AllowedIP":"0.0.0.0/0","ShowBlocks":144,"AddrListLen":15,"Title":"Gocoin","PayCmdName":"pay_cmd.txt","ServerMode":true},"RPC":{"Enabled":false,"Username":"gocoinrpc","Password":"gocoinpwd","TCPPort":0},"Net":{"ListenTCP":true,"TCPPort":0,"MaxOutCons":9,"MaxInCons":10,"MaxUpKBps":0,"MaxDownKBps":0,"MaxBlockAtOnce":3,"MinSegwitCons":4},"TXPool":{"Enabled":true,"AllowMemInputs":true,"FeePerByte":20,"MaxTxSize":100000,"ExpireMinPerKB":1800,"ExpireMaxHours":120,"SaveOnDisk":false},"TXRoute":{"Enabled":true,"FeePerByte":25,"MaxTxSize":100000},"Memory":{"GCPercTrshold":100,"MaxCachedBlks":200,"FreeAtStart":false},"AllBalances":{"MinValue":100000,"UseMapCnt":100,"SaveOnDisk":false},"Stat":{"HashrateHrs":12,"MiningHrs":24,"FeesBlks":24,"BSizeBlks":72},"DropPeers":{"DropEachMinutes":5,"BlckExpireHours":24,"PingPeriodSec":15}}

How to use wallet binary?

Sorry but what does it mean? It's very first run.

Gocoin Wallet version 1.9.5
This program comes with ABSOLUTELY NO WARRANTY

GOCOIN_WALLET_CONFIG not set
Using config file wallet.cfg
Seed file .secret not found
Enter your wallet's seed password: ***
ERROR: open balance/unspent.txt: The system cannot find the path specified.

Am I supposed to make some thing prior to running wallet? Where can I see some documentation?

HandleNetBlock does not ensure non-null Block input

I'm not sure if it's specifically relevant to bitcoin nodes, but the code did trip a panic over a non-existing value in the .Block value of the parameter of this function while I have been working on a fork

func HandleNetBlock(newbl *network.BlockRcvd) {

It may not be relevant as there may have been some other reason for a block coming through from the connection goroutine from a foreign chain without this value filled in.

cgo/openssl fails

Hi, Piotr;

In the piotrnar/gocoin/master/lib/others/cgo/openssl subdirectory, "go build" emits no errors.

However, "go test" produces this:
--- FAIL: TestVerify (0.00s)
openssl_test.go:14: Verify failed
openssl_test.go:19: Verify not failed while it should
openssl_test.go:31: Zero expected -1
FAIL
exit status 1
FAIL github.com/piotrnar/gocoin/lib/others/cgo/openssl 0.002s

What did I do wrong?

Thanks,

Jo3

crash upon completing initial sync

I just ran a full sync with the following options:

LastTrustedBlock:"00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
AllBalances.AutoLoad:false
UTXOSave.SecondsToTake:0

After the sync had completed, gocoin crashed with:

> panic: runtime error: integer divide by zero

goroutine 1652364922 [running]:
github.com/piotrnar/gocoin/lib/utxo.(*UnspentDB).save(0xc000c44480)
	/home/jameson/go/src/github.com/piotrnar/gocoin/lib/utxo/unspent_db.go:267 +0xc6e
created by github.com/piotrnar/gocoin/lib/utxo.(*UnspentDB).Save
	/home/jameson/go/src/github.com/piotrnar/gocoin/lib/utxo/unspent_db.go:446 +0x8e

Add Godoc comments

First of all: Amazing effort to write an independent Bitcoin implementation as an (as it seems) single contributor.

I stumbled upon this thanks to this Tweet, which points to the same author's blog article comparing different Bitcoin node implementations' performance.

I wanted to take a dive into the code, but realized that in many/most packages, for example github.com/piotrnar/gocoin/lib/btc, most exported types and functions don't have any Godoc comment. Some types/functions have comments, but don't adhere to the Godoc format (like beginning with the name of the type/function, as mentioned in this Go Blog article).

See the Godoc of that package here: https://godoc.org/github.com/piotrnar/gocoin/lib/btc

Examples of well documented packages:

Proper Godoc comments might be helpful for

  1. potential contributors who want to dive into and understand the code and
  2. package users who want to use your exported packages as a library for their own applications.

To not export some packages at all you could use an internal directory, as explained in the Go 1.4 release notes.

As a side note, the recently announced official https://go.dev website, which offers an updated / extended version of Godoc, for example to support versioned Go modules, seems to not be able to understand your LICENSE and thus thinks it's not allowed to show your Godoc at all. See https://pkg.go.dev/github.com/piotrnar/gocoin/lib/btc?tab=doc.

“Doc” hidden due to license restrictions.

Litecoin M-address support

Right now it's possible to generate 3* segwit addresses for Litecoin, however Litecoin core client switched to M* addresses to not confuse with Bitcoin. Will it be possible to generate M* addresses with gocoin wallet app?

Turn this into something CoinLab will open source?

Hey Piotr,

I've been playing around with this and like it. Nice work! Are you interested in talking about doing some contracting with CoinLab? There are some tools we'd like to see open sourced, and this would be a good base.

Source code not signed

Currently there is no way to verify if the downloaded source code is really what you've written. Please add pgp signatures. For example, at very least, sign release tags (git tag -s ...). But better - sign every commit (gpg config commit.gpgsign true, or git commit -S).

Other than that, the project looks really great! Really offline wallet!

importblocks.go error

I get the following when trying to build the import tool.

#command-line-arguments
.\importblocks.go:98: chain.Save undefined (type *chain.Chain has no field or method Save)

Broken private key padding

HDWallet.Child is not guaranteed to always return 33-byte private key.
Also your PR policy is absurd. You'd better but that disclaimer in bold on top of the readme, so no one will waste time on it.

How to use it for Litecoin

// Specify blocks directory
BlockDatabase := chain.NewBlockDB("/home/tapir/.litecoin/blocks")

h, _ := hex.DecodeString("892559879b5d0d8c3cbe37397772ad887158d85c79fb70d46fe6097fda1b9d82")
hash := btc.NewUint256(h)

d, t, err := BlockDatabase.BlockGet(hash)
if err != nil {
	oanic(err)
}

gives an error

Using malloc() for UTXO memory bindings
Block not in the index

eventhough it's a valid block.

sign transaction and broadcast

Hi, sorry for raise this issue, I just want to know how can I use gocoin to sign transaction and broadcast? especially when the account have muti utxos

Snappy URL changed.

Hey, since you don't accept PR, I'm here only to inform you that URL for snappy doesn't work anymore for go get. You should change it to github.com/golang/snappy/snappy.

Cheers!

WHat do you mean by password is seeded ?

Hi,

Do the password stored with the blockchain ?

How it is encrypted if it's the case and what is the risk others can decrypt it by brute forcing the blockchain ?

Thank you

add config parameter for last trusted block

it would be helpful if there was a config parameter that makes it easy to set the trusted block to the genesis block. Something similar to Bitcoin Core's "assumevalid=0"

decode addr from input script

i want to decode addr from input script. NewAddrFromPkScriptjust for out decoding
example:
input in tx 43285784b1fc03edbed6841598dea7979825b25167282f8adf873a39e67e30cc
can i get addr from input script directly?

Evaluate if contributions are acceptable when the contributor signed a CLA

Did you evaluate the possibility of requiring a signed CLA (Contributors License Agreement) for contributions? I think that way you could set the terms under which contributions can be made and include under which license everything falls and that you have the full rights to the contribution etc.

Many companies and foundations that maintain open source software require contributors to sign such CLAs, like the Eclipse Foundation, Canonical, Google, Microsoft and others.

I think most open source CLAs have the purpose that the maintainers can be sure that contributors grant rights to the end-user and also allow project sublicensing, but I assume that can be modified to your needs.

This might require some more research if you want to be on the safe side.

wallet passphrasee

Can I decrypt(walletpassphrase) or encrypt(encryptwallet) my wallet.dat using this client? Where is source code of this part?

panic: index out of range in network.LimitPoolSize()

Mined block 510809
main panic recovered: runtime error: index out of range
goroutine 1 [running]:
runtime/debug.Stack(0xc477893550, 0x2, 0x2)
/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
main.main.func1()
/home/ssdn/GOPATH/src/github.com/piotrnar/gocoin/client/main.go:267 +0x134
panic(0x7bce20, 0xe6bec0)
/usr/local/go/src/runtime/panic.go:505 +0x229
github.com/piotrnar/gocoin/client/network.LimitPoolSize(0x1cdef9d8)
/home/ssdn/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_sort.go:169 +0x649
github.com/piotrnar/gocoin/client/network.ExpireTxs()
/home/ssdn/GOPATH/src/github.com/piotrnar/gocoin/client/network/txpool_sort.go:469 +0xcd
github.com/piotrnar/gocoin/client/network.NetworkTick()
/home/ssdn/GOPATH/src/github.com/piotrnar/gocoin/client/network/tick.go:446 +0x615
main.main()
/home/ssdn/GOPATH/src/github.com/piotrnar/gocoin/client/main.go:423 +0x9e0

run gocoin

How to run gocoin after build go client,tools and downloader

[BUG] panic when first time run client. You didn't create dir before Creating empty default wallet

go version go1.3.1 linux/amd64
Gocoin client version 1.0.3

in client/init.go, line 78~79
fmt.Println("Creating empty default wallet at", default_wallet_fn)
ioutil.WriteFile(default_wallet_fn, []byte(fmt.Sprintln("# Put your wallet's public addresses here")), 0660)

You didn't make dir before write file. Obviously, ioutil.WriteFile will fail, but you ignore the error.

feeling4t@feeling4t-laptop:~/btc/gocoin/client$ ./client -t
Gocoin client version 1.0.3
You seem to be running Gocoin for the fist time on this PC
/home/feeling4t/.bitcoin/gocoin/tstnet/wallet/DEFAULT not found
Creating empty default wallet at /home/feeling4t/.bitcoin/gocoin/tstnet/wallet/DEFAULT
Place secrets of your stealth keys in /home/feeling4t/.bitcoin/gocoin/tstnet/wallet/stealth/ (use 'arm' to load more)
main panic recovered: runtime error: invalid memory address or nil pointer dereference
/home/feeling4t/btc/gocoin/client/main.go:250 (0x40709f)
func.002: fmt.Println(string(debug.Stack()))
/usr/local/go/src/pkg/runtime/panic.c:248 (0x415b6d)
panic: runtime·newstackcall(d->fn, (byte*)d->args, d->siz);
/usr/local/go/src/pkg/runtime/panic.c:552 (0x41661d)
panicstring: runtime·panic(err);
/usr/local/go/src/pkg/runtime/os_linux.c:237 (0x41520e)
sigpanic: runtime·panicstring("invalid memory address or nil pointer dereference");
/home/feeling4t/gowork/src/github.com/piotrnar/gocoin/client/wallet/balance.go:517 (0x4a338f)
LoadAllWallets: for i := range MyWallet.Addrs {
/home/feeling4t/btc/gocoin/client/init.go:88 (0x401c0f)
host_init: wallet.LoadAllWallets()
/home/feeling4t/btc/gocoin/client/main.go:260 (0x406089)
main: host_init() // This will create the DB lock file and keep it open
/usr/local/go/src/pkg/runtime/proc.c:247 (0x417bca)
main: main·main();
/usr/local/go/src/pkg/runtime/proc.c:1445 (0x41a390)
goexit: runtime·goexit(void)

Closing network

modify it to

        fmt.Println("Creating empty default wallet at", default_wallet_fn)
        if err := ioutil.WriteFile(default_wallet_fn, []byte(fmt.Sprintln("# Put your wallet's public addresses here")), 0660); err !=nil {
            fmt.Println("###Create wallet error:", err)
        }else{
            fmt.Println("###Create wallet OK")
        }

feeling4t@feeling4t-laptop:~/btc/gocoin/client$ ./client -t
Gocoin client version 1.0.3
You seem to be running Gocoin for the fist time on this PC
/home/feeling4t/.bitcoin/gocoin/tstnet/wallet/DEFAULT not found
Creating empty default wallet at /home/feeling4t/.bitcoin/gocoin/tstnet/wallet/DEFAULT

Create wallet error: open /home/feeling4t/.bitcoin/gocoin/tstnet/wallet/DEFAULT: no such file or directory

Place secrets of your stealth keys in /home/feeling4t/.bitcoin/gocoin/tstnet/wallet/stealth/ (use 'arm' to load more)
main panic recovered: runtime error: invalid memory address or nil pointer dereference
/home/feeling4t/btc/gocoin/client/main.go:250 (0x40709f)
func.002: fmt.Println(string(debug.Stack()))
/usr/local/go/src/pkg/runtime/panic.c:248 (0x415b6d)
panic: runtime·newstackcall(d->fn, (byte*)d->args, d->siz);
/usr/local/go/src/pkg/runtime/panic.c:552 (0x41661d)
panicstring: runtime·panic(err);
/usr/local/go/src/pkg/runtime/os_linux.c:237 (0x41520e)
sigpanic: runtime·panicstring("invalid memory address or nil pointer dereference");
/home/feeling4t/gowork/src/github.com/piotrnar/gocoin/client/wallet/balance.go:517 (0x4a338f)
LoadAllWallets: for i := range MyWallet.Addrs {
/home/feeling4t/btc/gocoin/client/init.go:88 (0x401c0f)
host_init: wallet.LoadAllWallets()
/home/feeling4t/btc/gocoin/client/main.go:260 (0x406089)
main: host_init() // This will create the DB lock file and keep it open
/usr/local/go/src/pkg/runtime/proc.c:247 (0x417bca)
main: main·main();
/usr/local/go/src/pkg/runtime/proc.c:1445 (0x41a390)
goexit: runtime·goexit(void)

Closing network

Can't build the GoCoin tools? (go build says "too many errors")

I am trying to install GoCoin on a new Ubuntu 17.10 Server environment (with plenty of memory and disk space). Here's what I did:

  1. install Go: sudo apt install golang-go
    (after installation, go version says: go version go1.8.3 linux/amd64)

  2. retrieved the GoCoin sources: go get github.com/piotrnar/gocoin

  3. run go build in ~/go/src/github.com/piotrnar/gocoin/client which seems to work OK

  4. run go build in ~/go/src/github.com/piotrnar/gocoin/client which gives:

./balio.go:5: binary redeclared in this block
	previous declaration at ./base58.go:15
./base58.go:19: main redeclared in this block
	previous declaration at ./balio.go:151
./bdb.go:7: binary redeclared as imported package name
	previous declaration at ./base58.go:15
./bdb.go:181: main redeclared in this block
	previous declaration at ./base58.go:19
./bootdat_qt.go:45: main redeclared in this block
	previous declaration at ./bdb.go:181
./btcversig.go:11: ltc redeclared as imported package name
	previous declaration at ./balio.go:24
./btcversig.go:21: help redeclared in this block
	previous declaration at ./base58.go:16
./btcversig.go:26: main redeclared in this block
	previous declaration at ./bootdat_qt.go:45
./compressdb.go:13: main redeclared in this block
	previous declaration at ./btcversig.go:26
./fetchblock.go:13: main redeclared in this block
	previous declaration at ./compressdb.go:13
./fetchblock.go:13: too many errors


Am I doing something wrong?

Wrong sequence of blocks when using FetchNextBlock

I'm experiencing strange results when using the blockdb and FetchNextBlock to iterate over blocks in my local blocks directory.
My goal is to use the parser of gocoin for a related project and I noticed that the sequence in which blocks are returned by FetchNextBlock is not the necessarily the order given by the blockchain.
The deviation starts at around block #3857 and can be reproduced with this minimal example:

package main

import (
	"log"
	"os"

	"github.com/piotrnar/gocoin/lib/btc"
	"github.com/piotrnar/gocoin/lib/others/blockdb"
)

func main() {
	magic := [4]byte{0xF9, 0xBE, 0xB4, 0xD9}
	db := blockdb.NewBlockDB(os.Args[1], magic)

	for i := 0; i < 4000; i++ {
		dat, _ := db.FetchNextBlock()
		block, _ := btc.NewBlock(dat[:])
		log.Printf("Block #%d hash: %v\n", i, block.Hash)
	}
}

I'm aware that there might be orphaned blocks, however the last two block hashes output by this code are:

Block #3998 hash: 00000000e86a5b1406aec394d058496f0ca3c09ef999e39c2adbd247f3be401f
Block #3999 hash: 000000005b1c6306ad9bf38cdb60642bc24793db171daec4986fc41eb414a7c2

These blocks are #4017 and #4010 in the main chain which means the later block #4017 is processed before #4010!
Any ideas what's going one here? I doubt that this is an actual bug and guess I might just be using it incorrectly. However, I cannot figure out how.
Thanks in advance.

Downloader will failed to download blocks

The eorror:

cmd> Last Header Height: 406019 ...
cmd> Last Header Height: 408019 ...
cmd> AllHeadersDone after 16m0.708068489s
Assume last trusted block as 00000000000000000230c3f19d376998b6fc06b5e7adebcdd5b5203e2aa958b5 at 410154
Downloading blocks -  317279 blocks to get / up to 410160
cmd> Blck:92882/92882/96081/410160  Pend:317157  Que:0 (0MB)  Dl:3078  Cach:122 (0MB)  BLen:4kB  Net:10  [14 => 0 KBps]  Mem:417MB  EC:0  0.1min
cmd> Blck:92882/92882/96881/410160  Pend:315805  Que:0 (0MB)  Dl:2526  Cach:1474 (0MB)  BLen:4kB  Net:10  [81 => 0 KBps]  Mem:420MB  EC:0  0.2min
cmd> ProcessBlockTransactionsA 000000000008f3f1969d1ebbedf93d21524241a9e97defe10781a745aa72a615 92883 Unknown input TxID: 44fc040a87fbad55fb267dc0cdae07c2211f2a1e6d01f3324f471b79ad861e96
CommitBlock: Unknown input TxID: 44fc040a87fbad55fb267dc0cdae07c2211f2a1e6d01f3324f471b79ad861e96

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.