Stepn跑鞋/jogger慢跑者跑鞋NFT链游分红系统开发(详情介绍)/逻辑开发/方案逻辑/源码
区块链的主要作用是储存信息。任何需要保存的信息,都可以写入区块链,也可以从里面读取,所以它是数据库。 其次,任何人都可以架设服务器,加入区块链网络,成为一个节点。区块链的世界里面,没有中心节点,每个节点都是平等的,都保存着整个数据库。你可以向任何一个节点,写入/读取数据,因为所有节点最后都会同步,保证区块链一致 区块链技术还有一个很重要的优势就是可追溯性和不可篡改性。在区块链上进行的每一笔交易都会被记录在区块链上,并且这些交易记录都是透明的,任何人都可以查看。Moreover,these records are tamperproof and will be immediately recognized even if someone wants to modify them.In this way,the security and fairness of the transaction are ensured. from web3.auto.infura.kovan import w3 from contract import CalSelector #bytes4(keccak256('isApprovedForAll(address,address)'))==0xe985e9c5 func='isApprovedForAll(address,address)' #0x70a08231^0x6352211e^0x095ea7b3^0x081812fc^ #0xa22cb465^0xe985e9c^0x23b872dd^0x42842e0e^0xb88d4fde==0x80ac58cd selectors=[ 0x70a08231, 0x6352211e, 0x095ea7b3, 0x081812fc, 0xa22cb465, 0xe985e9c5, 0x23b872dd, 0x42842e0e, 0xb88d4fde ] def calSelectorByPython(_func): result=w3.keccak(text=_func) selector=(w3.toHex(result))[:10] return selector def calSelectorBySolidity(_func): selector=CalSelector.functions.getSelector(_func).call() return w3.toHex(selector) def calSupportedInterfaceByPython(_selectors): result=int('0x00000000',16) for selector in _selectors: result=result^selector return w3.toHex(result) def calSupportedInterfaceBySolidity(_selectors): _param=[w3.toBytes(selector)for selector in _selectors] supported_interface=CalSelector.functions.getSupportedInterface(_param).call() return w3.toHex(supported_interface) if __name__=="__main__": print(calSelectorByPython(func)) print(calSelectorBySolidity(func)) print('————————-') print(calSupportedInterfaceByPython(selectors)) print(calSupportedInterfaceBySolidity(selectors))
发表回复