Angel \”Java\” Lopez on Blog

June 11, 2017

Running an Ethereum/RSK Node

Filed under: Blockchain, Ethereum, Open Source Projects, RSK — ajlopez @ 2:43 pm

The RSK public testnet was launched, and the core source was opened. If don’t know what RSK is, please visit:

http://rsk.co/

Technically, it is a fork of Ethereum (Java source), with a 2-way peg with Bitcoin, and merge-mining capabilities. You can run your own node, alone, in your own network, or join it to the public testnet. There are instructions at thecore project github wiki:

https://github.com/rsksmart/rskj/wiki

In this post, I want to describe my usual workflow, to run experiments with RSK implementation and ideas (disclaimer:I’m a member of RSK development team, but this is a description of my personal experiments). First, you have to downloadthe source code from:

https://github.com/rsksmart/rskj

Currently, the most updated published version is at branch Ginger:

https://github.com/rsksmart/rskj/tree/ginger

Also, you can clone the repository into your own one. Once you have the source code, you can compile using IntelliJ  deaCommunity Edition, or use the command line:

.\gradlew build shadow -x testnet

(I’m usually work with Windows, in Linux, Mac, you must use the normal /). More details at:

https://github.com/rsksmart/rskj/wiki/Compile-and-run-a-RSK-node-locally

The shadow option is to build a jar with all the dependencies. The -x test skips the run of test from build step. The command generates a .jar file in one subdirectory. Then, you can execute

cd rskj-core\build\libs
java -Drsk.conf.file=<path> -cp rskj-core-0.2.0-GINGER-all.jar co.rsk.Start

What config file to use and to configure it? More info at:

https://github.com/rsksmart/rskj/wiki/How-to-initialize-RSK-node-configuration-file-settings

An initial config file at:

https://github.com/rsksmart/rskj/blob/master/rskj-core/src/main/resources/config/rsk-sample.conf

You must set a unique nodeId for your instance. You can generate a nodeId using the command line:

java -cp rskj-core-0.2.0-GINGER-all.jar co.rsk.GenNodeKeyId

It dumps a JSON file to console. You must copy the private key and the node id, to your config file:

# Private key of the peer
nodeId = 66cf57...
privateKey = 46f850...

You only need to copy the privateKey to run the node, but you can include the nodeId also for your own reference. The other line to configure is the coinbase secret:

# this string is computed
# to be eventually the address
# that get the miner reward
coinbase.secret = mytreasure

You must put an arbitrary string here.

To allow the CORS (Cross-Origin Resource Sharing) for your JSON RPC (Remote Procedure Call), set the cors property:

