English / [中文](doc/README_CN.md)
# Spring Boot Starter
The sample spring boot project is based on [Web3SDK](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/sdk/sdk.html), which provides the basic framework and basic test cases for blockchain application and helps developers to quickly develop applications based on the FISCO BCOS blockchain. **The version only supports** [FISCO BCOS 2.0](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/introduction.html).
## Quickstart
### Precodition
Build FISCO BCOS blockchain, please check out [here](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/installation.html)。
### Configuration
### Download
```
$ git clone https://github.com/FISCO-BCOS/spring-boot-starter.git
```
#### Certificate Configuration
Copy the `ca.crt`, `node.crt`, and `node.key` files in the node's directory `nodes/${ip}/sdk` to the project's `src/main/resources` directory.
#### Settings
The `application.yml` of the spring boot project is shown below, and the commented content is modified according to the blockchain node configuration.
```yml
encryptType: 0 # 0:standard, 1:guomi
groupChannelConnectionsConfig:
allChannelConnections:
- groupId: 1 #group ID
connectionsStr:
- 127.0.0.1:20200 # node listen_ip:channel_listen_port
- 127.0.0.1:20201
- groupId: 2
connectionsStr:
- 127.0.0.1:20202
- 127.0.0.1:20203
channelService:
groupId: 1 # The specified group to which the SDK connects
orgID: fisco # agency name
```
A detail description of the SDK configuration for the project, please checkout [ here](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/sdk/sdk.html#sdk)。
### Run
Compile and run test cases:
```
$ ./gradlew build
```
When all test cases run successfully, it means that the blockchain is running normally,and the project is connected to the blockchain through the SDK. You can develop your blockchain application based on the project。
## Test Case Introduction
The sample project provides test cases for developers to use. The test cases are mainly divided into tests for [Web3j API](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/sdk/sdk.html#web3j-api), [Precompiled Serveice API](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/sdk/sdk.html#precompiled-service-api), Solidity contract file to Java contract file, deployment and call contract.
### Web3j API Test
Provide `Web3jApiTest` class to test the Web3j API. The sample test is as follows:
```
@Test
public void getBlockNumber() throws IOException {
BigInteger blockNumber = web3j.getBlockNumber().send().getBlockNumber();
System.out.println(blockNumber);
assertTrue(blockNumber.compareTo(new BigInteger("0"))>= 0);
}
```
**Tips:** The `Application` class initializes the Web3j object, which can be used directly in the way where the business code needs it. The usage is as follows:
```
@Autowired
private Web3j web3j
```
### Precompiled Service API Test
Provide `PrecompiledServiceApiTest` class to test the Precompiled Service API。The sample test is as follows:
```API
@Test
public void testSystemConfigService() throws Exception {
SystemConfigSerivce systemConfigSerivce = new SystemConfigSerivce(web3j, credentials);
systemConfigSerivce.setValueByKey("tx_count_limit", "2000");
String value = web3j.getSystemConfigByKey("tx_count_limit").send().getSystemConfigByKey();
System.out.println(value);
assertTrue("2000".equals(value));
}
```
### Solidity contract file to Java contract file Test
Provide `SolidityFunctionWrapperGeneratorTest` class to test contract compilation. The sample test is as follows:
```API
@Test
public void compileSolFilesToJavaTest() throws IOException {
File solFileList = new File("src/test/resources/contract");
File[] solFiles = solFileList.listFiles();
for (File solFile : solFiles) {
SolidityCompiler.Result res = SolidityCompiler.compile(solFile, true, ABI, BIN, INTERFACE, METADATA);
System.out.println("Out: '" + res.output + "'");
System.out.println("Err: '" + res.errors + "'");
CompilationResult result = CompilationResult.parse(res.output);
System.out.println("contractname " + solFile.getName());
Path source = Paths.get(solFile.getPath());
String contractname = solFile.getName().split("\\.")[0];
CompilationResult.ContractMetadata a = result.getContract(solFile.getName().split("\\.")[0]);
System.out.println("abi " + a.abi);
System.out.println("bin " + a.bin);
FileUtils.writeStringToFile(new File("src/test/resources/solidity/" + contractname + ".abi"), a.abi);
FileUtils.writeStringToFile(new File("src/test/resources/solidity/" + contractname + ".bin"), a.bin);
String binFile;
String abiFile;
String tempDirPath = new File("src/test/java/").getAbsolutePath();
String packageName = "org.fisco.bcos.temp";
String filename = contractname;
abiFile = "src/test/resources/solidity/" + filename + ".abi";
binFile = "src/test/resources/solidity/" + filename + ".bin";
SolidityFunctionWrapperGenerator.main(Arrays.asList(
"-a", abiFile,
"-b", binFile,
"-p", packageName,
"-o", tempDirPath
).toArray(new String[0]));
}
System.out.println("generate successfully");
}
```
This test case converts all Solidity contract files (`HelloWorld` contract provided by default) in the `src/test/resources/contract` directory to the corresponding `abi` and `bin` files, and save them in the `src/test/resources/solidity` directory. Then convert the `abi` file and the corresponding `bin` file combination into a Java contract file, which is saved in the `src/test/java/org/fisco/bcos/temp` directory. The SDK will use the Java contract file for contract deployment and invocation.
### Deployment and Invocation Contract Test
Provide `ContractTest` class to test deploy and call contracts. The sample test is as follows:
```
@Test
public void deployAndCallHelloWorld() throws Exception {
//deploy contract
HelloWorld helloWorld = HelloWorld.deploy(web3j, credentials, new StaticGasProvider(gasPrice, gasLimit)).send();
if (helloWorld != null) {
System.out.println("HelloWorld address is: " + helloWorld.getContractAddress());
//call set function
helloWorld.set("Hello, World!").send();
//call get function
String result = helloWorld.get().send();
System.out.println(result);
assertTrue( "Hello, World!".equals(result));
}
}
```
## Related Links
- For FISCO BCOS project, please check out [FISCO BCOS Documentation](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/introduction.html)。
- For Web3SDK project, please check out [Web3SDK Documentation](https://fisco-bcos-documentation.readthedocs.io/zh_CN/release-2.0/docs/sdk/sdk.html)。
- For Spring Boot applications, please check out [Spring Boot](https://spring.io/guides/gs/spring-boot/)。
## Community
By the end of 2018, Financial Blockchain Shenzhen Consortium (FISCO) has attracted and admitted more than 100 members from 6 sectors including banking, fund management, securities brokerage, insurance, regional equity exchanges, and financial information service companies. The first members include the following organizations: Beyondsoft, Huawei, Shenzhen Securities Communications, Digital China, Forms Syntron, Tencent, WeBank, Yuexiu FinTech.
- Join our WeChat [![Scan](https://img.shields.io/badge/style-Scan_QR_Code-green.svg?logo=wechat&longCache=false&style=social&label=Group)](doc/images/WeChatQR.jpeg)
- Discuss in [![Gitter](https://img.shields.io/badge/style-on_gitter-green.svg?logo=gitter&longCache=false&style=social&label=Chat)](https://gitter.im
没有合适的资源?快使用搜索试试~ 我知道了~
基于 FISCO-BCOS 区块链平台开发的去中心化征信数据平台源码+详细文档+全部资料(毕业设计).zip
共99个文件
java:49个
crt:6个
abi:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 57 浏览量
2024-04-15
17:25:49
上传
评论 1
收藏 765KB ZIP 举报
温馨提示
【资源说明】 基于 FISCO-BCOS 区块链平台开发的去中心化征信数据平台源码+全部资料(毕业设计).zip基于 FISCO-BCOS 区块链平台开发的去中心化征信数据平台。源码+全部资料(毕业设计).zip 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如软件工程、计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也可作为毕设项目、课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 3、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
基于 FISCO-BCOS 区块链平台开发的去中心化征信数据平台。源码+全部资料(毕业设计).zip (99个子文件)
openCredit-master
.DS_Store 6KB
spring-boot-starter
gradle
wrapper
gradle-wrapper.jar 54KB
gradle-wrapper.properties 232B
.travis.yml 638B
src
test
resources
contract
HelloWorld.sol 279B
Credit.sol 3KB
Record.sol 5KB
solidity
Credit.abi 660B
Record.bin 13KB
Credit.bin 6KB
Record.abi 2KB
HelloWorld.abi 375B
HelloWorld.bin 2KB
java
org
fisco
bcos
ServiceTest.java 944B
PrecompiledServiceApiTest.java 1KB
temp
HelloWorld.java 7KB
Record.java 31KB
Credit.java 16KB
ContractTest.java 7KB
solidity
HelloWorld.java 7KB
SolidityFunctionWrapperGeneratorTest.java 3KB
Web3jApiTest.java 922B
server
Channel2Server.java 1KB
Channel2Client.java 2KB
ProxyServerTest.java 1KB
PushCallback.java 824B
main
resources
contract
HelloWorld.sol 279B
Credit.sol 2KB
fisco.properties 429B
logback.groovy 2KB
application.properties 172B
solidity
Credit.abi 1KB
Credit.bin 6KB
HelloWorld.abi 375B
HelloWorld.bin 2KB
application.yml 471B
java
org
fisco
bcos
Application.java 2KB
autoconfigure
EncryptTypeConfig.java 607B
ServiceConfig.java 1KB
GroupChannelConnectionsPropertyConfig.java 1KB
Web3jConfig.java 2KB
ContractConfig.java 3KB
controller
RecordController.java 14KB
CreditController.java 5KB
HelloController.java 2KB
utils
SolidityTools.java 2KB
service
RequireRecordRepository.java 513B
SendRecordRepository.java 319B
OriginCreditRepository.java 260B
SavedCreditRepository.java 256B
web3sdk
constant
OpenCreditConstants.java 3KB
BrokerException.java 2KB
ErrorCode.java 5KB
Web3SDK2Wrapper.java 14KB
util
DataTypeUtils.java 4KB
SystemInfoUtils.java 1KB
Web3sdkUtils.java 2KB
StoppableTask.java 2KB
LRUCache.java 1KB
WeEventUtils.java 2KB
KeyInfoUtils.java 14KB
SerializeUtils.java 3KB
config
FiscoConfig.java 4KB
solidity
HelloWorld.java 7KB
Record.java 30KB
Credit.java 15KB
domain
OriginCredit.java 1KB
SavedCredit.java 915B
SendRecord.java 3KB
RequiredRecord.java 4KB
bean
CreditData.java 1KB
RecordData.java 3KB
gradlew.bat 3KB
build.gradle 2KB
settings.gradle 218B
start.sh 1KB
Dockerfile 55B
gradlew 6KB
.gitignore 720B
run.sh 207B
lombok.config 94B
README.md 8KB
nginx
conf.d
app.conf 476B
docker-compose.yaml 892B
API.md 3KB
img
system-design.png 600KB
.gitignore 4B
README.md 3KB
tmp_key
node_47.107.32.140_30303
ca.crt 1KB
node.nodeid 129B
node.crt 2KB
node.key 237B
sdk
ca.crt 1KB
node.crt 2KB
node.key 237B
sdk_zwm
ca.crt 1KB
node.crt 2KB
node.key 237B
171265889347208773632.zip 416B
共 99 条
- 1
资源评论
不走小道
- 粉丝: 3217
- 资源: 5113
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功