SlideShare a Scribd company logo
IPFS AND SMART
CONTRACTS
Interplanetary File System
+ Smart Contracts
Hands-on
THERE ARE SOME SMART CONTRACT
USE CASES WHERE STORAGE OF
LARGE AMOUNT OF DATA IS NEEDED
Gov Records Trade Finance
Title Recording Supply Chain
HOW EXPENSIVE IS IT TO STORE
DATA ON BOCKCHIN? LET’S CHECK:
pragma solidity ^0.5.0;
contract WriteRandomData {
bytes32[] randomArray;
constructor() public {
bytes32 rand32 = keccak256(abi.encodePacked(block.timestamp));
for(uint i; i<32; i++) {
rand32 = keccak256(abi.encodePacked(rand32));
randomArray.push(rand32);
}
}
}
788,268 GAS UNITS TO CREATE
THE CONTRACT AND STORE 1KB
OF DATA
LET’S CREATE THE SAME CONTACT
BUT SKIP DATA STORAGE ON
BLOCKCHAIN
pragma solidity ^0.5.0;
contract WriteRandomData {
bytes32[] randomArray;
constructor() public {
bytes32 rand32 = keccak256(abi.encodePacked(block.timestamp));
for(uint i; i<32; i++) {
rand32 = keccak256(abi.encodePacked(rand32));
//randomArray.push(rand32);
}
}
}
73,032 GAS UNITS
LET’S CONVERT IT TO DOLLARS
AND CENTS
1 KB of data storage on Etherium: 788,268-73,032 = 715,236
Gas Units
715,236 Gas Units = 715,236 Gwei (assuming that we set
1Gwei for gas price)
1Gwei = 0.00001908 USD (as of 1/11/2020)
1KB Of storage: $0.00001908* 715,236 = $ 13.64670288
ALTERNATIVES TO STORORING
DATA A DIRECTLY ON BLOCKCHAIN
IPFS ON HIGH LEVEL: PEER-TO-
PEER NETWORK + GIT VERSIONING
Client-Server Network Peer-to-Peer Network
IPFS OBJECT
Data
< 256 kB of binary data
…
Link
Link
Name Hash Size
Link
MERKLE TREE
• Every leaf node is labelled with the
hash of a data block.
• Every non-leaf node is labelled with
the cryptographic hash of the labels
of its child nodes
MERKLE DIERECT ACCYCLIC
GRAPH (DAG)
DAG data structure similar to a Merkle tree but
not so strict:
1. DAG does not need to be balanced
2. Non-leaf nodes are allowed to contain data
Merkle DAG enables uniquely identified,
tamper-resistant and permanently stored
data shared by network nodes.
DAG creates a foundation for Distributed
Hash Table
IPFS PROPERTIES
With the Distributed Hash Table, nodes can store & share data
without central coordination
IPFS is Persistent Data Structure (nothing can be deleted)
Uploaded content is not guaranteed to persist on the network (all
participating nodes should consider participation a voluntary service)
HOW TO STORE AND ACCESS FILES
ON IPFS?
Command line interface https://dist.ipfs.io/#go-ipfs
API https://docs.ipfs.io/reference/api/http/
Libraries for different languages, for example NPM module for
JavaScript: https://www.npmjs.com/package/ipfs-api
INSTALLING IPFS • Installing IPFS Node on
GCP from scratch
CLOUD CONSOLE, CREATE A NEW
INSTANCEhttps://console.cloud.google.com/
OPEN PORT 4001
SSH INTO NEW INSTANCE
INSTALL GO
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install golang-go
go version
INSTALL IPFS
go get -u -d github.com/ipfs/go-ipfs
cd ~/go/src/github.com/ipfs/go-ipfs
make install
START IPFS NODE
cd ~/go/bin
./ipfs init
./ipfs daemon
PUBLISHING TO IPFS
• How to publish files to
the IPFS node
• How to read objects
from IPFS node
PUBLISH A FILE
leybzon@instance-1:~/go/bin$ cd ~
leybzon@instance-1:~$ vi test.html
leybzon@instance-1:~$ ./go/bin/ipfs add -w test.html
added QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1zk
test.html
added QmeoBZA3ywRT5wEa6RBuHxF4qaKAK8qSxuxWCr4BpPzT2r 7 B
/ 7 B
[=========================================]
100.00%
CHECK THAT THE FILE WAS
PUBLISHED LOCALLY
leybzon@instance-1:~/go/bin$ ./go/bin/ipfs object get
QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1
zk{"Links":[],"Data":"u0008u0002u0012u0007testnnnu0018u0007"}u0
012u0007testnnnu0018u0007"}
START IPFS DAEMON
leybzon@instance-2:~/go/bin$ ~/go/bin/ipfs daemon
Initializing daemon...go-ipfs version: 0.5.0-dev-049d3b0Repo version: 7
System version: amd64/linuxGolang version: go1.13.4
Swarm listening on /ip4/10.128.0.5/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/10.128.0.5/tcp/4001
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
USE INFURA GATEWAY TO GET THE
OBJECT
leybzon@instance-1:~/go/bin$ curl
“https://ipfs.infura.io:5001/api/v0/cat?arg=QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP
5CcT1zk”
test
SMART CONTRACT +
IPFS
• How to use IPFS objects in
Smart Contracts
• Creating ERC721 Smart
Contract
• Minting tokens connected
to IPFS objects
ERC-721 NFT CONNECTED TO DATA
IPFS
NFT Tokens are
 Unique
 Irreplaceable
 Non-
