Category Archives: Uncategorized

New Month’s Resolutions: Abril 2018

A new month in progress. Time to review the previous month’s resolutions:

– Continue SimpleGo [pending]
– Continue Exeth [complete] see repo
– Continue HuskyJS [complete] see repo
– Continue RskApi [complete] see repo
– Continue BlockchainJ [complete] see repo
– Continue BlockchainSharp [complete] see repo
– Continue SimpleEvm [complete] see repo
– Continue TensorSharp [complete] see repo
– Continue AprendiendoSolidity [pending]
– Continue SharpGo [pending]
– Resume Machine Learning Mentorship [pending]
– Continue Solidity Mentorship [partial] see repo

Additionally, I worked on

– Add example to SimpleDT [complete] see repo
– Create evmasm [complete] see repo
– Improving RskUtils [complete] see repo
– Add https support to SimpleJsonRpc [complete] see repo
– Improve Bitcoin sample SimpleGA [complete] see repo
– Continue RSharp [complete] see repo [complete] see repo
– Continue CrysSharp [complete] see repo
– Improve LllJs [complete] see repo
– Improve Emv2Code [complete] see repo
– Improve SolidityCompiler [complete] see repo

My new month’s resolutions:

– Continue SimpleGo
– Continue Exeth
– Continue HuskyJS [complete] see repo
– Continue RskApi
– Continue BlockchainJ
– Continue BlockchainSharp
– Continue SimpleEvm
– Continue TensorSharp
– Continue AprendiendoSolidity
– Continue SharpGo
– Continue RSharp

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

 

Scaling Ethereum/RSK: Multi Blockchains (1)

Next Post

I already wrote some proposals in my other post series:

Connecting Blockchains
Multi-Blockchains in Ethereum/RSK
Offchain Transactions in Ethereum/RSK

commenting on using two or more blockchains (homegeneous or heterogeneous), and offchain transactions. They are alternative ways to explore solutions to scalability, with a fresh start and pursuing the simplest path in each idea.

After reviewing the multi-blockchain, now I think a have a simpler path. First, this proposal is about having many HOMOGENEOUS blockchains, Ethereum/RSK-like ones. One is the mainchain, and we could have n additional blockchains:

The main blockchain has the initial ether amount of ether to use. For sake of clarity, let’s start with a main blockchain, the blockchain zero, has an initial stock of 100M ethers (in case of RSK network, it could be the 21M smart bitcoins backed by the 21M bitcoins of the BTC mainnet),

All accounts are the same in all networks: same private, public keys, addresses. So, if you have control of a control in blockchain zero, you can use the same account IN OTHER blockchain.

But the secondary blockchains starts with 0 balance in each account.

The second idea is to have inter-chain transactions, to transfer from one account in source blockchain, to the SAME account in target blockchain:;

An special bridge account is used. There is a bridge account in mainchain FOR EACH secondary chain. So, if you transfer value in blockchain 0, to bridge account corresponding to secondary blockchain 3, THEN a similar transaction will appear in this secondary blockchain, transferring the same amout from the dedicated BRIDGE account. To allow such transfer, each bridge account in SECONDARY blockchain starts with 100M of initial balance,

If there are 10 secondary blockchain, then there are 10 BRIDGE ACCOUNTS in the main blockchain (with initial 0 balance), and ONE BRIDGE ACCOUNT in each secondary blockchain (with 100M inital balance),

You also can send a transaction to a secondary blockchain, transferring value back to the mainchain:

The motivation is to have scalabilty: if the mainchain is overloaded, we can use a secondary blockchain. Also, the different blockchain could have different gas price, and maybe other difference in contract execution cost.

We could use a free graph of blockchains. But limiting the proposal to a hierarchical schema with only one level simplifies the discussion. The transactions between secondary blockchains are not allowed: only main to secondary one are supported. And no generation of new Ether is allowed in the secondary blockchains. These restrictions exist to have a better control of the total amout of value.

I could imagine a secondary blockchain by world region, country, even by vertical market. Or competing blockchains, in gas price and contract execution cost. The client software (that is, a dapp, a mobile application) could simplify the user experience, doing some of these transfer inter-blockchain in automatic.

But, how to reflect one transaction to bridge in one blockchain, to other transaction in the target blockchain? My next post will descibe a simple solution, to be discussed and reviewed. But I think it is a good starting point, to avoid the complications of some atomic swap and alike implementions.

