Notes on Buffered Channels

  • They are channels with capacity to hold one or more values
    buffChan := make(chan string, 10)

  • They don't require both the sender and receiver to be available at the same instant

  • They have different blocking rules

    • A receive will block only if there is no value on the channel to receive
    • A send will block only if there is no available buffer to place the value being sent.

Continue reading "Notes on Buffered Channels"

Hyperledger Chaincode Best Practices

Smart contract or chaincode developers should adhere to strict development guidelines and rules.

With Turing complete languages like GoLang becoming the defacto standard for chaincode development and high interest from developers to get into this exciting space.

I am writing down some of the Don'ts and best practices to consider while developing your chaincode.

Use simple and clear statements to write the flow logic of the contracts

Read After Write

func addToAccount(stub shim.ChaincodeStubInterface, account *string, amount int){
balance,_ := stub.GetState(*account)
stub.PutState(*account, balance + amount)

Continue reading "Hyperledger Chaincode Best Practices"

Notes on Bitcoin target representation

Bitcoin has a weired representation for the target encoded into field nBits of each block header


The target value is the limit that a miner need to find a lower block hash than in a PoW


  • The target is set so that a block is mined roughly every 10 minutes
  • The initial target was set as 00000000ffff0000000000000000000000000000000000000000000000000000 or 0x1d00ffff
    which can be checked from here

Continue reading "Notes on Bitcoin target representation"

Notes on Bitcoin Transactions

A transaction is a transfer of value that is broadcast to the network and collected into blocks by miners.

A transaction typically references a previous transaction output to new transaction inputs. The bitcoin input values are mapped to the bitcoin output values.

Bitcoin uses a counter intuitive UTXO (Unspent transaction output) model unlike traditional accounting models where old coins are destroyed and new coins are created for each transaction.

Continue reading "Notes on Bitcoin Transactions"

Notes on The Laws Governing Goods-Character

1.The goods-character of goods of higher order depends on the command of corresponding complementary goods

When we have first order goods it is in our power to use them to satisfy our direct needs. Second order can also satisfy our needs should we have the power to transform them. Similarly should we have third order goods at our disposal we would have the power to transform them into corresponding goods of second order and these in turn into corresponding goods of first order. Hence we can transform goods of third and higher order to the satisfaction of our needs if we have the power to transform them.

Continue reading "Notes on The Laws Governing Goods-Character"

Notes on The Causal Connection between Goods

It is necessary to classify the vaious goods according to their inherent characteristics. To learn the place that each good occupies in the causal nexus of goods. And finally to discover the economic laws that they are subject to.

Our well being at any point of time to the extent that it depends upon the satisfaction of our needs is assured if we have at our disposal the goods required for their direct satisfaction.

If we have sufficient amount of bread, we are in a position to satisfy our need for food directly. The causal connection between the bread and satisfaction of our need is rather a direct one.

Continue reading "Notes on The Causal Connection between Goods"

Notes on the General Theory of Goods

All things are subject to the law of cause and effect. There is no exception.

One's own person and any of its state are links in the great universal structure of relationships.

It is impossible to conceive of a change of one's person from one state to the other without being subject to the law if causality.

For example one passes from a state of need to a state of satisfaction, sufficient causes for this change must exist. Either one's internal forces are acting to remedy the disturbed state Or external forces acting upon it that can produce the state we call satisfaction.

Continue reading "Notes on the General Theory of Goods"

Notes on deriving Bitcoin addresses using Libbitcoin


  • Derive publicly shareable address
  • Deterministically derive new address from HD keys

Address anatomy

The serialized bitcoin address consists of

  • 1-Byte version prefix (mainnet or testNet)
    0x00 or 0x6F
  • 20-Byte hash digest (double hashed public key)
  • 4-Byte checksum

    The serialized format is encoded in base58, the hash of the public key can be compressed or uncompressed

Continue reading "Notes on deriving Bitcoin addresses using Libbitcoin"