...by Daniel Szego
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Monday, May 14, 2018

Solidity and Truffle Tips and Tricks - starting geth --rpc error

If you start to sync a chain with the --rpc parameter and you get different error messages, like: 
"Error starting protocol stack: listen tcp bind: Only one usage of each socket address (protocol/network address/port) is normally permitted." or simply memory null pointer exception that does not say too much, than check if something is running as well that blocks the 8545 port, or any other ports that you were using for geth. For me the problem was that Parity was installed in that machine as well, configured as starting automatically and was using exactly the same port.  

Sunday, May 13, 2018

Notes on highly secure software architectures

The basic architectural elements of Blockchain give the possibility for realizing highly trusted and secure computational architecture, even if they are not manifested in a decentralized peer 2 peer manner. Elements of the secure computation are the basic cryptographic elements, like public and private key infrastructures or hash functions. Services of such a highly secure architecture might be: - secure computation: for certain critical computations the requirement to sign either the computation or the result with multiply keys of multiply actors. 
- secure data structure: for the data structures to be organized in a hash structure, implying hash pointers showing to the result of other hashed data elements, providing a highly hacker resistant data structure. 
- proof of work: putting proof of work into the system implying that the security system will be more resistant against exhaustive search attacks. 
- secure architecture: combining the previous elements together to form a highly secure, highly hacker resistant software architecture. 

Wednesday, May 9, 2018

Solidity and Truffle Tips and Tricks - Compilation failed

If you have a solidity project that runs in one truffle environment but you get an error message in another installed truffle environment, like "Compilation failed", the problem might be that the truffle environment is not up-to-date. You can simply force a reinstall to make your truffle up-to-date. Like with the following command:  

npm install -g truffle

Sunday, May 6, 2018

Blockchain and network science

Blockchain and distributed ledger systems are pretty much natural targets of network science. They are based on networks regarding both the infrastructure and the transaction graph networks. On top most current network are public, meaning there is a really huge number of data available for analysis. Network science investigations could be carried out on two or three level. 

1. On the infrastructure side, analysis of the P2P topology combining with the changing of the topology and consensus mechanism that can be analyzed. Some consensus mechanisms like Ripple or from Stellar are very much dependent on the network structure. Other classical algorithms like proof of work are perhaps less sensible, however certain network structures make different attacks vectors easier, whilst others guarantee almost the theoretical limits of Byzanzine fault tolerance. 

2. On the transaction side, the dynamics of the different transactions which is important. This is theoretically similar to the cash-flow of the classical systems, the difference is here however that the dynamics of the transaction flow is much faster and all the information is public, implying a much broader investigation possibility. 

3. Last but not least, the blockchain can be analyzed with the help of different other systems. Examples might be the correlation of the blockchain or the transaction flow of two blockchains and perhaps the exchange rates of the two cryptocurrencies. Another option might be to analyze the connections between a blockchain solution and a traditionally centralized www system.  

Blockchain and GDPR

Making a Blockchain solution GDPR compatible is not an easy task. What you can consider is the following: 
- Do not store personal data on the Blockchain. If so, you do not have too much problems with the GDPR, like as an example if you generate keys randomly that are used directly or indirectly as addresses and you store the personal identity for each key in a centralized registry that can be deleted or modified, you can be GDPR conform. 
- You can try to store implied information of the personal data, like hash or hash of the hash of the personal data, or encrypted personal data. If the data is deleted, the actual data will be deleted behind the hash and you might as well have a new blockchain entry to show that the given hash value was deleted consciously. 
- physical deleting from the Blockchain is not really supported. However some blockchain platforms support something as archiving the blockchain at certain stages. Instead of archiving, you might as well imagine simply to delete the history. Certainly, it means security of the blockchain will be surely much smaller, but it might be acceptable in certain situations. 

Solidity and Truffle Tips and Tricks - delete build folder

If you use solidity with truffle, sometimes it is a good idea to delete the entire build subdirectory, it will recreated anyway as you make a new compile. As an example if you get the following error message: "Attempting to run transaction which calls a contract function, but recipient address  ... is not a contract address" the resolution is simply delete and recreate the build folder. It happens regularly if you copy paste your solidity code for example between your local truffle environment and for instance remix.  

Tuesday, May 1, 2018

Geth commands summarized to handling accounts

Some of the most important accounts are summarized to handle accounts or wallets:

- personal.listAccounts - listing existing accounts from the local wallet and local user
- web3.accounts - listing all the accounts
- personal.newAccount() - creating new account - generating private / public key and protecting with passphrase - stored under datadir/keystore
- eth.coinbase - coinbase account
- personal.lockAccount('account_name') - locking an account
- personal.unlockAccount('account_name', 'passphrase') - locking an account
- personal.importRawKey(keydata, passphrase) - importing a
- eth.getBalance(''account') - getting ethereum balance for the account