Saturday, 30 November 2019

How To Launch An Unstoppable Website On IPFS In Under 3 Minutes!

How To Launch An Unstoppable Website On IPFS In Under 3 Minutes!

Thursday, 28 November 2019

How to stringify JSON for hashing and easy comparison in Java?

Or how to implement in Java?
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.fasterxml.jackson.databind.SerializationFeature;

    public static void stringify(final String jsonPath) throws Exception {
        final byte[] bytes = Files.readAllBytes(Paths.get(jsonPath));
        final String jsonData = new String(bytes);

        ObjectMapper om = new ObjectMapper();
        om.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
        Map map = om.readValue(jsonData, HashMap.class);
        String json = om.writeValueAsString(map);

Friday, 11 October 2019

Running the Solace VMR as an API Gateway on Ubuntu

Today's post is a step by step process to run the Solace VMR as an API Gateway.
There are several options for API gateways out there, but nothing comes close to the flexibility of the VMR.
This was tested on Ubuntu 18.

Run the VMR as a docker container
Execute the following: docker run -d --net=host --shm-size=2g --security-opt apparmor:unconfined --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard

You can use docker ps -a, or docker logs -f solace to check after a couple of minutes that all is well. Note that under Ubuntu you need to configure apparmor in unconfined mode for the VMR to run properly. Finally, also on Ubuntu, --net=host helps with network configuration if you test your set-up locally using a local micro-service.
I am using DockStation, a great Linux tool to manage containers.

Solace VMR configuration
Open a browser to point to http://localhost:8080 and login using the admin / admin credentials. Follow the steps to create a simple catch-all api gateway:
  • Click on "Message VPNs" then "default", then "services"
  • In the "REST" section, select "gateway", then "apply"
  • Under "Queues", create a queue "CATCH_ALL_Q", apply then select
  • Under "Subscriptions", create two subs: "GET/>" and "POST/>", those will catch all GET and POST requests
  • Under "Client Connections", select "REST", create "Delivery End Point" named "CATCH_ALL_DP", click "Enabled" and apply
  • Then select and go to "Queue Bindings", add one, and select "CATCH_ALL_Q"
  • Create a REST consumer "CATCH_ALL_RC", "Enabled" and select the host of your computer with port 9505, then apply. Under "Client Connections" the Operational State should be up if you have your micro-service listening on that port
In order to test it, execute "curl http://localhost:9000/ping" assuming you have a micro-service listening on port 9505, the VMR will act as an API Gateway - and forward the request to the micro-service. Voila!

Sunday, 6 October 2019

How to change folder's colors on Ubuntu 18

sudo apt-get update && sudo apt-get install folder-color

Sunday, 11 November 2018

A step-by-step guide for deploying a simple Solidity contract on a test network

This post relates to a simple smart contract written in Solidity deployment on the Ropsten test network. It is a step-by-step deployment, giving as much detail as I could patiently gather..


"MetaMask is a bridge that allows you to visit the distributed web of tomorrow in your browser today. It allows you to run Ethereum dApps right in your browser without running a full Ethereum node.".
In a nutshell, it allows you to create an address and request ETH for testing. Install the extension for Chrome or Mozilla and set it up as follows. Start with the password creation (in my test I used 12345678910!)
You will now see this screenshot:
Then accept the various terms and conditions Finally, set up the secret words and back them up (spray talk duck avocado access put lens slice bench donor wise survey) - and the next screen put them back in the same order - and confirm. You will still see the following.
Now for the purpose of this exercise, select the "Ropsten Test Network" and click on "deposit" and select "Test Faucet" and click "GET ETHER" A new tab opens to and select "reqest 1 ether from faucet" (or few times) A link like will appear once the transaction(s) has(have) been validated and mined - you will see the number of ETH appear on your METAMASK main window for the "Ropsten Test Network"


Now on to the Solidity contract and coding/deployment/testing on the test network. Head towards Under the tab 'run' select (if not already) 'environment' to be 'Injected Web' - and the test account we created should appear with the number of ETH requested by Faucet. We just need to write and deploy a contract... What about a simple contract to store the hash of a public document to validate the fact that it has not been modified?
pragma solidity ^0.4.7;

contract HashedDocsDemo {
    mapping (string => string) urlsDocHashMaps;
    function setHash(string url, string hash) public validStr(url) validStr(hash) {
        urlsDocHashMaps[url] = hash;
    function checkHash(string url, string hash) public view validStr(url) validStr(hash) returns(bool) {
        string memory storedHash = urlsDocHashMaps[url];
        return keccak256(bytes(storedHash)) == keccak256(bytes(hash));
    modifier validStr(string str) {
        bytes memory bstr = bytes(str); 
        require(bstr.length != 0, "invalid string");
Once the contract has been pasted in the Remix IDE, go to "run" and click on deploy.
A window will popup and "click" confirm.
Another URL will be displayed (like - same thing - wait for mining and effective contract deployment ("This transaction has been included into BlockNo #4400698 And will be reflected in a shortwhile")
We can finally interact with the contract - still in Remix - in the Run tab Enter any URL with any hash - then "transact" - same pop-up - confirm a new link is displayed:
Wait for confirmation - then you can look at the Remix ide, at the bottom, details of the transaction that went through and "decoded input" ....

Friday, 21 September 2018

Fun with Ethereum

Hi, If you want to play with Ethereum, locally, I would suggest to read the following blogs: Demystifying Ethereum Private Blockchain in less than 4 minutes! and Running a “quick” Ethereum private network for experimentation and testing
I run Ubuntu 16 it was a breeze to download the code, compile it, and run a mining node locally, as well as submitting transactions using web3.

Blog Archive