rpc {
    enabled = true		# you can disable rpc
    port = 4444
    
    cors = "*.rsk.co"    # you can put "localhost here"

The RPC capability is only used to query the node, and disabling it does not interfere with the normalwork of the node. How the node knows how to connect to the public Testnet? There is a list of bootstrap nodes:

peer {
	discovery = {
        # if peer discovery is off
        # the peer window will show
        # only what retrieved by active
        # peer [true/false]
        enabled = true

        # List of the peers to start
        # the search of the online peers
        # values: [ip:port]
        ip.list = [
            "bootstrap01.testnet.rsk.co:50505",
            "bootstrap02.testnet.rsk.co:50505",
            "bootstrap03.testnet.rsk.co:50505",
            "bootstrap04.testnet.rsk.co:50505"
        ]

to use in what is call the “peer discovery” process. You can disable them if you want only to use your own node in your network.

If you want to run MANY local nodes, you must have MANY configuration file. In these files, adjust also the properties:

    # Peer for server to listen for incoming connections
    # 50505 for testnet
    listen.port = 50505 # ie to 50506

and the already mentioned:

rpc {
    enabled = true
    port = 4444		# ie to 4445

Additionally, you can set your own network id, so your local o networked nodes only work for this network:

    # Network id
    networkId = 777  # ie to 42

You can also specify in each of your nodes the active nodes to connect, instead of using peer discovery and bootstrap public nodes:

    # Boot node list
    # Use to connect to specific nodes
    active = [    
        #{ 
        #    ip = 11.22.33.44
        #    port = 50505
        #    nodeId = e437a483...
        #}
    ]

As usual, you can set the machine name instead of IP number, using the same property ip.

If you want your node mine new blocks, change these properties to true:

# miner options
miner {
    server.enabled = false  # change to true
    client.enabled = false	# change to true

If you change only the server.enabled property to true, you can expose the new block to merge mining process, but this feature is beyond the scope of this post.

Any other question? You can visit the RSKJ gitter channel:

https://gitter.im/rsksmart/rskj

Enjoy!

RSK is hiring! Interested?

https://twitter.com/RSKsmart/status/872169805515718657

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

 

June 6, 2017

New Month’s Resolutions: June 2017

Filed under: C Sharp, Domie, JavaScript, NodeJs, Open Source Projects, Vyu, Wordie — ajlopez @ 11:17 am

A new month begins, time to write down the monthly resolutions. But first, a review of the past ones:

– Continue RskSharp [pending]
– Continue SimpleBlockchain [complete] see repo
– Continue BlockchainSharp [pending]
– Continue ChineseP [pending]
– Continue TensorSharp [pending
– Continue RSharp [complete] see repo

I also worked on:

– Improve AjDrawJS [complete] see repo
– Improve AjTalkJS [complete] see repo
– Improve SimpleForth [complete] see repo
– Improve ClojJS Clojure in JavaScript [complete] see repo
– Additional sample for SimpleGA, genetic algorithms [complete] see repo
– Experiments on RSKJ form [complete] see repo
– Create wordie, literate programming language [complete] see repo
– Create domie, a DOM-like for JavaScript testing [complete] see repo
– Create vyu, a vue.js-like framework [complete] see repo

My new resolutions:

– Continue RskSharp
– Continue SimpleBlockchain
– Continue BlockchainSharp
– Continue ChineseP
– Continue TensorSharp
– Continue RSharp
– Experiments with RSKJ fork
– Continue Vyu
– Continue Domie
– Continue Wordie

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

May 24, 2017

Launch of RSK TestNet

Filed under: Blockchain, Open Source Projects, RSK — ajlopez @ 11:05 am

The project started on 2015. I’m a member of dev team since one year and two months. Past Monday, the RSK TestNet was presented to the public, after running for months in private mode. The announce was made in Consensus 2017:

http://www.coindesk.com/events/consensus-2017/
http://media.rsk.co/rsk-releases-ginger-the-open-source-public-testnet/

The intructions to participate in the TestNet:

https://github.com/rsksmart/rskj/wiki

The main open source code repo at:

https://github.com/rsksmart/rskj

You can check the TestNet status (some nodes) at:

http://stats.rsk.co/

The project is oriented to run an autonomous Ethereum network that allows the execution of smart contracts, using bitcoins to pay for the cost of running those contracts. There is a 2-way peg system to transfer from your BTC account to your own RSK account, and viceversa. The exchange is one to one. This is one of the pillars of the project: leverage Bitcoin network to use smart contracts. Another interesting pillar: RSK uses merge-mining, associated with miners that produces Proof of Work for RSK blocks using the PoW for BTC.

If the smart contract word is new to you, check the project:

https://www.ethereum.org/

I’m sharing resources and writing about blockchain (including code examples) in:

https://ajlopez.wordpress.com/category/blockchain/
https://ajlopez.wordpress.com/category/rsk/

I hope to write more posts describing the RSK project.

Nos leemos!

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

May 8, 2017

New Month’s Resolutions: May 2017

Filed under: AjTalk, Blockchain, C Sharp, Ethereum, JavaScript, NodeJs, Open Source Projects, RSK — ajlopez @ 11:51 am

There is a new month, time to write the new resolutions. First, a review of the previous ones:

– Continue RskSharp [complete] see repo
– Continue SimpleBlockchain [complete] see repo
– Continue Solidity Compiler [pending]
– Continue ChineseP [complete] see repo
– Continue TensorSharp [complete] see repo
– Continue RSharp [complete] see repo
– Continue SimpleForth [pending]

Additionally, I was working on:

– Continue BlockchainSharp [complete] see repo
– Start Neurum, neural networks in C# [complete] see repo
– Improve AjTalkJS, Smalltalk interpreter in JavaScript [complete] see repo
– Improve SimpleProlog, Prolog interpreter in JavaScript [complete] see repo
– Improve AjDrawJS [complete] see repo

New month’s resolutions:

– Continue RskSharp
– Continue SimpleBlockchain
– Continue BlockchainSharp
– Continue ChineseP
– Continue TensorSharp
– Continue RSharp

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

March 7, 2017

New Month’s Resolutions: March 2017

Filed under: JavaScript, C Sharp, Open Source Projects, NodeJs, Haskell, Erlang, Go, Solidity — ajlopez @ 11:30 am

A new month begins, and it’s time to write down my new resolutions. First, a review of the February resolutions:

– Improve SharpGo [complete] see repo
– Improve BlockchainSharp [pending]
– Improve SimpleBlockchain [complete]
– Continue Solidity Compiler [complete] see repo
– Continue ChineseP [pending]
– Improve ErlSharp [complete] see repo

Additionally, I worked on:

– Start RskSharp [complete] see repo
– Start TensorSharp [complete] see repo
– Improve AjDrawJs [complete] see repo
– Improve SimpleForth [complete] see repo
– Improve CrysSharp [complete] see repo
– New Bitcoin example in SimpleGA [complete] see repo
– Improve Husky, my Haskell interpreter [complete] see repo
– Improve SimpleLisp [complete] see repo
– Improve CrysJS [complete] see repo

My new resolutions:

– Continue RskSharp
– Continue SimpleBlockchain
– Continue Solidity Compiler
– Continue ChineseP
– Continue TensorSharp

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 5, 2017

New Month’s Resolutions: February 2017

Filed under: Blockchain, C Sharp, JavaScript, NodeJs, Open Source Projects, Solidity — ajlopez @ 11:42 am

The second month of the year just started, time to write my monthly resolutions, but first, let’s review the past ones:

– Improve CrysSharp [pending]
– Improve SharpGo [complete] see repo 
– Improve BlockchainSharp [complete] see repo
– Improve SimpleBlockchain [pending]
– Continue Solidity Compiler [complete] see repo
– Continue ChineseP [pending]
– Continue PegSharp [pending]

Also, I did a minor improvement on ErlSharp see repo.

My new resolutions:

– Improve SharpGo 
– Improve BlockchainSharp
– Improve SimpleBlockchain
– Continue Solidity Compiler
– Continue ChineseP
– Improve ErlSharp

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

January 10, 2017

New Month’s Resolutions: January 2017

Filed under: C Sharp, Go, JavaScript, NodeJs, Open Source Projects, Solidity — ajlopez @ 11:20 am

A new year started, it’s time to write my resolutions, but first, a review of the previous ones:

– Improve CrysSharp [pending
– Improve SharpGo  [complete] see repo
– Improve BlockchainSharp [pending]
– Improve SimpleBlockchain [pending]
– Continue Solidity Compiler [complete] see repo
– Continue ChineseP [pending]
– Continue PegSharp [pending]

I had personal issues (Spanish), but now I in a better position to pursue new resolutions.

My January resolutions are:

– Improve CrysSharp
– Improve SharpGo 
– Improve BlockchainSharp
– Improve SimpleBlockchain
– Continue Solidity Compiler
– Continue ChineseP
– Continue PegSharp

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

December 8, 2016

New Month’s Resolutions: December 2016

Filed under: Blockchain, Crystal, Go, JavaScript, NodeJs, Open Source Projects, Solidity — ajlopez @ 10:23 am

The last month of the year. Time to review past month’s resolutions:

– Improve CrysSharp [pending]
– Improve SharpGo [complete] see repo
– Improve BlockchainSharp [pending]
– Improve SimpleBlockchain [pending]
– Continue Solidity Compiler [complete] see repo
– Continue ChineseP [pending]
– Continue PegSharp [complete] see repo

My new month’s resolutions

– Improve CrysSharp
– Improve GoSharp 
– Improve BlockchainSharp
– Improve SimpleBlockchain
– Continue Solidity Compiler
– Continue ChineseP
– Continue PegSharp

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

December 1, 2016

Building A Blockchain (15)

Filed under: Bitcoin, C Sharp, Ethereum, FinTech, JavaScript, NodeJs, Open Source Projects — ajlopez @ 10:28 am

Previous Post

One interesting issue to solve, in my blockchains implementations (C#, JavaScript/NodeJS), is the node intercommunication. The nodes should interchange data, like new blocks, new transactions, status messages…. And, for a running node, it should discover other nodes in the network to be its peers. The process is named: peer discovery.

I want to start to write down some ideas:

– Each node has a node id, and a network id, so other nodes can check that info to accept the node as its peer or not

– A node could have configured a hardcoded list of initial nodes, to use as peers

– But it could have another list: a list of special nodes that knows other nodes in the network. This nodes are not peers of the first node. They are helpers, node registries, that knows other peers in the network, that can be used as peer by a new node in the network. Usually, this lists is not a list of IPs, but of machines by name, in a DNS controlled by the blockchain network infrastructure.

When a new node starts to run, it communicate its existence to this list of peer registry nodes, and actively query them for initial peers.

Each node has a number of maximum peers to use and connect. When one of these connections drops, or it is not suitable for be a peer node, the node tries other known peers, or ask new peers to the registry servers.

One way to ensure a good distribution of connection, is identify the known nodes in zones (maybe, node id modulus a low number). When a node of zone 2 needs peers, the registry servers sends to it peers of zones 1 and 3. In this way, the node start to be connected with more and more peers. But avoiding to know ALL the peers in the network: only some peers of its adjacent zones. This is for security reasons: if the FULL list of peers is not general available, it’s better to avoid global network attacks.

As usual, I should design all these with TDD, guided by simplicity and initial use cases.

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

November 28, 2016

MultiCurrency in Ethererum/RSK (1)

Filed under: Bitcoin, Blockchain, Ethereum, FinTech, Open Source Projects, RSK — ajlopez @ 9:26 am

In my post serie about connecting blockchains, I’m writing about exchange (value one to one, without change of value) between two popular heterogeneous blockchains (BitCoint and Ethereum/RKS). I’m a member of the development team of @RSKSmart, but those posts are personal opinions: the real work by the team was not published yet.

Another path to explore, is to have, in the SAME blockchain, many cryptocurrencies. My thought is that it could be done in Ethereum/RSK.

In Ethereum, there are accounts with state, and the account state includes the cryptocurrency balance for the account. There is a “default” currency, the Ether. But I think this model could be easily extended.

Each account has a currency, too. The “default” cryptocurrency should be the Ether, but some accounts could be created with ANOTHER cryptocurrency as default currencty. Then, they form a separated set of accounts. One account with currency X, can transfer and can borrow value from another account with THE SAME CURRENCY X. In this way, the new set of account could leverage all the infrastructure of Ethereum, to have a pool of accounts that manage a “coloured” currency value, separated from the default/main one.

In the next post, I want to write about:

– How to define a new currency
– How to create an account with a new currency
– How to transfer between accounts with the same currency
– How to transfer between accounts with different currencies

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Older Posts »

Blog at WordPress.com.