interchngable
ERC721Full ERC721Mintable
ERC721
ERC721Enumerabl
e
ERC721Metadata
MyNFT
mint1()
mintUniqueTokenT
ERC721 SMART CONTRACT 1/2
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol';
contract MyNFT is ERC721Full, ERC721Mintable {
constructor() ERC721Full("IPFS", "IPFS_DEMO") public {
}
event RecordedIpfsHash(uint256, string);
mapping(uint256 => string) _documents;
function mint1(uint256 _uid, string memory _ipfsHash) public{
_mint(msg.sender, _uid);
_documents[_uid] = _ipfsHash;
emit RecordedIpfsHash(_uid, _ipfsHash);
}
ERC721 SMART CONTRACT 2/2
…
function mintUniqueTokenTo(
address _to,
uint256 _tokenId,
string memory _tokenURI,
string memory _ipfsHash
) public
{
super._mint(_to, _tokenId);
super._setTokenURI(_tokenId, _tokenURI);
_documents[_tokenId] = _ipfsHash;
emit RecordedIpfsHash(_tokenId, _ipfsHash);
}
}
DEPLOYING SMART CONTRACT TO
BLOCKCHAIN
CALLING SMART CONTRACT TO
ISSUE NEW TOKEN
VERIFYING THAT THE TOKEN WAS
CREATED SUCCESSFULLY
QUESTIONS
ANOUNCEMENTS
STAY IN TOUCH
Gene Leybzon https://www.linkedin.com/in/leybzon/
https://www.meetup.com/members/90744
20/
https://www.leybzon.com

More Related Content

What's hot

IPSec Overview
IPSec OverviewIPSec Overview
IPSec Overview
davisli
 
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
KCDItaly
 
GOOGLE FILE SYSTEM
GOOGLE FILE SYSTEMGOOGLE FILE SYSTEM
GOOGLE FILE SYSTEM
JYoTHiSH o.s
 
Iptables presentation
Iptables presentationIptables presentation
Iptables presentation
Emin Abdul Azeez
 
Module 4 Enumeration
Module 4   EnumerationModule 4   Enumeration
Module 4 Enumerationleminhvuong
 
Decentralized storage
Decentralized storageDecentralized storage
Decentralized storage
Anurag Dashputre
 
Peer to Peer services and File systems
Peer to Peer services and File systemsPeer to Peer services and File systems
Peer to Peer services and File systems
MNM Jain Engineering College
 
Google File System
Google File SystemGoogle File System
Google File System
guest2cb4689
 
google file system
google file systemgoogle file system
google file system
diptipan
 
