Image for post
Image for post
Photo by Jan Antonin Kolar on Unsplash

These days I am practicing programming smart contracts in Solidity using TDD. There are several projects I am working on: some DeFi projects, a programmatic faucet, user login and onboarding, personal notes, some games. One of the projects already has something to show: I have been able to upload (image) files to RSK’s testnet.

One comment: a blockchain is not the more appropriate place to save files, at least an Ethereum-like. The upload of a file could cost many millions of gas units. And the retrieval is not the fastest. …

Based on an idea by bguiz published in RSK reseach forum: Crazy Idea: New opcodes for relational DB like data reads and writes, I was writing Solidity code to explore an alternative implementation in an Ethereum-like blockchain. I don’t add opcodes because these are scarce, and adding them could broke compability with Ethereum. My project is BDTables.

The base idea is to have an smart contract representing a database-like table with rows and columns:

Image for post
Image for post
Table smart contract storage

That is, a Table smart contract has: no of rows, no of columns, and a data offset where the data START to reside. …

Image for post
Image for post

These years I was programming a log, using TDD (Test-Driven Programming), to keep me trained in design and developer skills. To me, TDD is a great workflow to discover emergence design solutions, to simple and complex domains. One of my preferred domains is blockchain, and I wrote tons of code in Java, C# and JavaScript, even Solidity smart contracts. The top example is my personal blockchain project in Java (see also my published posts).

I learned about blockchain thanks to my work in RSK. The company flag product is an Ethereum-like blockchain, connected to the Bitcoin blockhain.

In an Ethereum-like blockchain (like RSK or my personal project BlockchainJ) the smart contracts have a linear storage, composed by cells thafied by a key.

In case of storage, the key is a data word of 32 bytes (a kind of unsigned big number) and the value is also a data word (well, in RSK and my implementation, the value could be any byte array, is up to the consumer code the interpretation of that value).

Image for post
Image for post
Smart contract storage

The storage looks linear BUT only the values that are not zero are saved. …

I’m very proud of my favorite personal project BlockchainJ: build a Blockchain in Java, from scratch, using TDD (Test-Driven Development). Previous posts:

Building a Blockchain: Introduction
Building a Blockchain: Main Entities
Building a Blockchain: Serialization
Building a Blockchain: Key Value Stores
Building a Blockchain: Subroutines in the Virtual Machine
Building a Blockchain: Towards Beam Synchronization

It’s based in Ethereum, so it supports smart contracts. I’m using the same bytecodes, to keep compability with the ecosystem (like Solidity compilers and wallets).

Today, I want to describe my current implementation of how to execute an smart contract in the class. …

Image for post
Image for post
Photo by Esther Jiao on Unsplash

Some months ago, I wrote about Command Line Tools for RSK Node; now those tools are included in the latest RSKJ release (under the package with name

Using a local testnet database, I exported 5000 blocks with the command:

java -cp <rsk.jar> 718000 722999 --testnet > testnetblocks.txt

These days, I wrote new commands in JavaScript to analyze that info, specially to obtain the blocks mined by each miner account.

Counting the Blocks

Using count.js, I executed:

node count testnetblocks.txt

The output was:

no blocks 5000 no transactions 250849 average no transactions per block 50.1698 no uncles 6461 average no uncles per…

Suppose that you have an online web site, social network, or game. Your users connect with your server(s) using a mobile, web or desktop client application. Each user has a nickname, and should provide credentials to initiate a session with your server.

Now, you want to give them tokens, as they complete tasks, activities, games, receive likes, or provide content to your system. That tokens resides in an Ethereum-like blockchain. I want to describe a workflow that allow your users to participate in the blockchain.

Blockchain Sign Up

A user must sign up to participate in the blockchain activities. He/she has a nickname…

I’m very enthusiastic about my personal open source project BlockchainJ, a blockchain written in Java using TDD. To me, it’s very interesting (and a lot of fun) to design, write and explore ideas and code using the Test-Driven Development workflow. I think that you can understand any problem if you write a solution to it. And to write a blockchain is a not trivial project, but also one that can be achieved. Every day, I wrote few lines of test and production code, to complete the task. Now, I can run many nodes, communicate them, mine blocks, execute transfer transactions…

Image for post
Image for post
Photo by Antoine Dautry on Unsplash

These days, I gave a talk about Zero Knowledge Proof, my slides at: “Gentle” Introduction to Zero Knowledge Proof for Blockchain Developers. In this post, I want to share my main sources for that talk.

A “Gentle” Introduction

First, there is an excellent collection of resources at Awesome zero knowledge proof (zkp) by MatterLabs.

A similar resource, but as a site, is at Zero-Knowledge Proofs.

The initial paper to read (if you are interested in historical notes) at The Knowledge Complexity of Interactive Proof-Systems

A good introduction to that paper and zkp ideas at Zero Knowledge Proofs: An illustrated primer.

The initial paper…

Image for post
Image for post
Photo by Markus Spiske on Unsplash

Usually, every day I practice programming using TDD (Test-Driven Development) workflow: few minutes adding a minimal feature to one of my personal projects. One of them is writing a blockchain in Java. Based on ideas from Ethereum blockchain, it has a virtual machine to execute smart contracts. Today, I implemented subroutines in that virtual, adding three opcodes and their behavior, according Ethereum Improving Proposal 2315.

The relevant commits:

You can see…

Angel Java Lopez

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store