Stay tuned!

Stay tuned!

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

 

 

 

Building A Blockchain (16)

Previous Post

In recent months I have been busy working on the RSK project. It’s time to write about my personal blockchain projects:

https://github.com/ajlopez/BlockchainSharp
https://github.com/ajlopez/SimpleBlockchain
https://github.com/ajlopez/RskSharp

Currently, the most active one is the C# project. I added one project:

https://github.com/ajlopez/BlockchainJ

in Java. The experience I gained written all this code (using test-driven design, as usual) gaves me a clear idea of what is involved when building a blockchain. Writing my own implementations gave me better understanding of the parts related to the creation of a blockchain. And now the RSK project (Java core implementation) is public, I’m free to relate this work with an existing full implementation.

The key points to be written are:

  • Entities
  • States
  • Virtual machine to run smart contracts
  • Encoders
  • Consensus
  • Validation logic
  • Inter-node communication
  • Expose node state to external applications

The base entities are:

  • Block
  • Transaction
  • Account

The states to be kept are:

  • Blockchain
  • Account state
  • Contract state

My projects are oriented to have smart contracts, a la Ethereum. One reason to have a virtual machine is be agnostic of host programming language. I think that having a way of run smart contract that is independent of the programming language used in each project, is an interesting feature. So, I should define:

  • Virtual machine opcodes
  • Transient (memory) storage
  • Persistent storage

I need encoders for blocks, transactions and account states. The encoded entities are used in the network communication, local storage, and in the hash calculation. For example, when I have to transmit a block I encoded it. And if I want to send the block to another node, I should encoded the block before transmission. And the encoded data is the basis for hash calculation.

The inter-node communication includes:

  • Message definitions
  • Message and handshake protocol
  • Peer-discovery protocol

Validation logic refers to:

  • Validation of blocks
  • Sign of transaction and its validation

Consensus logic has:

  • Selection of the next block
  • Run of the transactions, updating the accounts/contracts states

The exposure of a node state is implemented in Bitcoin and Ethereum using JSON RPC (Remote procudure call), usually exposed via http. In this way, the node can be accessed by external technologies implemented in different technologies (JavaScript blockchain ecosystems are the more popular).

Followin Ethereum ideas, one entity I implemented many times is a trie. I think my implementations are very simple and effective. I hope to be able to write in the next posts about those implementations.

Stay tuned!

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

 

 

 

Artificial Intelligence: Links And Resources (41)

Previous Post
Next Post

More artificial intelligence, fewer screens: the future of computing unfolds
http://www.zdnet.com/article/artificial-intelligence-the-new-user-interface-and-experience/

Why AI Isn’t The Robot Apocalypse For Jobs
https://www.forbes.com/sites/oracle/2017/09/08/why-ai-isnt-the-robot-apocalypse-for-jobs/#57c21d85189b

Exploring the Artificial Intelligence Ecosystem: AI, Machine Learning, and Deep Learning
https://dzone.com/articles/exploring-the-artificial-intelligence-ecosystem-fr

Google’s Research In Artificial Intelligence Helps In Preventing Blindness Caused by Diabetes
https://www.forbes.com/sites/janakirammsv/2017/09/05/googles-research-in-artificial-intelligence-helps-in-preventing-blindness-caused-by-diabetes/#94b7ebd56e16

TensorFlow 1.0 unlocks machine learning on smartphones
https://www.infoworld.com/article/3162413/artificial-intelligence/tensorflow-10-unlocks-machine-learning-on-smartphones.html

The Business of Artificial Intelligence – Harvard Business Review
https://hbr.org/cover-story/2017/07/the-business-of-artificial-intelligence

Our Fear of Artificial Intelligence – MIT Technology Review
https://www.technologyreview.com/s/534871/our-fear-of-artificial-intelligence/

Artificial Intelligence | edX
https://www.edx.org/micromasters/columbiax-artificial-intelligence

Stay tuned!

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

Blockchain: Links And Resources (47)

Previous Post
Next Post

Underhanded Solidity Coding Contest
http://u.solidity.cc/

Solidity CRUD- Part 1
https://medium.com/@robhitchens/solidity-crud-part-1-824ffa69509a

Más usos para la tecnología de las monedas virtuales
https://www.clarin.com/ieco/usos-tecnologia-monedas-virtuales_0_B11ezoUSW.html