CLOUD COMPUTING UNIT-5 NOTES
CLOUD COMPUTING UNIT-5 NOTESCLOUD COMPUTING UNIT-5 NOTES
CLOUD COMPUTING UNIT-5 NOTES
Tushar Dhoot
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Get Hands-On with NGINX and QUIC+HTTP/3
Get Hands-On with NGINX and QUIC+HTTP/3Get Hands-On with NGINX and QUIC+HTTP/3
Get Hands-On with NGINX and QUIC+HTTP/3
NGINX, Inc.
 
HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streaming
Hung Thai Le
 
Ipfs : InterPlanetary File System
Ipfs : InterPlanetary File SystemIpfs : InterPlanetary File System
Ipfs : InterPlanetary File System
동현 강
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applications
mrdon
 
Module: Content Routing in IPFS
Module: Content Routing in IPFSModule: Content Routing in IPFS
Module: Content Routing in IPFS
Ioannis Psaras
 
Building a Real-time Data Pipeline: Apache Kafka at LinkedIn
Building a Real-time Data Pipeline: Apache Kafka at LinkedInBuilding a Real-time Data Pipeline: Apache Kafka at LinkedIn
Building a Real-time Data Pipeline: Apache Kafka at LinkedInDataWorks Summit
 
Google file system
Google file systemGoogle file system
Google file system
Lalit Rastogi
 
Chapter 14 replication
Chapter 14 replicationChapter 14 replication
Chapter 14 replicationAbDul ThaYyal
 
SKYPE AS OVERLAY NETWORK
SKYPE AS OVERLAY NETWORKSKYPE AS OVERLAY NETWORK
SKYPE AS OVERLAY NETWORK
Prathamesh Sonawane
 

What's hot (20)

IPSec Overview
IPSec OverviewIPSec Overview
IPSec Overview
 
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
Multi-Clusters Made Easy with Liqo:
Getting Rid of Your Clusters Keeping Them...
 
GOOGLE FILE SYSTEM
GOOGLE FILE SYSTEMGOOGLE FILE SYSTEM
GOOGLE FILE SYSTEM
 
Iptables presentation
Iptables presentationIptables presentation
Iptables presentation
 
Module 4 Enumeration
Module 4   EnumerationModule 4   Enumeration
Module 4 Enumeration
 
Decentralized storage
Decentralized storageDecentralized storage
Decentralized storage
 
Peer to Peer services and File systems
Peer to Peer services and File systemsPeer to Peer services and File systems
Peer to Peer services and File systems
 
Google File System
Google File SystemGoogle File System
Google File System
 
google file system
google file systemgoogle file system
google file system
 
CLOUD COMPUTING UNIT-5 NOTES
CLOUD COMPUTING UNIT-5 NOTESCLOUD COMPUTING UNIT-5 NOTES
CLOUD COMPUTING UNIT-5 NOTES
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 
Get Hands-On with NGINX and QUIC+HTTP/3
Get Hands-On with NGINX and QUIC+HTTP/3Get Hands-On with NGINX and QUIC+HTTP/3
Get Hands-On with NGINX and QUIC+HTTP/3
 
HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streaming
 
Ipfs : InterPlanetary File System
Ipfs : InterPlanetary File SystemIpfs : InterPlanetary File System
Ipfs : InterPlanetary File System
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applications
 
Module: Content Routing in IPFS
Module: Content Routing in IPFSModule: Content Routing in IPFS
Module: Content Routing in IPFS
 
Building a Real-time Data Pipeline: Apache Kafka at LinkedIn
Building a Real-time Data Pipeline: Apache Kafka at LinkedInBuilding a Real-time Data Pipeline: Apache Kafka at LinkedIn
Building a Real-time Data Pipeline: Apache Kafka at LinkedIn
 
Google file system
Google file systemGoogle file system
Google file system
 
Chapter 14 replication
Chapter 14 replicationChapter 14 replication
Chapter 14 replication
 
SKYPE AS OVERLAY NETWORK
SKYPE AS OVERLAY NETWORKSKYPE AS OVERLAY NETWORK
SKYPE AS OVERLAY NETWORK
 

Similar to InterPlanetary File System (IPFS)

