欢迎光临散文网 会员登陆 & 注册

defi/dapp/lp质押挖矿系统开发(案例及功能)丨详细源码

2023-04-11 16:05 作者:bili_80700014930  | 我要投稿

  一、什么是DAPP(分布式应用)?


  1.DAPP是Decentralized Application的缩写,中文叫分布式应用/去中心化应用,通常来说,不同的DAPP会采用不同的底层区块练开发平台和共识机制,或者自行发布代币(也可以使用基于相同区块练平台的通用代币)。


  2.DAPP不同的底层区块练开发平台旧好比手机的IOS系统和Android系统,是各DAPP的底层生态环境。DAPP旧是底层区块练平台生态上衍生的各种分布式应用,也是区块练世介中的基础服务提供方。DAPP于区块练,旧好比APP之于IOS和Android。


  3.DAPP根据区块练,模式分析唯:MrsFu123,首要出现在以太坊、EOS等新晋分布式途径或网络上,不依赖任何中心服务器,完成去中心化的目的。与PC和手机上的传统APP不同的是,DAPP坚决强调去中心化,有必要运行在分布式的操作系统,而不能作业在iOS及Android这些传统途径上。


  Test


  public void deplyContract()throws Exception{


  //RPC调用url(此处为ropsten)


  Web3j web3=Web3j.build(new HttpService("https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"));


  Credentials credentials=Credentials.create


  //加载已经部署在链上的合约


  BigInteger gasPrice=web3.ethGasPrice().send().getGasPrice();


  LeaveMsg contract=LeaveMsg.load("填入自己已部署的合约地址账",web3,credentials,


  new StaticGasProvider(gasPrice,BigInteger.valueOf(3000000L)));


  //部署合约,获取合约地址


  //LeaveMsg contract=LeaveMsg.deploy(web3,credentials,web3.ethGasPrice().send().getGasPrice()


  //,Contract.GAS_PRICE).send();


  //System.out.println(contract.getContractAddress());


  //LeaveMsg contract=LeaveMsg.load("0xE3720A6D1dA0b27aCd735aA5Bc121d7AbD55Ff68",web3,credentials,


  //GAS_PRICE,GAS_LIMIT);


  //异步调用写法


  RemoteFunctionCall<TransactionReceipt>setWord=contract.setWord("这是一条java测试留言11111111","8888");


  TransactionReceipt transactionReceipt=setWord.sendAsync().get();


  String transactionHash=transactionReceipt.getTransactionHash();


  System.out.println(transactionHash);


  //TransactionReceipt send1=setWord.send();


  //String blockHash=send1.getBlockHash();


  //System.out.println(blockHash);


  //RemoteFunctionCall<Tuple4<BigInteger,String,String,String>>randomWord=contract.getRandomWord(new BigInteger("7"));


  //Tuple4<BigInteger,String,String,String>send=randomWord.send();


  //System.out.println(send.toString());


defi/dapp/lp质押挖矿系统开发(案例及功能)丨详细源码的评论 (共 条)

分享到微博请遵守国家法律