Smart contract in peer-to-peer network without existence of blockchain - p2p

I need to know how can apply smart contract in a peer-to-peer network in which blockchain has not been utilized.
think two entities are interacting together in a peer-to-peer network and they have obligated pay some cost for some service that provide together ,but in this case they don't use blockchain and they should pay inside the network,can they use smart contract in this case? smart contract without blockchain? is any solution or any sample for that?

So far smart contracts have only been implemented in blockchain networks (and other distributed ledgers such as Hashgraph). Without such a platform you need some intermediary to fill the role of a smart contract.
For P2P networks, Bitcoin (and it's successors) were the first to create virtual currency in a decentralized fashion - so no, it is not possible to use digital currency without blockchain or a trusted third party.

Related

Hyperledger fabric design architecture

I have one use case for implementing private blockchain. I am considering using Hyperledger Fabric for implementing private blockchain.
Use case
As we know blockchain works with unknown parties which want to work together without any middle man. So, my use case is similar to this.
One organisation wants to deal with different vendors residing in different cities in the country which are not known to organisation. Now, we want to make smart contract according to our business logic between the organisation and vendors to do further transactions.
We will map our organisation to fabric organisation. But what to with vendors? As vendors are not separate organisation, they are individual entities.
I have worked for multi organisations with fabric but how should we make this architecture to work correctly where only one organisation is involved?

Hyperledger Fabric - MSPs of Small players using Infrastructure of Large players

I have a doubt.
Let us consider a scenario. A Large OEM and Few Large Vendors and Many Small Vendors are participating in a blockchain network. The small vendors may not be able to afford to set-up separate infrastructure / a dedicated Node to participate in the network. In that case,
Will we be able to enable the OEM or any Large Vendors to
provide access to the small vendors to participate in the blockchain
network, via their own node (i.e. infrastructure as a service), for a
small subscription fee?
Will we be able to create
private channels to those small vendors, providing the privacy from
the large vendor whose infrastructure is been used?
Will they be put as sub-organisations (logically in Membership Service Provider, not in real world acquisition or something like that) of the large vendor, like which we can commonly see in LDAP?
If a small vendor is using infrastructure provided by a larger vendor, then unless they have the necessary permissions to allow them to generate certificates and configure peers, and the infrastructure provider does not have access to these certificates, they are implicitly trusting that vendor with their data. Since this removes one of the advantages of a blockchain solution, maybe it would be preferable for the small vendor to use their own cloud-hosted infrastructure?
This could be done with only a single VM for a small low-throughput implementation. VM templates could even be provided for popular cloud providers to make it easy for the smaller vendors to configure their peer.

Hyperledger Composer - Participants and peers

I recently started trying to grasp the concepts of Hyperledger Composer.
Based on what I understand, Hyperledger Composer is just a layer on top of Hyperledger Fabric with the purpose of simplifying how things are done.
The confusion came when I tried to understand the difference between participants (composer term) and peers (fabric term). Based on the definition of the former, I understand that the participants are some kind of clients of the blockchain network (e.g. car manufacturer, car buyer) that have a user interface and interact with the blockchain through a REST api. Peers on the other hand are the actual nodes in the network. Intuitively, these concepts seem kind of related with each other, in the sense that an organization (participant) needs to contact each own node(peer) in the network where this peer has specific read/write rights in the network.
In their example-networks they use a default network configuration (crypto-config.yaml) in which they define, among other things, a single peer. However, I am allowed to create different types of participants with only a single peer in the network. Moreover, a single REST api is generated for the entire network.
For a network of two parties (e.g. car-manufacturer and car-quality-assurance-guy) it would make sense for me to have 2 participants (clients with ui), 2 peers (one with read/write rights and one with read-only rights) and 2 REST APIs (one for the car-manufacturer and one for the car-qa-guy). However, that doesn't seem to be how Composer works.
1) Is my understanding that different types of participants need to have their own peer in the network wrong?
2) Why do they generate a single REST api including methods for every participant in the network and not multiple so that they can be used by different clients with different rights?
To answer your questions first:
1) Your description that
I understand that the participants are some kind of clients of the blockchain network (e.g. car manufacturer, car buyer) that have a user interface and interact with the blockchain through a REST api. Peers on the other hand are the actual nodes in the network.
is indeed correct and that is how I understand it after using Composer for more than half a year in multiple projects. However, the statement that
different types of participants need to have their own peer in the network
is not quite true. As you stated it correctly, Composer is an abstraction of Fabric and aims to simplify prototype development on Fabric significantly. As a result, some of the nuances in Fabric are lost. For instance, it is incredibly complicated if you want to run Composer with support for multiple channels (in the Fabric sense).
In the case of participants vs peers, they are completely different and have little to almost no relations to each other. The peers belong to the Fabric world and they are responsible for running the Fabric blockchain infrastructure. In the basic tutorial (for Fabric which is also used in Composer), you have just one peer in the entire Fabric network. Once you have a Fabric network running, you can use Composer to model and deploy business networks however you wish. Note the distinction between Fabric network and business network. Fabric network refers to the underlying blockchain infrastructure built with Fabric while business network is a model built with Composer. Participants live in the business network modelled and deployed using Composer while peers are the backbone running the blockchain infrastructure. Hence, the two are weakly related in that without the peers, you simply can't have any business network at all. However, once you have a network running, the participants are almost entirely independent of the Fabric peers.
2) You have generated a single REST API most likely because the tutorial is worded as such. If you still remember, when you bring up the REST API, you needed to specify a business network card. Hence, each owner of a business network card can very well run their own REST API. In practice, you would issue an identity and business network card for each and every participant in the business network. Each participant will have different permissions granted by the access controls you have created when you modelled the business network (recall that these access controls are written in ACL). Hence, even though every participant and every REST API can see all the methods available, they can't invoke ones that they are not supposed to invoke. Of course you would have to model the access control policies properly in ACL.
Here are some of my thoughts on Composer.
Hyperledger Composer is just a layer on top of Hyperledger Fabric with the purpose of simplifying how things are done.
This is indeed true but it is a pity that they will be dropping support for Composer. (See this update by the authors) Therefore, it is recommended that production software should not be running on Composer. However, I personally find it extremely easy and quick to create prototypes (with nice UI) using Composer and I would personally continue using it for prototypes despite its deprecation simply because it is incredibly easy to use and free from major problems.