Web3 File Storage Options
Web3 File Storage OptionsWeb3 File Storage Options
Web3 File Storage Options
Gene Leybzon
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Jung-Hong Kim
 
Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple
Wojciech Barczyński
 
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
Patricia Aas
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
Ajey Pratap Singh
 
Super-NetOps Source of Truth
Super-NetOps Source of TruthSuper-NetOps Source of Truth
Super-NetOps Source of Truth
Joel W. King
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...
Alessandro Confetti
 
Learn how to build decentralized and serverless html5 applications with Embar...
Learn how to build decentralized and serverless html5 applications with Embar...Learn how to build decentralized and serverless html5 applications with Embar...
Learn how to build decentralized and serverless html5 applications with Embar...
Codemotion
 
Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6
LetsConnect
 
IoT Edge Data Processing with NVidia Jetson Nano oct 3 2019
IoT  Edge Data Processing with NVidia Jetson Nano oct 3 2019IoT  Edge Data Processing with NVidia Jetson Nano oct 3 2019
IoT Edge Data Processing with NVidia Jetson Nano oct 3 2019
Timothy Spann
 
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Patricia Aas
 
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOpsMake stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
Weaveworks
 
Sandboxing WebKitGTK (GUADEC 2019)
Sandboxing WebKitGTK (GUADEC 2019)Sandboxing WebKitGTK (GUADEC 2019)
Sandboxing WebKitGTK (GUADEC 2019)
Igalia
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
Ceph Day Bring Ceph To Enterprise
Ceph Day Bring Ceph To EnterpriseCeph Day Bring Ceph To Enterprise
Ceph Day Bring Ceph To Enterprise
Alex Lau
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
Henry Schreiner
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Jian-Hong Pan
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoT
Kai Zhao
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
Max Kleiner
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 

Similar to InterPlanetary File System (IPFS) (20)

