Chain Gang | Table O Contents

The Ivy programming language converts block chain code into byte language …

Note. The Flammarion Logo Badge in the page header above is an .svg image file set to the dimensions of 5% width, auto height, and zoom. Go ahead and test the zoom-out feature by hovering over the badge to engage the expansion of the image.

CVMs

Hint. Ivy is a programming language designed to code and convert block chain technology into the lower level byte language of the Chain Virtual Machine, or CVM.

The Chain Virtual Machine aka the CVM drives the Turing complete Chain platform developed by the Chain Gang at Chain dot com.

The same restriction applies to runaway contracts when using the CVM as when using the Ethereum Virtual Machine, or EVM.

Free Gas

However, unlike the Ethereum platform, the gas is free when using the Chain dot com platform.

Receiver Objects

A Receiver Object is a node that issues a digital form of invoice to an incoming party.

The incoming party resides externally to the Receiver Object on the network and is sending a message to the Receiver Object to please accept coin.

The message being read by the receiving party is an attempt to engage one or more methods that are located on the Receiver Object.

The overture to accept coin from the incoming party needs to be acknowledged by the receiving party before a transaction can take place.

In other words, an external party to a contract cannot simply toss a coin at another node on the network without an acknowledgment from the receiving party.

A protocol must be established to either accept the incoming asset if desirable, or to reject the incoming asset if by some other method the sender is deemed not worthy.

Serialize and Send

First, we have to create a Receiver Object with the keyword “Receiver”, as follows:


Receiver robin = new Account.ReceiverBuilder()

Here, we have initialized our Receiver Object with the name robinand we have assigned the value of the return from the new Account ReceiverBuilder method to our new robin Receiver Object.

Fleshing It Out

The authors at the Chain Gang have let the end-user sink or swim with the balance of the code, at this juncture.


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")

And, further …


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")
  .create(client);

And, more …


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")
  .create(client);

String castleReceiverSerialized = castleReceiver.to_Json();

More code …


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")
  .create(client);

String castleReceiverSerialized = castleReceiver.to_Json();
  castle_receiver = chain.accounts.create_receiver
    account_alias: 'castle'
  )

Still more …


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")
  .create(client);

String castleReceiverSerialized = castleReceiver.to_Json();
  castle_receiver = chain.accounts.create_receiver
    account_alias: 'castle'
  )

 castle_receiver_serialized = bob_receiver.to_json

Keep it coming, line by line, method by method …


Receiver robin = new Account.ReceiverBuilder()
  .setAccountAlias("castle")
  .create(client);

String castleReceiverSerialized = castleReceiver.to_Json();

  castle_receiver = chain.accounts.create_receiver(
    account_alias: 'castle'
  )

  castle_receiver_serialized = bob_receiver.to_json

  const castleReceiverSerializedPromise = client.accounts.createReceiver(
    {
      accountAlias: 'castle',
    }
  ).then(castleReceiver => {
      return JSON.stringify(castleReceiver)
    }
  )

Receiver Requests

A Receiver Request is the message to the Receiver Object to please accept coin.

Creation


Transaction.Template spendingTransaction2 = new Transaction.Builder()
//
  .addAction(new Transaction.Action.SpendFromAccount()
    .setAccountAlias("mminail")
    .setAssetAlias("medcoin")
    .setAmount(1)
  ).addAction(new Transaction.Action.ControlWithReceiver()
    .setReceiver(Receiver.fromJson(castleReceiverSerialized))
    .setAssetAlias("medcoin")
    .setAmount(1)
  ).build(client);
//

Submission

Notice how the Receiver Request above includes a call to the pre-made ‘castleReceiverSerialized’ method.

Last Subtitle

More to come …


Note. The above synopsis was derived from an article written by the Chain [2].

  1. The CHAIN is an acronym for the Chain Virtual Machine and its accompanying Ivy programming language. Published by © 2017 Chain.com.

Support

Please support the co-workers who aggregate the Source Links for our projects.

Patreon

Like what you see in this project? If so, then support the authors and machine-elves who aggregate the source links and pages for our projects via Patreon.