Webinar Alert : Mastering  Manual and Automation Testing! - Reserve Your Free Seat Now

- Blockchain Blogs -

How to integrate Blockchain with Salesforce?

The last two years will be associated with prodding on transformative blockchain norms and arrangements, driven partially by the interest in transparency, coordinated effort, and improved productivity in the transportation of technology. Concentrated on development here, Salesforce has joined the blockchain world– to improve the production network involvement for its clients, cloud technology, marketing automation, and to satisfy end purchasers better.

Salesforce has dependably been an organization that is always looking forward to the next big innovation, regardless of whether that was mobile, social, internet of things or artificial intelligence. In a meeting towards the finish of March with Business Insider's Julie Bort, Salesforce co-founders Marc Benioff and Parker Harris discussed the scope of subjects including how the organization came to take a shot at one of the next hot advancements, a blockchain product.  This blog will shed light on Salesforce and Blockchain integration. The blog covers the following topics- 

Introduction of Blockchain

As per the Wikipedia “A blockchain, originally blockchain is a growing list of records, called blocks, which are linked using cryptography.

Blockchain was first depicted in 1991 by Stuart Haber and W. Scott Stornetta. In any case, it got into the spotlight after Bitcoin.

Blockchain has nodes, and these nodes are called Blocks. Each square contains the hash, hash of the past square, timestamp, and the information. Treating with blockchain isn't simple. If a square has been tainted than the chain gets adulterated. salesforce Curriculum At the peak level, a blockchain is only a database. Its distinctive qualities are the unchanging nature of its exchanges and decentralized control; decentralized control is its foremost element. With conventional databases, one association controls ace information. Be that as it may, with blockchain, or dispersed record, taking part associations to have equivalent capacity to peruse and compose master data.

Blockchain innovation was promoted in 2009 by the digital money Bitcoin and later in 2014 by the more summed up open-source Ethereum. At that time, the two innovations depended on a vast open unknown system for their security and utilized monetary instruments to support interest. These elements pulled in terrible entertainers who caused some prominent episodes, which added to the negative view of blockchain innovation.

Read: Top Blockchain Trends to Watch in 2024
 

The Concept of Blockchain

A Block is quite like the connected list yet with greater multifaceted nature. The information from the square creates a square's hash. Be that as it may, it is easy to create the hash from the information. To counteract this, it additionally contains the hash of the past square. Along these lines, if any information is contacted, at that point square get invalid and the chain as well. If somebody needs to hack the blockchain, then the programmer needs to refresh every one of the squares. It isn't that straightforward and the time has come devouring also. In Bitcoin, each square can be refreshed or made in the hole of 10 minutes. So it can take one individual's lovely life to change every one of the squares. Concept of Blockchain Benefits that you can get from aligning Blockchain with Salesforce 

A). The Increase of CRM Data Security

That is the point at which your organization can get demonstrated information that is ensured by blockchain innovation. It is a huge element while utilizing cloud arrangements.

B). The Ability to Be Closer to Your Customers and Grasp their Demands

Blockchain can give you a top to the bottom outline of the prospects and clients, break down their requests and choose where to convey the business assets. That is the reason for applying the blockchain innovation inside CRM can support consumer loyalty and give you an inventive apparatus for dealing with the business procedure.

C). The Customer Experience Management Improvement

Read: Skills Needed To Become A Blockchain Developer

That is how you will guarantee the customer's information security and deal with the customer's experience in any case of the business. Besides, you will be able to:

  • use an obvious and secure customers database to give a powerful client reliability program;
  • manage customer rewards;
  • secure the customers' wallets to build your organization's trust;
  • guard the mobile applications from programmer assaults with the assistance of blockchain innovation.

Consequently, the blockchain together with CRM can expand the security, quality, and speed of your client administration higher than ever. Accordingly, it ought to be seen that this blend makes them both a solitary incredible couple. salesforce quiz

Basic Integration of Blockchain with Salesforce Apex

We have seen a ton of buzz about blockchain. We have experienced a few of the online journals and fundamental projects in NodeJs. Really, regardless we think about it less. Be that as it may, our enthusiasm for salesforce brings us to compose the Basic blockchain program at the peak. The blockchain is, still Interstellar and Inception for many people.

Let’s Code:

1). The first step is to create a class called Block. This class will further be utilized to create new blocks in the chain. A). public Block(integer index, string data, string prevHash) The constructor of the class will have three parameters.

  • Index: Index of the block.
  • Data: Data for the Block.
  • prevHash: Hash code of the previous block.

B). private long generateTimeStamp() This method will generate timestamp for the block. C). private long generateTimeStamp() This method will generate timestamp for the block. D).


public string getHash(){

    Blob dataToEncrypt = Blob.valueOf( this.data + this.prevHash + this.index + this.timestamp );

    Blob encrypted = crypto.generateMac('HmacSHA256', dataToEncrypt, Blob.valueOf('key'));

    return EncodingUtil.base64Encode(encrypted);

}

This method creates hash code from data + prevHash + index + timestamp. I am using the generateMac method from Crypto class. I am selecting HmacSHA256 in the algorithm. You can choose any Private key to generate a message authentication code (Mac). E).

Read: How to Build a Successful Career in Blockchain

