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:
That is, a Table smart contract has: no of rows, no of columns, and a data offset where the data START to reside. …
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).
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 VirtualMachine.java class. …
Using a local testnet database, I exported 5000 blocks with the command:
java -cp <rsk.jar> co.rsk.cli.tools.ExportBlocks 718000 722999 --testnet > testnetblocks.txt
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.
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…
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.
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.
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…