Development Update #67

Fixed a lot of bugs.

The top levels, the gui and json are not as polished as lower levels (blockchain/crypto). I have not even looked at some of this code and discovering new things. There were things implemented, I didnt know we had working and things that needed to be cleaned up.

People have reported that port 6000 is X11. Skycoin to prevent blocking by ISPs is not bound to particular port. DHT assumes port 6000. So disable DHT and then make sure you have people in your peer list, or manually connect to server. Once you are finding peers through PEX, you dont need DHT and port does not matter.


There are API commands I did not know about, that I just found in the code. Someone should document the API/json urls

You can test these on

Get blockchain head, header: Get block as JSON Get range of blocks as JSON

Unspent Outputs:

Get Network Connections: (renamed from /api/network/connections )

Make a network connection to peer: (renamed from /api/network/connections )

Blockchain Progress:

This is the highest block you know about. If you are not connected to anyone it will be zero, I think. There appears to be off by one error.


In /src/gui/wallet.go there is a URL handler that returns the JSON serialization of the unspent output set. Let us look at how that is implemented.

We define a function, that handles the URL request. Grabs the outputs from Visor and then returns the JSON or 404 error.

// Returns the outputs for a wallet
func getOutputsHandler(gateway *daemon.Gateway) http.HandlerFunc {
   return func(w http.ResponseWriter, r *http.Request) {
      ret := gateway.Visor.GetUnspentOutputReadables(gateway.V)
      SendOr404(w, ret)

Then we add the handler to :

func RegisterWalletHandlers(mux *http.ServeMux, gateway *daemon.Gateway) {}...

//get set of unspent outputs
mux.HandleFunc("/outputs", getOutputsHandler(gateway))

So it is about 7 lines of code, to expose the outputs as JSON. The “readable” for converting internal Skycoin objects to json is in /src/visor/readable.go

Looking at the godoc for Visor, we can see the functions it exposes

Visor is one of the dirty libraries that need to be refactored and cleaned up. However it is very clean already. Some cleanup steps could be - Moving blocks into a blockstore library that visor pulls in and removing block serialization/saving to disc from visor - Removing the remaining functions in “spend.go” and moving into wallet handler - Fixing the unit tests - Exposing the full blockchain client API over network with Golang/RPC (partially implemented?) - Moving the readable to its own library or subfolder - Deleting json_rpc.go (which is empty) - Decide if the JSON api web server should be in visor, instead of gui or if it should be its own library or should stay where it is - Move the functionality out of /src/daemon into /src/visor and deprecate the existing daemon for the skywire daemon, making visor top level instead of daemon being top level

There is no transaction history. You can look at the blocks and the transactions using json API. You can check balances by looking for your address in the unspent output set ( ).

The coin history and Skycoin blockchain exporer, should
Translation bounty: 15 SKY (1180 words)

Discuss this post on telegram

Skycoin Telegram