Hyperledger fabric and Ethereum integration

We were planning to build a blockchain based on below logic, but understand due to the private data(a portion of our data is private while some data is public), it is not possible on Ethereum. Would the same design / implementation be possible using Hyperledger Fabric?
Our current design : Blockchain on ethereum but keeping the data related to blocks in some distributed file storage system like IPFS or Storj and storing the hash of data in blocks. But we need our data to be private / shared, so to achieve that we are thinking of using some Key Management Service like NuCypher KMS. But we will have smart contracts on ethereum which can access the data and perform some operations.
We understand that the above logic is unable due to the private nature of data. Is there anyway to establish communication between Hyperledger fabric data and Ethereum smart contract?
It is quite possible to make a part of the transaction data private and other part of the transaction data private in Ethereum using various smart contract obfuscation techniques. One such technique is known as Zero Knowledge Proof which can be implemented in Ethereum at a Smart Contract level using Aztech Protocol. It is possible to implement Zero Knowledge Proofs in Ethereum in a further extended way using ZoKrates libraries which implements libsnarks. In Hyperledger Fabric, from version 1.2 onwards there is a feature known as 'Side DB' which helps us to have private transaction between two peers.
As you have mentioned, using NuCypher platform with homomorphic encryption and proxy re-encryption is always a good idea. We may need to push data from NuCypher into a Smart Contract through Web3.js or by some other easier approach.
With regard to your third question, yes, it is possible to integrated Ethereum and Hyperledger Fabric from Hyperledger 1.4 easily. It has integrated Hyperledger Burrow which makes compiling and deploying Ethereum Smart Contracts on Hyperledger Fabric easier. However I am not sure how much it will help your purpose.
Thinking again, I believe offline encryption using NuCypher / Decentralised Oracles and then invoking Smart Contracts with Meta Data from encrypted data vault looks like a good design choice. I feel Hyperledger Fabric may be an overkill for implementing an offline encryption vault.
Hyperledger offers etereum support. Please look for Seth, Burrow etc. May be that can be your lead.

Azure IOT and Azure Blockchain integration

I am looking for a way to integrate the IOT with Blockchain. I need to record the device data (IOT device) into the blockchain. I am successfully able to send data from the device to the IOT Hub.How can I record this data in a block chain created using Azure Ethereum Consortium?
Blockchain and IoT are a marriage made in heaven. Blockchain can enable and augment a variety of application scenarios and usecases for the IoT. No longer are such possibilities too futuristic – as we will discuss in this post.
IoT Meets Blockchain...
Blockchain and Internet Of Things (IoT) are easily the two biggest buzzwords in technology at the moment. The IoT encompasses the world of sensors,moving objects like vehicles and really any device that has embedded electronics to communicate with the outside world – typically over an IP protocol.
Combine that with Blockchain – a distributed ledger architecture (DLT) pattern. Combining the two can facilitate the entire lifecycle of IoT devices and applications and prove to be the glue for business processes to act on these events. Consider the following scenario – a private blockchain for a driverless connected car that will enable secure and realtime interactions from the car starting with car startup, driver authentication, smart contracts to exchange insurance and maintenance service information and realtime location info to track safety.
You can learn more about IBM BlockChain and develop your own BlockChain # https://www.ibm.com/developerworks/cloud/library/cl-ibm-blockchain-101-quick-start-guide-for-developers-bluemix-trs/index.html

Resources