Tuesday, March 27, 2018

Truffle execute external script call contract function

errors:

 * Error: VM Exception while processing transaction: out of gas
 * Error: Cannot create instance of YourContract; no code at address
 * Error: sender account not recognized
 * Error: invalid address

If you get some of these errors while trying to execute contract function from truffle script, here is proper way to do it:

Monday, March 26, 2018

Truffle external scripts working example

If you getting errors bellow while trying to execute your truffle external script continue to read.

errors:

TypeError: Cannot read property 'apply' of undefined 

exception at require.js:128:1 

TypeError: fn is not a function 

For some reason it was quite difficult to find solution how to run external script. After some time I finally have figure it out so I'm sharing it with world:


Thursday, March 22, 2018

Smart Contracts and Ethereum solidity

WHAT ARE SMART CONTRACTS?

I have opportunity to work on interesting smart contract project. In that respect I decided that I will write something about this _hot topic on my blog. So, what's smart contract anyways?

In 1994, Nick Szabo, a legal scholar, and cryptographer, realized that the decentralized ledger could be used for smart contracts, otherwise called self-executing contracts, blockchain contracts, or digital contracts. In this format, contracts could be converted to computer code, stored and replicated on the system and supervised by the network of computers that run the blockchain. This would also result in ledger feedback such as transferring money and receiving the product or service.

Smart contracts help you exchange money, property, shares, or anything of value in a transparent, conflict-free way while avoiding the services of a middleman.

Can laws be written on smart contacts. What world would that be? Programmers will become lawyers? Imagine code reviews and testing on that contracts.

HOW ARE THIS CONTRACT EXECUTED


Most smart contracts written today are based on Ethereum blockchain. Ethereum blockchain is world computer that can execute smart contracts. Smart contracts are written in language called Solidity (current version is: 0.4.21). Most popular framework to work with smart contract is called Truffle. Contracts are serving as back-end for application, and front-end is written using web3. Web3 is new way of building web apps called decentralized web. Basically there is no classical back-end, only front-end with decentralized smart contracts.