Web3 File Storage Options
Web3 File Storage OptionsWeb3 File Storage Options
Web3 File Storage Options
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
 
Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple
 
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
Linux Security and How Web Browser Sandboxes Really Work (Security Researcher...
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
 
Super-NetOps Source of Truth
Super-NetOps Source of TruthSuper-NetOps Source of Truth
Super-NetOps Source of Truth
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...
 
Learn how to build decentralized and serverless html5 applications with Embar...
Learn how to build decentralized and serverless html5 applications with Embar...Learn how to build decentralized and serverless html5 applications with Embar...
Learn how to build decentralized and serverless html5 applications with Embar...
 
Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6
 
IoT Edge Data Processing with NVidia Jetson Nano oct 3 2019
IoT  Edge Data Processing with NVidia Jetson Nano oct 3 2019IoT  Edge Data Processing with NVidia Jetson Nano oct 3 2019
IoT Edge Data Processing with NVidia Jetson Nano oct 3 2019
 
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
 
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOpsMake stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
Make stateful apps in Kubernetes a no brainer with Pure Storage and GitOps
 
Sandboxing WebKitGTK (GUADEC 2019)
Sandboxing WebKitGTK (GUADEC 2019)Sandboxing WebKitGTK (GUADEC 2019)
Sandboxing WebKitGTK (GUADEC 2019)
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
 
Ceph Day Bring Ceph To Enterprise
Ceph Day Bring Ceph To EnterpriseCeph Day Bring Ceph To Enterprise
Ceph Day Bring Ceph To Enterprise
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoT
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
 

More from Gene Leybzon

Generative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlowGenerative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlow
Gene Leybzon
 
Chat GPTs
Chat GPTsChat GPTs
Chat GPTs
Gene Leybzon
 
Generative AI Use cases for Enterprise - Second Session
Generative AI Use cases for Enterprise - Second SessionGenerative AI Use cases for Enterprise - Second Session
Generative AI Use cases for Enterprise - Second Session
Gene Leybzon
 
Generative AI Use-cases for Enterprise - First Session
Generative AI Use-cases for Enterprise - First SessionGenerative AI Use-cases for Enterprise - First Session
Generative AI Use-cases for Enterprise - First Session
Gene Leybzon
 
Non-fungible tokens (nfts)
Non-fungible tokens (nfts)Non-fungible tokens (nfts)
Non-fungible tokens (nfts)
Gene Leybzon
 
Introduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptxIntroduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptx
Gene Leybzon
 
Ethereum in Enterprise.pptx
Ethereum in Enterprise.pptxEthereum in Enterprise.pptx
Ethereum in Enterprise.pptx
Gene Leybzon
 
ERC-4907 Rentable NFT Standard.pptx
ERC-4907 Rentable NFT Standard.pptxERC-4907 Rentable NFT Standard.pptx
ERC-4907 Rentable NFT Standard.pptx
Gene Leybzon
 
Onchain Decentralized Governance 2.pptx
Onchain Decentralized Governance 2.pptxOnchain Decentralized Governance 2.pptx
Onchain Decentralized Governance 2.pptx
Gene Leybzon
 
Onchain Decentralized Governance.pptx
Onchain Decentralized Governance.pptxOnchain Decentralized Governance.pptx
Onchain Decentralized Governance.pptx
Gene Leybzon
 
Web3 Full Stack Development
Web3 Full Stack DevelopmentWeb3 Full Stack Development
Web3 Full Stack Development
Gene Leybzon
 
Instantly tradeable NFT contracts based on ERC-1155 standard
Instantly tradeable NFT contracts based on ERC-1155 standardInstantly tradeable NFT contracts based on ERC-1155 standard
Instantly tradeable NFT contracts based on ERC-1155 standard
Gene Leybzon
 
Non-fungible tokens. From smart contract code to marketplace
Non-fungible tokens. From smart contract code to marketplaceNon-fungible tokens. From smart contract code to marketplace
Non-fungible tokens. From smart contract code to marketplace
Gene Leybzon
 
The Art of non-fungible tokens
The Art of non-fungible tokensThe Art of non-fungible tokens
The Art of non-fungible tokens
Gene Leybzon
 
Graph protocol for accessing information about blockchains and d apps
Graph protocol for accessing information about blockchains and d appsGraph protocol for accessing information about blockchains and d apps
Graph protocol for accessing information about blockchains and d apps
Gene Leybzon
 
Substrate Framework
Substrate FrameworkSubstrate Framework
Substrate Framework
Gene Leybzon
 
Chainlink
ChainlinkChainlink
Chainlink
Gene Leybzon
 
OpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chainOpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chain
Gene Leybzon
 
Chainlink, Cosmos, Kusama, Polkadot: Approaches to the Internet of Blockchains
Chainlink, Cosmos, Kusama, Polkadot:   Approaches to the Internet of BlockchainsChainlink, Cosmos, Kusama, Polkadot:   Approaches to the Internet of Blockchains
Chainlink, Cosmos, Kusama, Polkadot: Approaches to the Internet of Blockchains
Gene Leybzon
 
Dex and Uniswap
Dex and UniswapDex and Uniswap
Dex and Uniswap
Gene Leybzon
 

More from Gene Leybzon (20)

Generative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlowGenerative AI Application Development using LangChain and LangFlow
Generative AI Application Development using LangChain and LangFlow
 
Chat GPTs
Chat GPTsChat GPTs
Chat GPTs
 
Generative AI Use cases for Enterprise - Second Session
Generative AI Use cases for Enterprise - Second SessionGenerative AI Use cases for Enterprise - Second Session
Generative AI Use cases for Enterprise - Second Session
 
Generative AI Use-cases for Enterprise - First Session
Generative AI Use-cases for Enterprise - First SessionGenerative AI Use-cases for Enterprise - First Session
Generative AI Use-cases for Enterprise - First Session
 
Non-fungible tokens (nfts)
Non-fungible tokens (nfts)Non-fungible tokens (nfts)
Non-fungible tokens (nfts)
 
Introduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptxIntroduction to Solidity and Smart Contract Development (9).pptx
Introduction to Solidity and Smart Contract Development (9).pptx
 
Ethereum in Enterprise.pptx
Ethereum in Enterprise.pptxEthereum in Enterprise.pptx
Ethereum in Enterprise.pptx
 
ERC-4907 Rentable NFT Standard.pptx
ERC-4907 Rentable NFT Standard.pptxERC-4907 Rentable NFT Standard.pptx
ERC-4907 Rentable NFT Standard.pptx
 
Onchain Decentralized Governance 2.pptx
Onchain Decentralized Governance 2.pptxOnchain Decentralized Governance 2.pptx
Onchain Decentralized Governance 2.pptx
 
Onchain Decentralized Governance.pptx
Onchain Decentralized Governance.pptxOnchain Decentralized Governance.pptx
Onchain Decentralized Governance.pptx
 
Web3 Full Stack Development
Web3 Full Stack DevelopmentWeb3 Full Stack Development
Web3 Full Stack Development
 
Instantly tradeable NFT contracts based on ERC-1155 standard
Instantly tradeable NFT contracts based on ERC-1155 standardInstantly tradeable NFT contracts based on ERC-1155 standard
Instantly tradeable NFT contracts based on ERC-1155 standard
 
Non-fungible tokens. From smart contract code to marketplace
Non-fungible tokens. From smart contract code to marketplaceNon-fungible tokens. From smart contract code to marketplace
Non-fungible tokens. From smart contract code to marketplace
 
The Art of non-fungible tokens
The Art of non-fungible tokensThe Art of non-fungible tokens
The Art of non-fungible tokens
 
Graph protocol for accessing information about blockchains and d apps
Graph protocol for accessing information about blockchains and d appsGraph protocol for accessing information about blockchains and d apps
Graph protocol for accessing information about blockchains and d apps
 
Substrate Framework
Substrate FrameworkSubstrate Framework
Substrate Framework
 
Chainlink
ChainlinkChainlink
Chainlink
 
OpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chainOpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chain
 
Chainlink, Cosmos, Kusama, Polkadot: Approaches to the Internet of Blockchains
Chainlink, Cosmos, Kusama, Polkadot:   Approaches to the Internet of BlockchainsChainlink, Cosmos, Kusama, Polkadot:   Approaches to the Internet of Blockchains
Chainlink, Cosmos, Kusama, Polkadot: Approaches to the Internet of Blockchains
 
Dex and Uniswap
Dex and UniswapDex and Uniswap
Dex and Uniswap
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

InterPlanetary File System (IPFS)

  • 1. IPFS AND SMART CONTRACTS Interplanetary File System + Smart Contracts Hands-on
  • 2. THERE ARE SOME SMART CONTRACT USE CASES WHERE STORAGE OF LARGE AMOUNT OF DATA IS NEEDED Gov Records Trade Finance Title Recording Supply Chain
  • 3. HOW EXPENSIVE IS IT TO STORE DATA ON BOCKCHIN? LET’S CHECK: pragma solidity ^0.5.0; contract WriteRandomData { bytes32[] randomArray; constructor() public { bytes32 rand32 = keccak256(abi.encodePacked(block.timestamp)); for(uint i; i<32; i++) { rand32 = keccak256(abi.encodePacked(rand32)); randomArray.push(rand32); } } }
  • 4. 788,268 GAS UNITS TO CREATE THE CONTRACT AND STORE 1KB OF DATA
  • 5. LET’S CREATE THE SAME CONTACT BUT SKIP DATA STORAGE ON BLOCKCHAIN pragma solidity ^0.5.0; contract WriteRandomData { bytes32[] randomArray; constructor() public { bytes32 rand32 = keccak256(abi.encodePacked(block.timestamp)); for(uint i; i<32; i++) { rand32 = keccak256(abi.encodePacked(rand32)); //randomArray.push(rand32); } } }
  • 7. LET’S CONVERT IT TO DOLLARS AND CENTS 1 KB of data storage on Etherium: 788,268-73,032 = 715,236 Gas Units 715,236 Gas Units = 715,236 Gwei (assuming that we set 1Gwei for gas price) 1Gwei = 0.00001908 USD (as of 1/11/2020) 1KB Of storage: $0.00001908* 715,236 = $ 13.64670288
  • 8. ALTERNATIVES TO STORORING DATA A DIRECTLY ON BLOCKCHAIN
  • 9. IPFS ON HIGH LEVEL: PEER-TO- PEER NETWORK + GIT VERSIONING Client-Server Network Peer-to-Peer Network
  • 10. IPFS OBJECT Data < 256 kB of binary data … Link Link Name Hash Size Link
  • 11. MERKLE TREE • Every leaf node is labelled with the hash of a data block. • Every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes
  • 12. MERKLE DIERECT ACCYCLIC GRAPH (DAG) DAG data structure similar to a Merkle tree but not so strict: 1. DAG does not need to be balanced 2. Non-leaf nodes are allowed to contain data Merkle DAG enables uniquely identified, tamper-resistant and permanently stored data shared by network nodes. DAG creates a foundation for Distributed Hash Table
  • 13. IPFS PROPERTIES With the Distributed Hash Table, nodes can store & share data without central coordination IPFS is Persistent Data Structure (nothing can be deleted) Uploaded content is not guaranteed to persist on the network (all participating nodes should consider participation a voluntary service)
  • 14. HOW TO STORE AND ACCESS FILES ON IPFS? Command line interface https://dist.ipfs.io/#go-ipfs API https://docs.ipfs.io/reference/api/http/ Libraries for different languages, for example NPM module for JavaScript: https://www.npmjs.com/package/ipfs-api
  • 15. INSTALLING IPFS • Installing IPFS Node on GCP from scratch
  • 16. CLOUD CONSOLE, CREATE A NEW INSTANCEhttps://console.cloud.google.com/
  • 18. SSH INTO NEW INSTANCE
  • 19. INSTALL GO sudo add-apt-repository ppa:longsleep/golang-backports sudo apt-get update sudo apt-get install golang-go go version
  • 20. INSTALL IPFS go get -u -d github.com/ipfs/go-ipfs cd ~/go/src/github.com/ipfs/go-ipfs make install
  • 21. START IPFS NODE cd ~/go/bin ./ipfs init ./ipfs daemon
  • 22. PUBLISHING TO IPFS • How to publish files to the IPFS node • How to read objects from IPFS node
  • 23. PUBLISH A FILE leybzon@instance-1:~/go/bin$ cd ~ leybzon@instance-1:~$ vi test.html leybzon@instance-1:~$ ./go/bin/ipfs add -w test.html added QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1zk test.html added QmeoBZA3ywRT5wEa6RBuHxF4qaKAK8qSxuxWCr4BpPzT2r 7 B / 7 B [=========================================] 100.00%
  • 24. CHECK THAT THE FILE WAS PUBLISHED LOCALLY leybzon@instance-1:~/go/bin$ ./go/bin/ipfs object get QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1 zk{"Links":[],"Data":"u0008u0002u0012u0007testnnnu0018u0007"}u0 012u0007testnnnu0018u0007"}
  • 25. START IPFS DAEMON leybzon@instance-2:~/go/bin$ ~/go/bin/ipfs daemon Initializing daemon...go-ipfs version: 0.5.0-dev-049d3b0Repo version: 7 System version: amd64/linuxGolang version: go1.13.4 Swarm listening on /ip4/10.128.0.5/tcp/4001 Swarm listening on /ip4/127.0.0.1/tcp/4001 Swarm listening on /ip6/::1/tcp/4001 Swarm listening on /p2p-circuit Swarm announcing /ip4/10.128.0.5/tcp/4001 Swarm announcing /ip4/127.0.0.1/tcp/4001 Swarm announcing /ip6/::1/tcp/4001 API server listening on /ip4/127.0.0.1/tcp/5001 WebUI: http://127.0.0.1:5001/webui Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080 Daemon is ready
  • 26. USE INFURA GATEWAY TO GET THE OBJECT leybzon@instance-1:~/go/bin$ curl “https://ipfs.infura.io:5001/api/v0/cat?arg=QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP 5CcT1zk” test
  • 27. SMART CONTRACT + IPFS • How to use IPFS objects in Smart Contracts • Creating ERC721 Smart Contract • Minting tokens connected to IPFS objects
  • 28. ERC-721 NFT CONNECTED TO DATA IPFS NFT Tokens are  Unique  Irreplaceable  Non- interchngable ERC721Full ERC721Mintable ERC721 ERC721Enumerabl e ERC721Metadata MyNFT mint1() mintUniqueTokenT
  • 29. ERC721 SMART CONTRACT 1/2 pragma solidity ^0.5.0; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol'; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol'; contract MyNFT is ERC721Full, ERC721Mintable { constructor() ERC721Full("IPFS", "IPFS_DEMO") public { } event RecordedIpfsHash(uint256, string); mapping(uint256 => string) _documents; function mint1(uint256 _uid, string memory _ipfsHash) public{ _mint(msg.sender, _uid); _documents[_uid] = _ipfsHash; emit RecordedIpfsHash(_uid, _ipfsHash); }
  • 30. ERC721 SMART CONTRACT 2/2 … function mintUniqueTokenTo( address _to, uint256 _tokenId, string memory _tokenURI, string memory _ipfsHash ) public { super._mint(_to, _tokenId); super._setTokenURI(_tokenId, _tokenURI); _documents[_tokenId] = _ipfsHash; emit RecordedIpfsHash(_tokenId, _ipfsHash); } }
  • 31. DEPLOYING SMART CONTRACT TO BLOCKCHAIN
  • 32. CALLING SMART CONTRACT TO ISSUE NEW TOKEN
  • 33. VERIFYING THAT THE TOKEN WAS CREATED SUCCESSFULLY
  • 36. STAY IN TOUCH Gene Leybzon https://www.linkedin.com/in/leybzon/ https://www.meetup.com/members/90744 20/ https://www.leybzon.com

Editor's Notes

  1. https://www.ccn.com/smart-contracts-12-use-cases-for-business-and-beyond/
  2. https://kovan.etherscan.io/tx/0x878fea422658c0226cae626303aa814f7016fb0bbaca8f96a87b913e7975b634
  3. https://kovan.etherscan.io/tx/0xae695b8748620d89d08f7480723138de1cffdc39a40c6d72e210a681cab1fc27
  4. https://ethgasstation.info/
  5. https://hackernoon.com/storagepedia-an-encyclopedia-of-5-blockchain-storage-platform-8aa13c630ace
  6. https://en.wikipedia.org/wiki/BitTorrent
  7. https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
  8. https://en.wikipedia.org/wiki/Merkle_tree every leaf node is labelled with the hash of a data block, and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes
  9. https://en.wikipedia.org/wiki/Merkle_tree every leaf node is labelled with the hash of a data block, and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes Image from https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSG4yZSyyw91ZphCLwGfIu2cyP3bD2GEu8uy2FQXX1vvFEvkQqn&s
  10. https://console.cloud.google.com/ https://console.cloud.google.com/compute/instances?project=pbs-network-test&instancessize=50 “Create Instance” Select Ubuntu as boot disk
  11. https://console.cloud.google.com/networking/firewalls/add?project=pbs-network-test&authuser=0&hl=en
  12. ./go/bin/ipfs object get <hash> ./go/bin/ipfs cat <hash>
  13. ~/go/bin/ipfs daemon
  14. https://ipfs.infura.io:5001/api/v0/cat?arg=QmaqZ2DhwyxRFuYFrE3wxRwXCeRjZL1F8R5yxTfAUNE2Tx ./go/bin/ipfs cat QmaqZ2DhwyxRFuYFrE3wxRwXCeRjZL1F8R5yxTfAUNE2Tx
  15. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721Full.sol https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/79_ERC_721_IPFS.sol
  16. https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/79_ERC_721_IPFS.sol
  17. https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/79_ERC_721_IPFS.sol
  18. POST to https://{{blockchain}}.apidapp.com/1/contract
  19. Calling mintUniqueTokenTo({{id}},{{$randomInt}}{{$randomInt}},{{$randomString}},'QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1zk')
  20. https://kovan.etherscan.io/tx/0x09998673de181648fbd06ee732e8e10ea00810cfbcc3aac8c8dee8e1b39883a0