Code Monkey home page Code Monkey logo

rivine's Introduction

Rivine

Build Status GoDoc Go Report Card

Blockchain technology for creating custom chains.

Whitepaper

You can reach out to us for any development-related questions on our public Telegram group.

Product owners

Main Repositories

Usage

This project comes with 2 binaries, rivined and rivinec. rivined is a background service, or "daemon," that runs the Rivine protocol, and rivinec is a client that is used to interact with rivined. rivined exposes an HTTP API on 'localhost:23110' which can be used to interact with the daemon. Documentation on the API can be found in doc/API.md.

rivined and rivinec are run via command prompt. On Windows, you can just double- click rivined.exe if you don't need to specify any command-line arguments. Otherwise, navigate to the rivine folder and click File->Open command prompt. Then, start the rivined service by entering rivined and pressing Enter. The command prompt may appear to freeze; this means rivined is waiting for requests. Windows users may see a warning from the Windows Firewall; be sure to check both boxes ("Private networks" and "Public networks") and click "Allow access." You can now run rivinec in a separate command prompt to interact with rivined.

Building From Source

To build from source, Go 1.10 or higher must be installed on the system (older versions of GO might work, with some work, but we don't support it). Then simply use go get:

go get -u github.com/threefoldtech/rivine/cmd/...

This will download the Rivine repo to your $GOPATH/src folder, and install the rivined and rivinec binaries in your $GOPATH/bin folder.

To stay up-to-date, run the previous go get command again. Alternatively, you can use the Dockerfile provided in this repo. Run docker build -t rivine . to build and docker run --name rivine rivine to start the daemon. Running the client can be done with docker run -it rivine rivinec. Add client commands just like you would calling rivinec normally (like docker run -it rivine rivinec wallet transactions).

Supporting a Rivine Wallet in a Light Client

Should you wish to support Rivine, or more likely a Rivine-based wallet in a(n) existing/new light client, it is recommended that you read /doc/transactions/light_wallet.md as a starting point.

This document references to (most of the) other documentation you'll need in order to develop your own light wallet for a Rivine-Protocol-based blockchain.

Troubleshooting

  • I can't connect to more than 8 peers.

    Once Rivine has connected to 8 peers, it will stop trying to form new connections, but it will still accept incoming connection requests (up to 128 total peers). However, if you are behind a firewall, you will not be able to accept incoming connections. You must configure your firewall to allow Rivine connections by forwarding your ports. By default, Rivine communicates on port 23112. The specific instructions for forwarding a port vary by router. For more information, consult this guide.

    Rivine currently has support for UPnP. While not all routers support UPnP, a majority of users should have their ports automatically forwarded by UPnP.

  • I loaded a seed, but my coins don't appear yet.

    After loading your seed, you will need to stop and restart your daemon. If after that the coins still haven't appeared (and you are sure they should be there), you can try rivinec wallet addresses to force load some more addresses.

    Note that when you recover a wallet from an existing seed, using wallet recover, effectively creating a new wallet using an existing set, your addresses will already be loaded when unlocking it.

  • My daemon exits imediately upon startup, giving the error: error opening consensus database: invalid argument:

    Make sure that the file system you are using for your daemon's persistent directory supports features such as mmap and flock. Shared folders for example, as is common in virtual environments or containers, might not support mmap and therefore will fail to function. The scenario in this example can easily be resolved by making sure the persistent directory isn't located within a shared folder.

  • My node can be out of sync with the network for hours, if not days.

    Do you have multiple nodes —which includes the out-of-sync node— running on a single external IP using the same port within the same blockchain network? If the answer is yes, you should ensure that all those nodes are using unique ports for the RPC address.

    If not already, you will run into problems sooner or later when running multiple nodes using the same external IP address and RPC address port within the same blockchain network.

rivine's People

Contributors

avahowell avatar bitspill avatar chrisschinnerl avatar christopherhutton avatar cyrozap avatar davidvorick avatar dnetguru avatar droghio avatar dylanverstraete avatar glendc avatar joshvorick avatar lafont-e avatar leesmet avatar lukechampine avatar mingling94 avatar mnsl avatar mtlynch avatar nbabenko avatar nvinken avatar peternashaat avatar robvanmieghem avatar sacha96 avatar seveibar avatar tbenz9 avatar triazo avatar voidingwarranties avatar zaibon avatar

Stargazers

 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

rivine's Issues

Color coins

Color coins mean you have different assets that can be used for different things. For example a specific 'color' can be set to be used as fee asset. This is done with an extra tag.
The advantage is that you can set up different asset types on the same "chain" without extra work if you add a certain color type.
Later a trade can be set up to trade between the different types (colors)

Tor support

It should be possible to expose a node as a Tor secret service.

Arbitrary data example from an external program

Make a tutorial. This example can than be the reference case on how to use the rivine code.
As an example a Proof Of Existence can be made.
Via this example people can input a file (ex. a pdf file) that will be hashed and added in a transaction to proof that a certain file is made before a timestamp.
The Application should be able to:

  • receive a file , hash it, sign a transaction locally with this hash and send this transaction to some transaction builder nodes to put this proof on the chain. (fee will be needed for this transaction).
  • Poll to see if the transaction is added to the chain and how deep (to know if the transaction is secured in the chain).
  • Give a file and check if the file is included in the blockchain + when.

RAML

Make a RAML and addapt the API if needed.
This way we can use this RAML as help/reference guide.
This RAML can for example also be used to generate GO code via GORAML to generate client code that can than easily talk with the rivine deamon.

More efficient checking BS

Now the BS's in a wallet are checked for 10 seconds in advance.
If there is a match this one is used to make a block. But if there is another BS from the same wallet with an more recent match as well, its not used. This is not efficient if there is another wallet which claims a block in between the 2 matches.

Do not generate "preparation" transactions

Currently the code generates multiple technical transactions per functional transaction.
The first transaction takes funds and outputs the payback and the prepared amount. This prepared amount is used in a spending transaction. While in Sia this is handy to put file contracts in separate transactions, this actually causes some issues in our case (more complex fee handling, multiple transactions visible in transaction history, block stake transaction not shown in the transaction history,...)
It would be better not to create these "preparation" transactions.

Add aging for Blockstake transfers

Normal scenario: When a new block is minted, the Blockstake will be respend to the same address at transaction index 0 in that minted block.

When an adversary mint a block, a fake transaction of BlockStake he also owns can be put it in the transaction list and this way influence the index of this BlockStakes UTXO. This way the BlockCreation equation can be influenced.

Another way is to put a BlockStake transaction in the network at a specific time and hope it will be in a specific block that will be minted by an honest minter. This way K in the blockcreation equation can be influenced.

The protocol added an extra rule to prevent those attacks : BlockStakes transactions with index not 0 can only be used for blockcreation after 256 blocks.

use xtaci/smux instead NebulousLabs/muxado

Muxado is a dependency used in the gateway module, and handles all the underlying peer connections, as it acts as our stream multiplexer. NebulousLabs is using a forked version, which I assume is because they want to stick with version 1 of muxado. The original repo is in the meanwhile on version 2, 30 commits later.

As Muxado is a very important piece in the gateway puzzle, it might be worth investigating (eventually) and choose to update this dependency to the latest version of the original repo, and update the code accordingly.

Before this is done however, should have sufficient reasons and arguments that support this action.

Questions to clarify in documentation

  1. Who exactly are signing blocks? How the BlockStakes are distributed?
  2. Who controls initial supply and distribution of BlockStakes?
  3. Can new nodes join block signing? Ways for new actors to become participants in consensus.
  4. Are blockStakes freely transferrable?
  5. What are possible attack vectors on the network? (Cases in which it is theoretically possible for a malicious actor to get control of the network). What are our countermesures for these cases if any?
  6. More details how to launch new chain and where/how to write consensus contracts/logic
  7. Protocol upgrade logic
  8. Roadmap for further development/current bottlenecks

blockcreation is stalled after block creation is halted for a while

2016/10/19 09:33:28.960314 proofofblockstake.go:32: [DEBUG] Solved block: {"parentid":"c039300cb0c28a557b2972521919d6ecef9faf53297a69cd87d01883c7af1540","pobsindexes":{"BlockHeight":162,"TransactionIndex":1,"OutputIndex":1},"timestamp":1476869613,"minerpayouts":null,"transactions":[]}
2016/10/19 09:33:28.962200 blockmanager.go:19: Created a stale block - block appears valid but does not extend the blockchain
2016/10/19 09:33:28.962226 proofofblockstake.go:36: ERROR: An error occurred while submitting a solved block: block does not extend the longest fork

Add more info about the blockstake

Because we do POBS, blockstake is more important. So more info should be available.
This must be available via API and command line.

  • current blockstake in use (in total of the whole network) for POBS
  • list of blockstakes of this account (grouped per UTXO),
    • Colored if the blockstake is active or on hold for some reason (ex. aging).
    • Age of each blockstake in this account.
    • Number of blocks that this blockstake created.
    • fee and blockcreation assets that this blockstake has earned by creating blocks
    • Percentage of block creation measured (last week averrage) and theoretical
  • All the above but aggregated for the whole account

fix unit tests

There are currently quite a lot of unit tests that don't compile. I can only imagine that this is the result of heavy refactoring and the hard work done after the hard fork of Sia? I suppose this is not new to you, but I was wondering what to do with this? Should this be ignored for now, or should I help in fixing this?

Support for offline transaction signing

When using a lightweight wallet on a phone for example, you do not want to sync the entire blockchain. In order for such a scenario to work, the api should expose the possibility to accept complete transactions and relay them to the p2p network.

provide verbose logging

Right now it is very difficult to follow the flow of a certain chain of actions.

For example, when debugging the gateway module, to see why certain peers get added, others get dropped, or why peers seem to be stuck in a adding loop, it is right now impossible to follow that flow, without manually putting print statements, or going with GDB manually through it.

I think it would be useful if we provide a verbose flag to the daemon, which if passed, would log verbosely the program flow as it happens. This would require us to add such verbose (conditional) logging statements to each module. We could start with the Gateway module and expand from there. Just to see how much it really helps in understanding a situation/flow.

Deamon crached after restarting

ruben@:~/gig/git/rivine/rivine_build$./rivined --no-bootstrap
Loading...
(0/5) Loading rivined...
(1/5) Loading gateway...
(2/5) Loading consensus...
(3/5) Loading transaction pool...
(4/5) Loading wallet...
(5/5) Loading block creator...
Finished loading in 0.0037821680000000002 seconds

Rescanning consensus set...

Done!
unexpected fault address 0xb01dfacedebac1e
fatal error: fault
[signal 0xb code=0x1 addr=0xb01dfacedebac1e pc=0x401ecc]

goroutine 65 [running]:
runtime.throw(0x6f0120, 0x5)
	/usr/local/go/src/runtime/panic.go:547 +0x90 fp=0xc8202bc578 sp=0xc8202bc560
runtime.sigpanic()
	/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x2ba fp=0xc8202bc5c8 sp=0xc8202bc578
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.(*Session).writeFrame(0xc820161040, 0xdae7d8, 0xc8202a8ec0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/session.go:226 +0x8c fp=0xc8202bc620 sp=0xc8202bc5c8
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.(*Stream).write(0xc8201f2800, 0xc8202a5048, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/stream.go:267 +0x295 fp=0xc8202bc6d0 sp=0xc8202bc620
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.(*Stream).Write(0xc8201f2800, 0xc8202a5048, 0x4, 0x4, 0x4, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/stream.go:68 +0x52 fp=0xc8202bc718 sp=0xc8202bc6d0
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).respond(0xc8203180f0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:86 +0x1cc fp=0xc8202bc7b8 sp=0xc8202bc718
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8202bc7c0 sp=0xc8202bc7b8
created by github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).Start
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:46 +0x7d

goroutine 1 [chan receive, 1 minutes]:
main.startDaemon(0x0, 0x0, 0x70ba80, 0xf, 0x6e89e8, 0x6, 0x0, 0x0, 0x0, 0x6eee28, ...)
	/go/src/github.com/rivine/rivine/rivined/daemon.go:261 +0x1f3a
main.startDaemonCmd(0xc8200778c0, 0xc82010ef50, 0x0, 0x1)
	/go/src/github.com/rivine/rivine/rivined/daemon.go:277 +0x45
github.com/rivine/rivine/vendor/github.com/spf13/cobra.(*Command).execute(0xc8200778c0, 0xc82000a3d0, 0x1, 0x1, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/spf13/cobra/command.go:575 +0x896
github.com/rivine/rivine/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc8200778c0, 0xc8200778c0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/spf13/cobra/command.go:661 +0x55c
github.com/rivine/rivine/vendor/github.com/spf13/cobra.(*Command).Execute(0xc8200778c0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/spf13/cobra/command.go:620 +0x2d
main.main()
	/go/src/github.com/rivine/rivine/rivined/main.go:159 +0x8bc

goroutine 5 [syscall, 1 minutes]:
os/signal.signal_recv(0x0)
	/usr/local/go/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 6 [IO wait]:
net.runtime_pollWait(0xc73fd0, 0x72, 0xc6e050)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820111db0, 0x72, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820111db0, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc820111d50, 0x0, 0xcae000, 0xc82048eda0)
	/usr/local/go/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820028120, 0xc820042e28, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820028120, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock_posix.go:264 +0x3d
net/http.(*Server).Serve(0xc820070980, 0xc74128, 0xc820028120, 0x0, 0x0)
	/usr/local/go/src/net/http/server.go:2117 +0x129
main.(*Server).Serve(0xc8200afde0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/rivined/server.go:332 +0x4e
main.startDaemon.func1(0xc8200549c0, 0xc8200afde0)
	/go/src/github.com/rivine/rivine/rivined/daemon.go:127 +0x21
created by main.startDaemon
	/go/src/github.com/rivine/rivine/rivined/daemon.go:128 +0x54e

goroutine 7 [IO wait, 1 minutes]:
net.runtime_pollWait(0xc73f10, 0x72, 0xc6e050)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820111e90, 0x72, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820111e90, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc820111e30, 0x0, 0xcae000, 0xc820182040)
	/usr/local/go/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820028150, 0x2, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820028150, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock_posix.go:264 +0x3d
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentListen(0xc82006ef20, 0xc820054ae0)
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:97 +0x7d
created by github.com/rivine/rivine/modules/gateway.New
	/go/src/github.com/rivine/rivine/modules/gateway/gateway.go:291 +0xd07

goroutine 8 [chan send]:
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager(0xc82006ef20, 0xc820054b40)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:120 +0xb78
created by github.com/rivine/rivine/modules/gateway.New
	/go/src/github.com/rivine/rivine/modules/gateway/gateway.go:298 +0xdb9

goroutine 9 [select]:
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentNodeManager(0xc82006ef20, 0xc820054ba0)
	/go/src/github.com/rivine/rivine/modules/gateway/nodes.go:241 +0x768
created by github.com/rivine/rivine/modules/gateway.New
	/go/src/github.com/rivine/rivine/modules/gateway/gateway.go:305 +0xe6b

goroutine 10 [select, 1 minutes]:
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentNodePurger(0xc82006ef20, 0xc820054c00)
	/go/src/github.com/rivine/rivine/modules/gateway/nodes.go:178 +0x99a
created by github.com/rivine/rivine/modules/gateway.New
	/go/src/github.com/rivine/rivine/modules/gateway/gateway.go:312 +0xf1a

goroutine 78 [IO wait, 1 minutes]:
net.runtime_pollWait(0xc73d90, 0x77, 0xc8203a1088)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8201eb4f0, 0x77, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitWrite(0xc8201eb4f0, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:82 +0x36
net.(*netFD).connect(0xc8201eb490, 0x0, 0x0, 0xc730a8, 0xc820450fc0, 0xed0cb0445, 0x114e6745, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:127 +0x28e
net.(*netFD).dial(0xc8201eb490, 0xc74160, 0x0, 0xc74160, 0xc82044d200, 0xed0cb0445, 0xc8114e6745, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/sock_posix.go:137 +0x364
net.socket(0x6f58f8, 0x3, 0x2, 0x1, 0x0, 0xc82044d200, 0xc74160, 0x0, 0xc74160, 0xc82044d200, ...)
	/usr/local/go/src/net/sock_posix.go:89 +0x429
net.internetSocket(0x6f58f8, 0x3, 0xc74160, 0x0, 0xc74160, 0xc82044d200, 0xed0cb0445, 0x114e6745, 0xb24fe0, 0x1, ...)
	/usr/local/go/src/net/ipsock_posix.go:161 +0x153
net.dialTCP(0x6f58f8, 0x3, 0x0, 0xc82044d200, 0xed0cb0445, 0xc8114e6745, 0xb24fe0, 0xc820054a20, 0x0, 0x0, ...)
	/usr/local/go/src/net/tcpsock_posix.go:171 +0x12b
net.dialSingle(0xc8201f6870, 0xc740f8, 0xc82044d200, 0xed0cb0445, 0x114e6745, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:371 +0x40c
net.dialSerial.func1(0xed0cb0445, 0x114e6745, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:343 +0x75
net.dial(0x6f58f8, 0x3, 0xc740f8, 0xc82044d200, 0xc820450fa0, 0xed0cb0445, 0x114e6745, 0xb24fe0, 0x0, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:40 +0x60
net.dialSerial(0xc8201f6870, 0xc82046f970, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:345 +0x7d0
net.(*Dialer).Dial(0xc8203a1b90, 0x6f58f8, 0x3, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:239 +0x512
github.com/rivine/rivine/modules/gateway.(*Gateway).dial(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/conn.go:30 +0xe7
github.com/rivine/rivine/modules/gateway.(*Gateway).managedConnect(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:424 +0x507
github.com/rivine/rivine/modules/gateway.(*Gateway).managedPeerManagerConnect(0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:12 +0x174
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager.func1(0xc8201aa060, 0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:133 +0xe2
created by github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:134 +0xbc1

goroutine 14 [sleep]:
time.Sleep(0x1dcd65000)
	/usr/local/go/src/runtime/time.go:59 +0xf9
github.com/rivine/rivine/modules/blockcreator.(*BlockCreator).SolveBlocks(0xc820152d80)
	/go/src/github.com/rivine/rivine/modules/blockcreator/proofofblockstake.go:40 +0x4bf
created by github.com/rivine/rivine/modules/blockcreator.New
	/go/src/github.com/rivine/rivine/modules/blockcreator/blockcreator.go:126 +0xb00

goroutine 15 [select, 1 minutes, locked to thread]:
runtime.gopark(0x82d558, 0xc820022f28, 0x6f4cf0, 0x6, 0x18, 0x2)
	/usr/local/go/src/runtime/proc.go:262 +0x163
runtime.selectgoImpl(0xc820022f28, 0x0, 0x18)
	/usr/local/go/src/runtime/select.go:392 +0xa67
runtime.selectgo(0xc820022f28)
	/usr/local/go/src/runtime/select.go:215 +0x12
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal1_unix.go:279 +0x32c
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 16 [chan receive, 1 minutes]:
main.startDaemon.func8(0xc820055140, 0xc8200afde0)
	/go/src/github.com/rivine/rivine/rivined/daemon.go:252 +0x3d
created by main.startDaemon
	/go/src/github.com/rivine/rivine/rivined/daemon.go:255 +0x1c6f

goroutine 153 [select]:
net.(*netFD).connect.func1(0xc820054a20, 0xc820640460, 0xc8202703c0)
	/usr/local/go/src/net/fd_unix.go:109 +0xf4
created by net.(*netFD).connect
	/usr/local/go/src/net/fd_unix.go:116 +0x26d

goroutine 66 [sleep]:
time.Sleep(0xb2d05e00)
	/usr/local/go/src/runtime/time.go:59 +0xf9
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).request(0xc8203180f0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:107 +0x11e
created by github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).Start
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:47 +0x9f

goroutine 67 [select]:
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).check(0xc8203180f0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:57 +0x157
created by github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext.(*Heartbeat).Start
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/ext/heartbeat.go:48 +0xc1

goroutine 68 [IO wait]:
net.runtime_pollWait(0xc73e50, 0x72, 0xc820208360)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8201d6a70, 0x72, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8201d6a70, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8201d6a10, 0xc820208360, 0x8, 0x8, 0x0, 0xc6e050, 0xc82000e088)
	/usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc820028290, 0xc820208360, 0x8, 0x8, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/net.go:172 +0xe4
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/frame.(*BasicTransport).Read(0xc8200b0e00, 0xc820208360, 0x8, 0x8, 0x8, 0x0, 0x0)
	<autogenerated>:139 +0x82
io.ReadAtLeast(0xc74948, 0xc8200b0e00, 0xc820208360, 0x8, 0x8, 0x8, 0x0, 0x0, 0x0)
	/usr/local/go/src/io/io.go:297 +0xe6
io.ReadFull(0xc74948, 0xc8200b0e00, 0xc820208360, 0x8, 0x8, 0x8, 0x0, 0x0)
	/usr/local/go/src/io/io.go:315 +0x62
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/frame.(*BasicTransport).ReadFrame(0xc8200b0e00, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/frame/transport.go:34 +0xc3
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.(*Session).reader(0xc820161040)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/session.go:276 +0xad
created by github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.NewSession
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/session.go:104 +0x5b4

goroutine 69 [chan receive, 1 minutes]:
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto.(*Session).Accept(0xc820161040, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/proto/session.go:159 +0x67
github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado.(*sessionAdaptor).Accept(0xc820208390, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/muxado/adaptor.go:33 +0x5f
github.com/rivine/rivine/modules/gateway.(*peer).accept(0xc82019ebc0, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:58 +0x66
github.com/rivine/rivine/modules/gateway.(*Gateway).threadedListenPeer(0xc82006ef20, 0xc82019ebc0)
	/go/src/github.com/rivine/rivine/modules/gateway/rpc.go:159 +0x149
created by github.com/rivine/rivine/modules/gateway.(*Gateway).addPeer
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:69 +0x88

goroutine 70 [select, 1 minutes]:
github.com/rivine/rivine/modules/gateway.(*Gateway).threadedListenPeer.func1(0xc820055440, 0xc82006ef20, 0xc8200554a0, 0xc82019ebc0)
	/go/src/github.com/rivine/rivine/modules/gateway/rpc.go:144 +0x3ca
created by github.com/rivine/rivine/modules/gateway.(*Gateway).threadedListenPeer
	/go/src/github.com/rivine/rivine/modules/gateway/rpc.go:156 +0x138

goroutine 79 [select, 1 minutes]:
net.(*netFD).connect.func1(0xc820054a20, 0xc8201eb490, 0xc820288c00)
	/usr/local/go/src/net/fd_unix.go:109 +0xf4
created by net.(*netFD).connect
	/usr/local/go/src/net/fd_unix.go:116 +0x26d

goroutine 148 [IO wait]:
net.runtime_pollWait(0xc73cd0, 0x77, 0xc8201b7088)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8200baa70, 0x77, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitWrite(0xc8200baa70, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:82 +0x36
net.(*netFD).connect(0xc8200baa10, 0x0, 0x0, 0xc730a8, 0xc820440000, 0xed0cb0463, 0x11b9fab8, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:127 +0x28e
net.(*netFD).dial(0xc8200baa10, 0xc74160, 0x0, 0xc74160, 0xc8202adcb0, 0xed0cb0463, 0xc811b9fab8, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/sock_posix.go:137 +0x364
net.socket(0x6f58f8, 0x3, 0x2, 0x1, 0x0, 0xc8202adc00, 0xc74160, 0x0, 0xc74160, 0xc8202adcb0, ...)
	/usr/local/go/src/net/sock_posix.go:89 +0x429
net.internetSocket(0x6f58f8, 0x3, 0xc74160, 0x0, 0xc74160, 0xc8202adcb0, 0xed0cb0463, 0x11b9fab8, 0xb24fe0, 0x1, ...)
	/usr/local/go/src/net/ipsock_posix.go:161 +0x153
net.dialTCP(0x6f58f8, 0x3, 0x0, 0xc8202adcb0, 0xed0cb0463, 0xc811b9fab8, 0xb24fe0, 0xc820054a20, 0x0, 0x0, ...)
	/usr/local/go/src/net/tcpsock_posix.go:171 +0x12b
net.dialSingle(0xc820074b40, 0xc740f8, 0xc8202adcb0, 0xed0cb0463, 0x11b9fab8, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:371 +0x40c
net.dialSerial.func1(0xed0cb0463, 0x11b9fab8, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:343 +0x75
net.dial(0x6f58f8, 0x3, 0xc740f8, 0xc8202adcb0, 0xc82000a600, 0xed0cb0463, 0x11b9fab8, 0xb24fe0, 0x0, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:40 +0x60
net.dialSerial(0xc820074b40, 0xc82046f4b0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:345 +0x7d0
net.(*Dialer).Dial(0xc8201b7b90, 0x6f58f8, 0x3, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:239 +0x512
github.com/rivine/rivine/modules/gateway.(*Gateway).dial(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/conn.go:30 +0xe7
github.com/rivine/rivine/modules/gateway.(*Gateway).managedConnect(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:424 +0x507
github.com/rivine/rivine/modules/gateway.(*Gateway).managedPeerManagerConnect(0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:12 +0x174
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager.func1(0xc8201aa060, 0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:133 +0xe2
created by github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:134 +0xbc1

goroutine 152 [IO wait]:
net.runtime_pollWait(0xc73c10, 0x77, 0xc8201bd088)
	/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8206404c0, 0x77, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitWrite(0xc8206404c0, 0x0, 0x0)
	/usr/local/go/src/net/fd_poll_runtime.go:82 +0x36
net.(*netFD).connect(0xc820640460, 0x0, 0x0, 0xc730a8, 0xc82048ef80, 0xed0cb0472, 0x11f692d8, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:127 +0x28e
net.(*netFD).dial(0xc820640460, 0xc74160, 0x0, 0xc74160, 0xc8203f92c0, 0xed0cb0472, 0xc811f692d8, 0xb24fe0, 0xc820054a20, 0x0, ...)
	/usr/local/go/src/net/sock_posix.go:137 +0x364
net.socket(0x6f58f8, 0x3, 0x2, 0x1, 0x0, 0xc8203f9200, 0xc74160, 0x0, 0xc74160, 0xc8203f92c0, ...)
	/usr/local/go/src/net/sock_posix.go:89 +0x429
net.internetSocket(0x6f58f8, 0x3, 0xc74160, 0x0, 0xc74160, 0xc8203f92c0, 0xed0cb0472, 0x11f692d8, 0xb24fe0, 0x1, ...)
	/usr/local/go/src/net/ipsock_posix.go:161 +0x153
net.dialTCP(0x6f58f8, 0x3, 0x0, 0xc8203f92c0, 0xed0cb0472, 0xc811f692d8, 0xb24fe0, 0xc820054a20, 0x0, 0x0, ...)
	/usr/local/go/src/net/tcpsock_posix.go:171 +0x12b
net.dialSingle(0xc82063e240, 0xc740f8, 0xc8203f92c0, 0xed0cb0472, 0x11f692d8, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:371 +0x40c
net.dialSerial.func1(0xed0cb0472, 0x11f692d8, 0xb24fe0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:343 +0x75
net.dial(0x6f58f8, 0x3, 0xc740f8, 0xc8203f92c0, 0xc82048ef60, 0xed0cb0472, 0x11f692d8, 0xb24fe0, 0x0, 0x0, ...)
	/usr/local/go/src/net/fd_unix.go:40 +0x60
net.dialSerial(0xc82063e240, 0xc820674cc0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:345 +0x7d0
net.(*Dialer).Dial(0xc8201bdb90, 0x6f58f8, 0x3, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/dial.go:239 +0x512
github.com/rivine/rivine/modules/gateway.(*Gateway).dial(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/conn.go:30 +0xe7
github.com/rivine/rivine/modules/gateway.(*Gateway).managedConnect(0xc82006ef20, 0xc8201860e0, 0x14, 0x0, 0x0)
	/go/src/github.com/rivine/rivine/modules/gateway/peers.go:424 +0x507
github.com/rivine/rivine/modules/gateway.(*Gateway).managedPeerManagerConnect(0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:12 +0x174
github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager.func1(0xc8201aa060, 0xc82006ef20, 0xc8201860e0, 0x14)
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:133 +0xe2
created by github.com/rivine/rivine/modules/gateway.(*Gateway).permanentPeerManager
	/go/src/github.com/rivine/rivine/modules/gateway/peersmanager.go:134 +0xbc1

goroutine 149 [select]:
net.(*netFD).connect.func1(0xc820054a20, 0xc8200baa10, 0xc820196ea0)
	/usr/local/go/src/net/fd_unix.go:109 +0xf4
created by net.(*netFD).connect
	/usr/local/go/src/net/fd_unix.go:116 +0x26d

Crash on duplicate block creation

version: v0.0.0-46-g9bb0c65

Critical error: ERROR: an invalid block was submitted: block already present in database
Please submit a bug report here: https://github.com/rivine/rivine/issues
panic: Critical error: ERROR: an invalid block was submitted: block already present in database
Please submit a bug report here: https://github.com/rivine/rivine/issues


goroutine 16 [running]:
panic(0x46f0c0, 0xc4203a9830)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/rivine/rivine/build.Critical(0xc420455e38, 0x2, 0x2)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/build/critical.go:17 +0x111
github.com/rivine/rivine/persist.(*Logger).Critical(0xc4201cf940, 0xc420455e38, 0x2, 0x2)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/persist/log.go:37 +0xd0
github.com/rivine/rivine/modules/blockcreator.(*BlockCreator).submitBlock(0xc420152fc0, 0x558ac2b00c3039c0, 0xecd619195272297b, 0xcd697a2953af9fef, 0x4015afc78318d087, 0xa2, 0x1, 0x1, 0x58072bfb, 0x0, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/blockcreator/blockmanager.go:28 +0x25e
github.com/rivine/rivine/modules/blockcreator.(*BlockCreator).SolveBlocks(0xc420152fc0)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/blockcreator/proofofblockstake.go:34 +0x288

Transaction fee rules

Currently the transaction fee is 10 coins. This way too high and maybe think about a variable scheme.

Provide auto completion for rivinec

As rivinec is to be used as a terminal client it would be useful to have autocompletion.

For bash that would as simple as following the instructions here: https://github.com/spf13/cobra/blob/master/bash_completions.md

For zsh it's a bit more complicated, but pretty do-able and powerful once setup. An example of how to do that can be found in work I did for go-swagger: go-swagger/go-swagger@5f1a486 ; That file is manually written, but you can automate most of it using some regexp magic combined with the output of cmd... --help.

This is more of a 'polishing' feature though, so perhaps not priority for now. But will come in handy once the client is to be used on a daily basis by humans.

improve gateway code

After a discussion with the Sia developers, it seems like I might be able to start improving the gateway code together with them, as a lot of what I had in mind was already on their TODO list since a long time. Their entire list can be found on https://github.com/NebulousLabs/Sia/projects/2

Here is what I propose to be working on, such that this can be merged asap to rivine:

  • Integrate xtaci/smux into gateway, replacing muxado v1, which is outdated, not supported and potentially buggy (issue #41);
  • Improve documentation for the encoding, rpc and messaging. Right now you have to almost reverse engineer what all the RPC operations are, how they are decoded and how they work. Having documentation for this would help a lot for anyone to quickly jump into this code. On top of that it would also allow us to write clients in different languages easily, if this would be needed;
  • making sure two different networks running our code will not have their peer networks hooking together (this would be done by having some kind of Network ID. related to NebulousLabs/Sia issue 1480);
  • have a unique ID per gateway (and thus node and peer), this would allow gateways to detect whether they are connecting to themselves or not (which is possible in case they are from the same home network, and thus having the same external IP) (this unique ID would not be persistent, and has nothing to do with storing peers, it is only used to identify connections to itself);
  • any TODO that I can tackle while doing other issues, or that seem priority enough (for example a list of todo's can be found at modules/gateway/gateway.go#L71-L135);

Other tasks that are nice to have:

I'm in direct contact in a private chat with the 3 relevant core developers, so they will give me feedback as I go and help ensure the quality. In the future we might want to do extra changes just in rivine, as those would break Sia. However I think this would be enough to get us started, and is all in line with the sia version 1.3, planned to be released in 3-6 months.

checkRevertApply fail

In debug mode, there is an extra check that is sometimes done at random. One of the checks is checkRevertApply.

checkRevertApply reverts the most recent block, checking to see that the consensus set hash matches the hash obtained for the previous block. Then it applies the block again and checks that the consensus set hash matches the original consensus set hash.

The check with the parent failes because the 10 maturitydelayed coin fee transactions are not good synced for this check. (there is an offset of 1 transaction):

When printing:

		fmt.Println("->")
		// The bucket is a prefixed bucket - add all elements to the tree.
		return b.ForEach(func(k, v []byte) error {
			fmt.Println("k ", k, " v ", v)
			tree.Push(k)
			tree.Push(v)
			return nil
		})

->
k [197 166 251 209 127 249 153 226 222 131 244 165 6 230 150 162 179 112 147 52 43 193 81 192 129 57 163 254 166 180 152 6] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [81 80 17 220 49 137 153 24 40 7 12 79 15 35 191 170 130 24 67 252 186 189 89 250 44 60 13 239 228 168 151 68] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [117 181 39 238 56 145 227 53 150 156 19 102 126 215 134 127 189 74 132 185 199 84 127 233 37 88 51 236 37 105 51 161] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [24 201 235 127 55 254 48 99 93 159 80 161 255 183 255 244 118 92 227 226 135 124 2 79 22 77 254 203 194 51 235 72] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [43 42 117 204 97 152 161 39 87 37 206 144 88 170 52 11 167 118 181 58 156 208 130 78 100 78 161 0 102 143 126 153] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [102 129 110 31 51 82 114 168 249 145 203 177 181 24 161 186 125 46 23 151 70 209 194 245 173 197 52 24 215 166 28 250] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [237 149 27 226 233 38 74 104 169 31 72 51 36 214 0 78 249 136 79 182 75 108 69 181 97 137 191 254 34 184 50 132] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [72 229 32 237 163 158 96 53 236 197 28 98 93 9 240 189 235 46 15 32 191 1 201 8 68 54 106 74 72 22 33 47] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [82 72 101 171 192 252 180 88 15 50 90 195 10 62 231 0 4 243 30 175 27 9 112 154 94 40 141 30 189 148 142 118] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [196 182 240 166 40 166 46 150 235 104 150 65 19 17 118 45 48 219 40 15 48 78 159 116 201 198 124 64 88 250 20 148] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
tree.Root() e72e80083ba5907420dad383d48661d3d5d305df6bb2b8a527f93422974f4082

->
k [41 219 173 109 136 193 51 99 17 112 91 232 220 74 184 87 159 52 245 188 210 241 81 71 68 45 165 210 246 131 184 152] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [197 166 251 209 127 249 153 226 222 131 244 165 6 230 150 162 179 112 147 52 43 193 81 192 129 57 163 254 166 180 152 6] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [81 80 17 220 49 137 153 24 40 7 12 79 15 35 191 170 130 24 67 252 186 189 89 250 44 60 13 239 228 168 151 68] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [117 181 39 238 56 145 227 53 150 156 19 102 126 215 134 127 189 74 132 185 199 84 127 233 37 88 51 236 37 105 51 161] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [24 201 235 127 55 254 48 99 93 159 80 161 255 183 255 244 118 92 227 226 135 124 2 79 22 77 254 203 194 51 235 72] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [43 42 117 204 97 152 161 39 87 37 206 144 88 170 52 11 167 118 181 58 156 208 130 78 100 78 161 0 102 143 126 153] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [102 129 110 31 51 82 114 168 249 145 203 177 181 24 161 186 125 46 23 151 70 209 194 245 173 197 52 24 215 166 28 250] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [237 149 27 226 233 38 74 104 169 31 72 51 36 214 0 78 249 136 79 182 75 108 69 181 97 137 191 254 34 184 50 132] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [72 229 32 237 163 158 96 53 236 197 28 98 93 9 240 189 235 46 15 32 191 1 201 8 68 54 106 74 72 22 33 47] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
->
k [82 72 101 171 192 252 180 88 15 50 90 195 10 62 231 0 4 243 30 175 27 9 112 154 94 40 141 30 189 148 142 118] v [11 0 0 0 0 0 0 0 82 183 210 220 200 12 210 228 0 0 0 230 107 190 150 56 174 14 153 134 65 220 159 170 1 128 193 90 16 113 177 118 119 132 205 218 17 173 60 29 48 159 166]
tree.Root() 1132f47fe8072ede9c642ee0d13b9560650e57a42221108b9fcec75765d93c96

gateway looks for outbound ip address

When having 2 devices on the same network, the outbound address is seen different than the internal ip.
When peering, the device want to peer with the outbound address and the internal ips and get confused.

mutex lock when trying to sync new node

How I get to a locked node while syncing

I have a node with 11000 ish blocks
I create a new node (HW) with clean setup (no folders) and generate a new wallet
I added the allready generating nodes address to the gateway list of the new node.
All well when syncing for around 1600 blocks (is not specific)
Then there is a double lock:

Last part of the rivined debug:

t.CoinOutputSum()
0
Demote5041975 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 261 true
!Lock5298963 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 21 true
Demote5300958 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 115 true
DemotedUnlock5301004 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 117 true
DemotedUnlock5042158 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 266 true
!Lock5041384 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 200 true
inputSum
0
t.CoinOutputSum()
0
Demote5041975 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 261 true
!Lock5298963 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 21 true
Demote5300958 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 115 true
DemotedUnlock5301004 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 117 true
DemotedUnlock5042158 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 266 true
!Lock5041384 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 200 true
inputSum
0
t.CoinOutputSum()
0
Demote5041975 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 261 true
!Lock5298963 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 21 true
Demote5300958 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 115 true
DemotedUnlock5301004 /home/niko/go/src/github.com/rivine/rivine/modules/transactionpool/update.go 117 true
DemotedUnlock5042158 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 266 true
!Lock5041384 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/accept.go 200 true
inputSum
0
t.CoinOutputSum()
0
RLock5138726 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/synchronize.go 182 true
RLock5074045 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/consensusset.go 270 true
RLock5074045 /home/niko/go/src/github.com/rivine/rivine/modules/consensus/consensusset.go 270 true

The prints are done in demotemutex.go but its printing -1 of the stack its on, so printing the place where the mutex lock is called.

When killing the deamon and restarting, It went till the last block and keep synced.

Easier chain configuration

Currently the chain parameters are defined in types/constants.go. When you want to start a chain with different parameters, this only leaves the option of forking and modifying the code. I think there are two options, either we make this configurable in an external config file or we make the rivine code importable in a different project and allow for easy injection of these variables. Lets go for the second option.

Arbitrary data example from an external program

Add some api calls to make it easy to use the arbitrary data in a transaction. The maximum size will be probably set to 1kB.
Maybe we need to have some type definitions so we can allready have some metadata of the data in the blob.
The minimum fee allowed on a transaction will depend on the size of that transaction and thus depend a lot on the size of this arbitrary data.

Panic accessing the stats

2017/02/16 10:38:03 http: panic serving 127.0.0.1:62430: runtime error: index out of range
goroutine 59 [running]:
net/http.(*conn).serve.func1(0xc4200a3b00)
	/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:1491 +0x12a
panic(0x49fde0, 0xc42000c120)
	/usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:458 +0x243
github.com/rivine/rivine/modules/wallet.(*Wallet).BlockStakeStats(0xc420190480, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/rob/workspace/go/src/github.com/rivine/rivine/modules/wallet/transactions.go:122 +0x3c3
github.com/rivine/rivine/api.(*API).walletBlockStakeStats(0xc420071140, 0x785c20, 0xc420218410, 0xc4200ee960, 0x0, 0x0, 0x0)
	/Users/rob/workspace/go/src/github.com/rivine/rivine/api/wallet.go:142 +0x1ba
github.com/rivine/rivine/api.(*API).(github.com/rivine/rivine/api.walletBlockStakeStats)-fm(0x785c20, 0xc420218410, 0xc4200ee960, 0x0, 0x0, 0x0)
	/Users/rob/workspace/go/src/github.com/rivine/rivine/api/api.go:182 +0x66
github.com/rivine/rivine/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc420204780, 0x785c20, 0xc420218410, 0xc4200ee960)
	/Users/rob/workspace/go/src/github.com/rivine/rivine/vendor/github.com/julienschmidt/httprouter/router.go:344 +0x8a1
github.com/rivine/rivine/api.RequireUserAgent.func1(0x785c20, 0xc420218410, 0xc4200ee960)
	/Users/rob/workspace/go/src/github.com/rivine/rivine/api/api.go:97 +0xba

Version: 1df1bbd

This was on a locked wallet and no explorer module.

Smart contract definition

Before we can even start thinking about implementing "smart contracts", we need to have a clear definition what a smart contract is and what capabilities a smart contract should have

Extra robustness through sidechains

The idea is to interconnect some chains with each other.
This can be some chains from rivine with a different genesis block but also with external chains.
Interconnections can be done ones per hour, day, week depending on the fee it would take to interconnect.
This way all separate chain can work together without removing the performance per chain separately.

Replace custom version code with semver

Right now there is a lot of custom version code, while it just looks like semantic versioning. In which case it would be better to simply use the semver package. The biggest reason is to lower the maintenance, even though the versioning code is simple enough that we might just want to not-fix this issue. However, right now we keep the versions stored as string, and have to parse it each time we want to interact with it, which is not super ideal. But again, it's cheap enough that this might as wel be neglectable. But be aware of dead of a thousand cuts.

Crash on consistency check

panic: Wrong number of coins: 960000000000000000000000000
total: 960000000000000000000000000
expected: 0
 expected is bigger: 960000000000000000000000000

goroutine 16 [running]:
panic(0x48f180, 0xc420310340)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/rivine/rivine/modules/consensus.manageErr(0xc42029ad20, 0x777460, 0xc420310340)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/consistency.go:20 +0x5b
github.com/rivine/rivine/modules/consensus.checkCoinCount(0xc42029ad20)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/consistency.go:104 +0x5c7
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).checkConsistency(0xc420170480, 0xc42029ad20)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/consistency.go:170 +0x42
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).maybeCheckConsistency(0xc420170480, 0xc42029ad20)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/consistency.go:188 +0x6a
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).applyUntilBlock(0xc420170480, 0xc42029ad20, 0xc420126240, 0x0, 0x0, 0x0, 0x8eb96e47e17c0700, 0x454ba6932ae23b6b)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/fork.go:98 +0x16f
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).forkBlockchain(0xc420170480, 0xc42029ad20, 0xc420126240, 0x5c78c5185eaf4884, 0x95a93fcd76d705c6, 0x18af8b3c3c019717, 0x95b4e9b21aede0ab, 0xa2, 0x1, 0x1, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/fork.go:111 +0xac
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).addBlockToTree.func1(0xc42029ad20, 0x574a30, 0xc42029ad20)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/accept.go:153 +0x19b
github.com/rivine/rivine/vendor/github.com/NebulousLabs/bolt.(*DB).Update(0xc42010e960, 0xc42051da60, 0x0, 0x0)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/vendor/github.com/NebulousLabs/bolt/db.go:595 +0xb5
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).addBlockToTree(0xc420170480, 0x5c78c5185eaf4884, 0x95a93fcd76d705c6, 0x18af8b3c3c019717, 0x95b4e9b21aede0ab, 0xa2, 0x1, 0x1, 0x5806216d, 0x0, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/accept.go:177 +0xe9
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).managedAcceptBlock(0xc420170480, 0x5c78c5185eaf4884, 0x95a93fcd76d705c6, 0x18af8b3c3c019717, 0x95b4e9b21aede0ab, 0xa2, 0x1, 0x1, 0x5806216d, 0x0, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/accept.go:254 +0x184
github.com/rivine/rivine/modules/consensus.(*ConsensusSet).AcceptBlock(0xc420170480, 0x5c78c5185eaf4884, 0x95a93fcd76d705c6, 0x18af8b3c3c019717, 0x95b4e9b21aede0ab, 0xa2, 0x1, 0x1, 0x5806216d, 0x0, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/consensus/accept.go:287 +0x10c
github.com/rivine/rivine/modules/blockcreator.(*BlockCreator).submitBlock(0xc42015b0e0, 0x5c78c5185eaf4884, 0x95a93fcd76d705c6, 0x18af8b3c3c019717, 0x95b4e9b21aede0ab, 0xa2, 0x1, 0x1, 0x5806216d, 0x0, ...)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/blockcreator/blockmanager.go:16 +0x107
github.com/rivine/rivine/modules/blockcreator.(*BlockCreator).SolveBlocks(0xc42015b0e0)
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/blockcreator/proofofblockstake.go:34 +0x288
created by github.com/rivine/rivine/modules/blockcreator.New
    /Users/rob/workspace/go/src/github.com/rivine/rivine/modules/blockcreator/blockcreator.go:126 +0x469

Authorized addresses

To comply with KYC and AML rules, it should be possible to create chains that only allow authorized addresses to transfer coins. To make this work we need:

  • A (hardcoded at first) list of authorization services that are allowed to authorize new addresses.
  • A special transaction to authorize an address
  • Validate if the unlockhashes of coinoutputs are authorized addresses
  • Send the change of a transaction to the unlockhash from the coininputs

design a Distributed Exchange

When we talk about colored coins, it would be nice to be able to trade them. If we make a distributed exchange, the trade would be more tamper proof and and less change to fail.

update original sia documentation where desired

Currently there are still several markdown documentation files that seem to have remained unchanged since the sia fork. Often that is fine as the documentation might still be up to date. In other places that might not be the case. On top of that naming of commands and clients have changed since and should probably be updated to reflect their new hard fork state. (eg: rivinec/README.md: /[Ss]iac/[Rr]ivinec/g.

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.