springboot数据上链FISCO BCOS
2026/5/13 14:44:44 网站建设 项目流程

创建合约

pragma solidity ^0.4.25; contract HelloWorld { string name; // 1. 新增Set事件:记录设置的值、调用者、时间(适配0.4.25) event Set(string newValue, address caller, uint256 timestamp); // 构造函数(0.4.25 语法:函数名与合约名相同) function HelloWorld() public { // 补public修饰符(0.4.25推荐) name = "Hello, World!"; } // 查询当前值(constant 等价于 0.5+ 的 view) function get() constant public returns(string) { // 补public修饰符 return name; } // 设置新值,并触发事件记录历史 function set(string n) public { // 补public修饰符 name = n; // 2. 触发事件:记录设置的值、调用者地址、区块时间 emit Set(n, msg.sender, block.timestamp); } }

项目导入IDEA

修改gradle-wrapper.properties

https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-6.6.1-bin.zip

新建fisco-config.xml

<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"> <bean> <property> <map> <entry key="certPath" value="conf" /> </map> </property> <property> <map> <ent

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询