What is Bitcoin Mining?
https://www.bitcoinmining.com/

Announcing “Around the Block”: a Documentary Series about the Minds Behind the Blockchains
https://medium.com/paratii/announcing-around-the-block-a-documentary-series-about-the-minds-behind-the-blockchains-b5f5bfeec12e

Potential network disruption
https://bitcoin.org/en/alert/2017-07-12-potential-split

Formal Verification of Ethereum Smart Contracts
http://securify.ch/

Functional Alternative to Ethereum (in Haskell)
https://github.com/CharlesHoskinson/ConsenSys–Fae

Don’t Get CoinDashed — How to Secure Your Token Sale
https://blog.enigma.co/dont-get-coindashed-how-to-secure-your-token-sale-a5e247944234

A Brief History of Blockchain: An Investor’s Perspective
https://medium.com/indian-thoughts/a-brief-history-of-blockchain-an-investors-perspective-387c440ad11c

Stay tuned!

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

Learning Ethereum/RSK (1)

Next Post

I joined the @RskSmart development team at the beginning of last year (February 2016). I was an experienced software developer, but without knowledge of Bitcoin, Ethereum, blockchains and related topics. So, I started studied a lot, to grasp the project, the objectives, the initial code, and its challenge.

In this post series, I want share with you what I learned, and comment some books/resources that could help me (I didn’t read everything but now, with my current experience, they look as something that add value).

The first thing to understand is the blockchain concept. It is the “new kid on the block” (pun intended 🙂 and it is a core concept to understand, in order to grasp Ethereum and RSK projects. The most succesful implementation of a blockchain is Bitcoin, so, as a developer, you will gain a lot of insight if you read about that project.

The main source for Bitcoin as software developers, is:

Mastering Bitcoin (second edition repo)

a masterpiece by Andreas Antonopolous (personal site)(twitter)(wikipedia page)(youtube channel)(blog)

I read:

This book is mostly intended for coders. If you can use a programming language, this book will teach you how cryptographic currencies work, how to use them, and how to develop software that works with them. The first few chapters are also suitable as an indepth introduction to bitcoin for noncoders—those trying to understand the inner workings of bitcoin and cryptocurrencies.

And I learned a lot from this book. The Bitcoin implementation of a blockchain is explained clearly, from a software developer point of view, so it is a good introduction to this new brave world. It has chapters about: How Bitcoin Works, Bitcoin CoreAddresses, Wallets, Transactions, Advanced Transactions and Scripting, Blockchain, Bitcoin Network, Mining and Consensus, Alternative Blockchains, Applications, Bitcoin Security, Bitcoin Improvement Proposals.

He is working on an new book Masrtering Ethereum, that it could be the MUST BE READ book if you want to be an Ethereum developer.

If you understand Bitcoin and its related ecosystem, you will be in a better position to manage Ethereum and @RSKSmart projects. And RSK has code that related Bitcoin network with its own.

Next posts: more books, concepts and resources

Stay tuned!

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

 

New Storage in Ethereum/RSK (1)

Next Post

An Ethereum Virtual Machine manages a contract storage, in cells, each one having a 32-byte address and a 32-byte value. A simplified view:

But in RSK implementation, there is a new feature: a cell can contain an arbitrary byte array data:

This feature is exposed by new methods included into the original Repository interface:

    /**
     * Put a value in storage of an account at a given key
     *
     * @param addr of the account
     * @param key of the data to store
     * @param value is the data to store
     */
    void addStorageRow(byte[] addr, DataWord key, DataWord value);

    void addStorageBytes(byte[] addr, DataWord key, byte[] value);

    /**
     * Retrieve storage value from an account for a given key
     *
     * @param addr of the account
     * @param key associated with this value
     * @return data in the form of a <code>DataWord</code>
     */
    DataWord getStorageValue(byte[] addr, DataWord key);

    byte[] getStorageBytes(byte[] addr, DataWord key);

The new methods are addStorageBytes and getStorageBytes. It was relatively easy to add, because the internal structure that represents the storage (a trie) is already prepared to store arbitrary data.

RSK implementation is using this features from precompiled contracts, and it is not available from EVM contracts.

In this post series, I want to describe new features that could be added to RSK storage, now it has byte array support.

Stay tuned!

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