public string getHash(){

Blob dataToEncrypt = Blob.valueOf( this.data + this.prevHash + this.index + this.timestamp );

Blob encrypted = crypto.generateMac('HmacSHA256', dataToEncrypt, Blob.valueOf('key'));

return EncodingUtil.base64Encode(encrypted);

}

This method creates hash code from data + prevHash + index + timestamp. I am using the generateMac method from Crypto class. I am selecting HmacSHA256 in the algorithm. You can choose any Private key to generate a message authentication code (Mac). 2). The next step is to create a Class called Blockchain. This is the class that will be utilized to create the new blocks in the chain and then to Validate that chain. A).


public void addBlock(string data){

//Defining Index from chain size

integer index = chain.size();


//Checking for previous block's hash, If it is the first block then it set the previous block as '0'

string prevHash = chain.isEmpty()==true ? '0' : chain.get(chain.size()-1).hash;


//Creating a block from index, data and previous block's hash

Block newBlock = new Block(index, data, prevHash);


//Adding the new block in the chain

chain.add(newBlock);

}

This method will add a new block to the chain with the given data. B). public boolean isChainValid() This method is checking for the valid chain. if the chain is not valid then it will return false, if it is valid then it will return true. C).


public boolean isBlockValid(integer index){

//Checking block's hash with run time calculated a hash from the block

//If someone has changed the block data then getHash will return a new data

//This will not be same as the block's Hash

if(chain[index].hash != chain[index].getHash() ){

return false;

}



//If the index is greater than zero then it is also checking the block's prevHash from previous block's hash.

//If someone changed the data and but still he needs to change the hash as well

//Hash is generated by the combination of data+index+timestap+prevHash.

//If someone wants to make the hash correct, he has to change the prevHash as well

//Now the block seems good as all the needed values are changed

//But now this line will check prevHash from previous index's block hash.

//It will not be the same. Now it sends the false in return.

if(index > 0 && chain[index].prevHash != chain[index-1].hash ){

return false;

}

return true;

}

This method is checking for the valid block. if the block is not valid then it will return false, if it is valid then it will return true. As you have to see that if someone wants to change a block then the person needs to change the entire chain. @Lastly, Test the code that you have just run


isTest

public class BlockChainTest{
//Testing Blockchain

@isTest

public static void testBlockChain(){

/**Data Setup**/
//Creating Instance of Blockchain

BlockChain bChain = new BlockChain();
//addBlock method take data as the string
//Changing data to the string with the JSON format
//Adding the first block to the chain

bChain.addBlock( json.serialize( new BCTestDataWrapper('Iron Man', '2334343434') ) );
//Adding the second block to the chain

bChain.addBlock( json.serialize( new BCTestDataWrapper('Thor', '34343434') ) );

/**Positive Testing**/
//isChainValid will return true, as no data has been modified from block

system.assertEquals(true, bChain.isChainValid() );

//Print Blockchain

system.debug('-Blockchain Data Before Modifying--'+Json.serialize( bChain.chain) );

/**Negative Testing**/

//Now updating the 0 index's block

BCTestDataWrapper tData = (BCTestDataWrapper)JSON.deserialize(bChain.chain[0].data, BCTestDataWrapper.class);

tData.name = 'Thanos';

bChain.chain[0].data = json.serialize(tData);

//isChainValid will return false, as the data has been modified from block

system.assertEquals(false, bChain.isChainValid() );

//Print Blockchain

system.debug('-Blockchain Data After Modifying--'+Json.serialize( bChain.chain) );

}

}

free salesforce demo Conclusion

Integrating Salesforce with Blockchain is going to give it a huge bump as it is already an ace CRM tool; integration with Salesforce is only going to increase the functionality of Salesforce. Do write back to us in case of any queries.

Read: Blockchain Developer Salary in India- 2024


fbicons FaceBook twitterTwitter lingedinLinkedIn pinterest Pinterest emailEmail

     Logo

    JanBask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


  • fb-15
  • twitter-15
  • linkedin-15

Comments

Trending Courses

Cyber Security Course

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models
Cyber Security Course

Upcoming Class

1 day 14 Oct 2024

QA Course

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing
QA Course

Upcoming Class

13 days 26 Oct 2024

Salesforce Course

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL
Salesforce Course

Upcoming Class

5 days 18 Oct 2024

Business Analyst Course

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum
Business Analyst Course

Upcoming Class

5 days 18 Oct 2024

MS SQL Server Course

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design
MS SQL Server Course

Upcoming Class

5 days 18 Oct 2024

Data Science Course

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning
Data Science Course

Upcoming Class

12 days 25 Oct 2024

DevOps Course

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing
DevOps Course

Upcoming Class

5 days 18 Oct 2024

Hadoop Course

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation
Hadoop Course

Upcoming Class

12 days 25 Oct 2024

Python Course

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation
Python Course

Upcoming Class

6 days 19 Oct 2024

Artificial Intelligence Course

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks
Artificial Intelligence Course

Upcoming Class

20 days 02 Nov 2024

Machine Learning Course

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning
Machine Learning Course

Upcoming Class

33 days 15 Nov 2024

 Tableau Course

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop
 Tableau Course

Upcoming Class

12 days 25 Oct 2024

Search Posts

Reset

Receive Latest Materials and Offers on Blockchain Course

Interviews