A blockchain is a type of digital ledger
A blockchain is a type of digital ledger
Text
Combination of Technologies: Blockchain is not a single technology but a blend of various technologies and techniques, aiming for decentralization, scalability, and security.
Selective Application: Not all applications require blockchain. It's most beneficial for digital currencies, decentralized finance, and decentralized ownership records (NFTs).
Diverse Implementations: Multiple blockchain platforms exist, each with unique approaches to data storage, real-time data replication, consensus mechanisms, and balancing decentralization, security, and scalability.
Trade-offs in Design: Each blockchain platform makes different trade-offs, particularly in aspects like gas fees for smart contracts.
Integration with Traditional Web Technologies: While some web3 applications are predominantly blockchain-based, many still utilize web servers and databases due to blockchains' compromises in certain desirable properties.
Limitations in Processing and Storage: Smart contracts can be slow to process (15 seconds to 1.5 minutes) due to the need for network-wide consensus. Also, blockchains are inefficient for general data storage as replication across the network is slow, costly, and permanent, making it unsuitable for data not requiring high security.
Architecture and Functionality
Architecture and Functionality
Cost-Efficiency and User Interaction
Deployment of Pact Smart Contracts
Deployment of Pact Smart Contracts
; example.pact
(module coin ...
(defun my-function ()
...)
)
; after deploying you can call it using chainweb-node api (usually done vai a client library)
(coin.my-function)Bridging Kadena and Web Frontends
;; hello-world.pact
;; All Pact modules must exist within a namespace on Chainweb,
;; except for basic contracts provided by Kadena.
;; There are two namespaces available for anyone'free' and 'user'
(namespace 'free )
;; Define `hello-world` module with the `G` capability
(module hello-world G
(defcap G () true)
(defun say-hello(name:string)
(format "Hello, {}!" [name])
)
)
;; hello-world.repl
;; pact code expects to be run on a chainweb enviroment
;; for testing purposes, we can use the pact repl to simulate a chainweb environment
;; begin-tx and commit-tx simulate a transaction
(begin-tx "Load modules")
;; set transaction JSON data
(env-data {
'hello-ks: { "keys": [], "pred": "keys-all" }
})
(define-namespace "free" (read-keyset "hello-ks") (read-keyset "hello-ks"))
;; load hello-world
(load "hello-world.pact")
;; run hello-world say-hello
(print (hello-world.say-hello "Salama"))
;; commit the transaction
(commit-tx)
brew install kadena-io/pact/pact
# create hello-world.pact and hello-world.repl then run pact cli
pact hello-world.repl
Hello, Salama!
Load successful