A smart contract is a computer program that runs on a blockchain. Programs include functions and data (also known as variables or parameters), which operate on data. The data used by the function needs to be stored in the computer's memory
From a technical perspective, blockchain enables every node of digital asset value flow to be transparent, traceable, and tamper proof, making all transactions in the Web 3.0 era more authentic and trustworthy.
At the same time, data ownership can be determined through blockchain technology, achieving data assetization, which will also make blockchain the infrastructure of the Web 3.0 era.
function setBaseURI(string memory _newBaseURI)public onlyOwner{
baseURI=_newBaseURI;
}
function _baseURI()internal view virtual override returns(string memory){
return baseURI;
}
func(e*PeerConfiger)joinChain(
chainID string,
block*common.Block,
deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider,
lr plugindispatcher.LifecycleResources,
nr plugindispatcher.CollectionAndLifecycleResources,
)pb.Response{
if err:=e.peer.CreateChannel(chainID,block,deployedCCInfoProvider,lr,nr);err!=nil{
return shim.Error(err.Error())
}
return shim.Success(nil)
}
func(p*Peer)CreateChannel(
cid string,
cb*common.Block,
deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider,
legacyLifecycleValidation plugindispatcher.LifecycleResources,
newLifecycleValidation plugindispatcher.CollectionAndLifecycleResources,
)error{
l,err:=p.LedgerMgr.CreateLedger(cid,cb)
if err!=nil{
return errors.WithMessage(err,"cannot create ledger from genesis block")
}
if err:=p.createChannel(cid,l,cb,p.pluginMapper,deployedCCInfoProvider,legacyLifecycleValidation,newLifecycleValidation);err!=nil{
return err
}
p.initChannel(cid)
return nil
}