Error t Instance org acme seller Car HW7722 missing required field oldOwner

0 votes

Below is the code I am working on:

**Sample.cto**
/**
 * Sample business network definition.
 */
namespace org.acme.seller

asset Car identified by carNumber{
  o String carNumber
  o String carName
  --> Owner oldOwner
}


participant Owner identified by ownerId{
  o String ownerId
  o String fname
  o String lname
}

transaction Transfer{
  --> Car car
  --> Owner newOwner
}
----------------------
**Sample.js**

/**
 * Sample transaction processor function.
 * @param {org.acme.seller.Transfer} tx The sample transaction instance.
 * @transaction
 */
function Transfer(tx) {

    // Save the old value of the asset.
    tx.car.oldOwner = tx.car.newOwner;

    // Update the asset with the new value.
     // tx.car1.value = tx.newValue;

    // Get the asset registry for the asset.
    return getAssetRegistry('org.acme.seller.Car')
        .then(function (assetRegistry) {

            // Update the asset in the asset registry.
            return assetRegistry.update(tx.car);
        });
}
------------------------------------------------
**Permissions.acl**

/**
 * Sample access control list.
 */
rule EverybodyCanReadEverything {
    description: "Allow all participants read access to all resources"
    participant: "ANY"
    operation: ALL
    resource: "org.acme.seller.*"
    action: ALLOW
}

rule EverybodyCanSubmitTransactions {
    description: "Allow all participants to submit transactions"
    participant: "ANY"
    operation: ALL
    resource: "org.acme.seller.*"
    action: ALLOW
}

rule OwnerHasFullAccessToTheirAssets {
    description: "Allow all participants full access to their assets"
    participant(p): "org.acme.seller.*"
    operation: ALL
    resource(r): "org.acme.seller.*"
    condition: (r.owner.getIdentifier() === p.getIdentifier())
    action: ALLOW
}

rule SystemACL {
  description:  "System ACL to permit all access"
  participant: "org.hyperledger.composer.system.Participant"
  operation: ALL
  resource: "org.hyperledger.composer.system.**"
  action: ALLOW
}

I'm receiving this error while submitting transaction:

t: Instance org.acme.seller.Car#HW7722 missing required field oldOwner

I am fairly new to Blockchain development and unable to resolve this error. Can anyone help?

Jun 21, 2018 in Blockchain by nsv999
• 5,500 points

edited Jun 21, 2018 by nsv999 1,440 views

1 answer to this question.

0 votes

This error occurs if you have added a new field to an Asset and have existing data in the asset registry without that field. You could add optional to the new field to remove the error e.g. 

--> Owner oldOwner optional

answered Jun 21, 2018 by Christine
• 15,790 points

edited Jun 21, 2018 by Christine

Related Questions In Blockchain

0 votes
1 answer

Required parameter missing: account error

You need to swap out the place ...READ MORE

answered Aug 30, 2018 in Blockchain by slayer
• 29,370 points
1,578 views
0 votes
1 answer

Hyperledger Composer: Error: Object with ID 'assetID:0138' in collection with ID 'Asset:org.acme.mynetwork.Sensor'

Remove 'assetID:' from your test string. For example, 'org.acme.mynetwork#assetID:0138' ...READ MORE

answered Nov 14, 2018 in Blockchain by Omkar
• 69,220 points
998 views
0 votes
1 answer

Hyperledger Composer rest server NPM versions

The Hyperledger Composer pre-requisites can be installed ...READ MORE

answered Jul 13, 2018 in Blockchain by Christine
• 15,790 points
866 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
0 votes
1 answer

Error while trying to create dir if missing: mkdir /var/hyperledger: permission denied

The following commands should help: sudo mkdir -p ...READ MORE

answered Jul 6, 2018 in Blockchain by Christine
• 15,790 points
1,924 views
+15 votes
5 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP