weiyang**4.合约

        通过合约开发,合约编译,SDK配置与业务开发构建了一个基于FISCO BCOS联盟区块链的应用。

官网:开发第一个区块链应用 — FISCO BCOS 2.0 v2.11.0 文档 (fisco-bcos-documentation.readthedocs.io)

CSDN:FISCO BCOS开发第一个区块链应用--小白实战_fisco bcos 前后端开发-CSDN博客

一、智能合约编写

1、设计智能合约

1.1 存储设计

1.2 接口设计

按照业务的设计目标,需要实现资产注册,转账,查询功能,对应功能的接口如下:

// 查询资产金额

function select(string account) public constant returns(int256, uint256)

// 资产注册

function register(string account, uint256 amount) public returns(int256)

// 资产转移

function transfer(string from_asset_account, string to_asset_account, uint256 amount) public returns(int256)

2、开发合约

2.1 安装JDK以及IntelliJ IDEA开发环境

2.2 下载官方源码

cd ~/fisco
curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/tools/asset-app.tar.gz
# 解压得到Java工程项目asset-app
tar -zxf asset-app.tar.gz

将asset-app项目从ubunte系统挪到window本地,然后用IntelliJ IDEA打开

以下是基于官方源码进行修改

2.2 代码结构

|-- build.gradle // gradle配置文件
|-- gradle
|   |-- wrapper
|       |-- gradle-wrapper.jar // 用于下载Gradle的相关代码实现
|       |-- gradle-wrapper.properties // wrapper所使用的配置信息,比如gradle的版本等信息
|-- gradlew // Linux或者Unix下用于执行wrapper命令的Shell脚本
|-- gradlew.bat // Windows下用于执行wrapper命令的批处理脚本
|-- src
|   |-- main
|   |   |-- java
|   |   |     |-- org
|   |   |          |-- fisco
|   |   |                |-- bcos
|   |   |                      |-- asset
|   |   |                            |-- client // 放置客户端调用类
|   |   |                                   |-- AssetClient.java
|   |   |                            |-- contract // 放置Java合约类
|   |   |                                   |-- Asset.java
|   |   |-- resources
|   |        |-- conf
|   |               |-- ca.crt
|   |               |-- node.crt
|   |               |-- node.key
|   |               |-- sdk.crt
|   |               |-- sdk.key
|   |               |-- sdk.publickey
|   |        |-- applicationContext.xml // 项目配置文件
|   |        |-- contract.properties // 存储部署合约地址的文件
|   |        |-- log4j.properties // 日志配置文件
|   |        |-- contract //存放solidity约文件
|   |                |-- Asset.sol
|   |                |-- Table.sol
|   |-- test
|       |-- resources // 存放代码资源文件
|           |-- conf
|                  |-- ca.crt
|                  |-- node.crt
|                  |-- node.key
|                  |-- sdk.crt
|                  |-- sdk.key
|                  |-- sdk.publickey
|           |-- applicationContext.xml // 项目配置文件
|           |-- contract.properties // 存储部署合约地址的文件
|           |-- log4j.properties // 日志配置文件
|           |-- contract //存放solidity约文件
|                   |-- Asset.sol
|                   |-- Table.sol
|
|-- tool
    |-- asset_run.sh // 项目运行脚本

2.3 配置build.gradle依赖包

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'eclipse'


sourceCompatibility = 1.8
targetCompatibility = 1.8

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

// In this section you declare where to find the dependencies of your project
repositories {
    mavenCentral()
    maven {
		allowInsecureProtocol = true
        url "http://maven.aliyun.com/nexus/content/groups/public/"
    }
    maven {
		allowInsecureProtocol = true
		url "https://oss.sonatype.org/content/repositories/snapshots"
	}
}


List logger = [
	'org.slf4j:slf4j-log4j12:1.7.32'
]

def spring_version = "5.3.17"
List spring = [
		"org.springframework:spring-core:$spring_version",
		"org.springframework:spring-beans:$spring_version",
		"org.springframework:spring-context:$spring_version",
		"org.springframework:spring-tx:$spring_version",
]

// In this section you declare the dependencies for your production and test code
dependencies {
	testImplementation group: 'junit', name: 'junit', version: '4.12'
	implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.9.1')
	implementation spring
    compile logger
    runtime logger
    compile ("org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.9.0")
	compile spring
}

jar {
	destinationDir file('dist/apps')
	archiveName project.name + '.jar'
	exclude '**/*.xml'
	exclude '**/*.properties'
	exclude '**/*.crt'
	exclude '**/*.key'

    doLast {
		copy {
			from configurations.runtime
			into 'dist/lib'
		}
		copy {
			from file('src/test/resources/')
			into 'dist/conf'
		}
		copy {
			from file('tool/')
			into 'dist/'
		}
		copy {
			from file('src/test/resources/contract')
			into 'dist/contract'
		}
	}
}

2.4 创建配置文件applicationContext.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 id="defaultConfigProperty" class="org.fisco.bcos.sdk.config.model.ConfigProperty">
		<property name="cryptoMaterial">
			<map>
			<entry key="certPath" value="conf" />
			<!-- SSL certificate configuration -->
			<!-- entry key="caCert" value="conf/ca.crt" /-->
			<!-- entry key="sslCert" value="conf/sdk.crt" /-->
			<!-- entry key="sslKey" value="conf/sdk.key" /-->
			<!-- GM SSL certificate configuration -->
			<!-- entry key="caCert" value="conf/gm/gmca.crt" /-->
			<!-- entry key="sslCert" value="conf/gm/gmsdk.crt" /-->
			<!-- entry key="sslKey" value="conf/gm/gmsdk.key" /-->
			<!--entry key="enSslCert" value="conf/gm/gmensdk.crt" /-->
			<!--entry key="enSslKey" value="conf/gm/gmensdk.key" /-->
			</map>
		</property>
		<property name="network">
			<map>
				<entry key="peers">
					<list>
						<value>127.0.0.1:20200</value>
						<value>127.0.0.1:20201</value>
					</list>
				</entry>
			</map>
		</property>
		<!--
		<property name="amop">
			<list>
				<bean id="amopTopic1" class="org.fisco.bcos.sdk.config.model.AmopTopic">
					<property name="topicName" value="PrivateTopic1" />
					<property name="password" value="" />
					<property name="privateKey" value="" />
					<property name="publicKeys">
						<list>
							<value>conf/amop/consumer_public_key_1.pem</value>
						</list>
					</property>
				</bean>
			</list>
		</property>
		-->
		<property name="account">
			<map>
				<entry key="keyStoreDir" value="account" />
				<entry key="accountAddress" value="" />
				<entry key="accountFileFormat" value="pem" />
				<entry key="password" value="" />
				<entry key="accountFilePath" value="" />
			</map>
		</property>
		<property name="threadPool">
			<map>
			<entry key="channelProcessorThreadSize" value="16" />
			<entry key="receiptProcessorThreadSize" value="16" />
			<entry key="maxBlockingQueueSize" value="102400" />
			</map>
		</property>
	</bean>

	<bean id="defaultConfigOption" class="org.fisco.bcos.sdk.config.ConfigOption">
		<constructor-arg name="configProperty">
				<ref bean="defaultConfigProperty"/>
		</constructor-arg>
	</bean>

	<bean id="bcosSDK" class="org.fisco.bcos.sdk.BcosSDK">
		<constructor-arg name="configOption">
			<ref bean="defaultConfigOption"/>
		</constructor-arg>
	</bean>
</beans>

2.5 Java合约Asset .class

package org.fisco.bcos.asset.contract;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Event;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Int256;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.eventsub.EventCallback;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class Asset extends Contract {
  public static final String[] BINARY_ARRAY = {
    "608060405234801561001057600080fd5b5061002861002d640100000000026401000000009004565b610185565b600061100190508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001848103835260078152602001807f6163636f756e74000000000000000000000000000000000000000000000000008152506020018481038252600b8152602001807f61737365745f76616c75650000000000000000000000000000000000000000008152506020019350505050602060405180830381600087803b15801561014657600080fd5b505af115801561015a573d6000803e3d6000fd5b505050506040513d602081101561017057600080fd5b81019080805190602001909291905050505050565b611e3780620001956000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680639b80b0501461005c578063ea87152b14610129578063fcd7e3c1146101b0575b600080fd5b34801561006857600080fd5b50610113600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610234565b6040518082815260200191505060405180910390f35b34801561013557600080fd5b5061019a600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001909291905050506112c8565b6040518082815260200191505060405180910390f35b3480156101bc57600080fd5b50610217600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506117d7565b604051808381526020018281526020019250505060405180910390f35b600080600080600080600080600080975060009650600095506000945061025a8c6117d7565b8097508198505050600087141515610395577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9750898b6040518082805190602001908083835b6020831015156102c657805182526020820191506020810190506020830392506102a1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b6020831015156103295780518252602082019150602081019050602083039250610304565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798506112b9565b61039e8b6117d7565b80965081985050506000871415156104d9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9750898b6040518082805190602001908083835b60208310151561040a57805182526020820191506020810190506020830392506103e5565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b60208310151561046d5780518252602082019150602081019050602083039250610448565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798506112b9565b8986101561060a577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd9750898b6040518082805190602001908083835b60208310151561053b5780518252602082019150602081019050602083039250610516565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b60208310151561059e5780518252602082019150602081019050602083039250610579565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798506112b9565b848a8601101561073d577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9750898b6040518082805190602001908083835b60208310151561066e5780518252602082019150602081019050602083039250610649565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b6020831015156106d157805182526020820191506020810190506020830392506106ac565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798506112b9565b610745611d1c565b93508373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b505050506040513d60208110156107d557600080fd5b810190808051906020019092919050505092508273ffffffffffffffffffffffffffffffffffffffff1663e942b5168d6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156108a857808201518184015260208101905061088d565b50505050905090810190601f1680156108d55780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b88036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b1580156109b757600080fd5b505af11580156109cb573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18d858773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610a5157600080fd5b505af1158015610a65573d6000803e3d6000fd5b505050506040513d6020811015610a7b57600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b83811015610b5b578082015181840152602081019050610b40565b50505050905090810190601f168015610b885780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050506040513d6020811015610bd357600080fd5b81019080805190602001909291905050509150600182141515610d19577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb9750898b6040518082805190602001908083835b602083101515610c4a5780518252602082019150602081019050602083039250610c25565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b602083101515610cad5780518252602082019150602081019050602083039250610c88565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798506112b9565b8373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d7d57600080fd5b505af1158015610d91573d6000803e3d6000fd5b505050506040513d6020811015610da757600080fd5b810190808051906020019092919050505090508073ffffffffffffffffffffffffffffffffffffffff1663e942b5168c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610e7a57808201",
    "5181840152602081019050610e5f565b50505050905090810190601f168015610ea75780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610ec757600080fd5b505af1158015610edb573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b87016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b158015610f8957600080fd5b505af1158015610f9d573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18c838773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561102357600080fd5b505af1158015611037573d6000803e3d6000fd5b505050506040513d602081101561104d57600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b8381101561112d578082015181840152602081019050611112565b50505050905090810190601f16801561115a5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561117b57600080fd5b505af115801561118f573d6000803e3d6000fd5b505050506040513d60208110156111a557600080fd5b810190808051906020019092919050505050898b6040518082805190602001908083835b6020831015156111ee57805182526020820191506020810190506020830392506111c9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b602083101515611251578051825260208201915060208101905060208303925061122c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd8b6040518082815260200191505060405180910390a48798505b50505050505050509392505050565b600080600080600080600080955060009450600093506112e7896117d7565b809550819650505060008514151561170957611301611d1c565b92508273ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561136757600080fd5b505af115801561137b573d6000803e3d6000fd5b505050506040513d602081101561139157600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663e942b5168a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015611464578082015181840152602081019050611449565b50505050905090810190601f1680156114915780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156114b157600080fd5b505af11580156114c5573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16632ef8ba74896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b15801561157157600080fd5b505af1158015611585573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff166331afac368a846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611644578082015181840152602081019050611629565b50505050905090810190601f1680156116715780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561169157600080fd5b505af11580156116a5573d6000803e3d6000fd5b505050506040513d60208110156116bb57600080fd5b8101908080519060200190929190505050905060018114156116e05760009550611704565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe95505b61172d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff95505b87896040518082805190602001908083835b602083101515611764578051825260208201915060208101905060208303925061173f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d886040518082815260200191505060405180910390a385965050505050505092915050565b600080600080600080600061100194508473ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050506040513d60208110156118b157600080fd5b810190808051906020019092919050505093508373ffffffffffffffffffffffffffffffffffffffff1663e8434e39898673ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561194557600080fd5b505af1158015611959573d6000803e3d6000fd5b505050506040513d602081101561196f57600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611a1d578082015181840152602081019050611a02565b50505050905090810190601f168015611a4a5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611a6a57600080fd5b505af1158015611a7e573d6000803e3d6000fd5b505050506040513d6020811015611a9457600080fd5b81019080805190602001909291905050509250600091508273ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611b0f57600080fd5b505af1158015611b23573d6000803e3d6000fd5b505050506040513d6020811015611b3957600080fd5b810190808051906020019092919050505060001415611b80577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8281915096509650611d12565b8273ffffffffffffffffffffffffffffffffffffffff1663846719e060006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015611bf057600080fd5b505af1158015611c04573d6000803e3d6000fd5b505050506040513d6020811015611c1a57600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff1663fda69fae6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018281038252600b8152602001807f61737365745f76616c7565000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611ccf57600080fd5b505af1158015611ce3573d6000803e3d6000fd5b505050506040513d6020811015611cf957600080fd5b8101908080519060200190929190505050819150965096505b5050505050915091565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611dc657600080fd5b505af1158015611dda573d6000803e3d6000fd5b505050506040513d6020811015611df057600080fd5b810190808051906020019092919050505090508092505050905600a165627a7a723058209583b88d65be16c71022714a76c8e98f0100607bcaab1f86faf7bc9433e6f36f0029"
  };

  public static final String BINARY = String.join("", BINARY_ARRAY);

  public static final String[] SM_BINARY_ARRAY = {
    "608060405234801561001057600080fd5b5061002861002d640100000000026401000000009004565b610185565b600061100190508073ffffffffffffffffffffffffffffffffffffffff1663c92a78016040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001848103835260078152602001807f6163636f756e74000000000000000000000000000000000000000000000000008152506020018481038252600b8152602001807f61737365745f76616c75650000000000000000000000000000000000000000008152506020019350505050602060405180830381600087803b15801561014657600080fd5b505af115801561015a573d6000803e3d6000fd5b505050506040513d602081101561017057600080fd5b81019080805190602001909291905050505050565b611e3780620001956000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635b325d781461005c578063612d2bff146100e0578063b433c7ca146101ad575b600080fd5b34801561006857600080fd5b506100c3600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610234565b604051808381526020018281526020019250505060405180910390f35b3480156100ec57600080fd5b50610197600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610779565b6040518082815260200191505060405180910390f35b3480156101b957600080fd5b5061021e600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919050505061180d565b6040518082815260200191505060405180910390f35b600080600080600080600061100194508473ffffffffffffffffffffffffffffffffffffffff166359a48b656040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b1580156102e457600080fd5b505af11580156102f8573d6000803e3d6000fd5b505050506040513d602081101561030e57600080fd5b810190808051906020019092919050505093508373ffffffffffffffffffffffffffffffffffffffff1663d8ac5957898673ffffffffffffffffffffffffffffffffffffffff1663c74f8caf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156103a257600080fd5b505af11580156103b6573d6000803e3d6000fd5b505050506040513d60208110156103cc57600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b8381101561047a57808201518184015260208101905061045f565b50505050905090810190601f1680156104a75780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156104c757600080fd5b505af11580156104db573d6000803e3d6000fd5b505050506040513d60208110156104f157600080fd5b81019080805190602001909291905050509250600091508273ffffffffffffffffffffffffffffffffffffffff1663d3e9af5a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561056c57600080fd5b505af1158015610580573d6000803e3d6000fd5b505050506040513d602081101561059657600080fd5b8101908080519060200190929190505050600014156105dd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff828191509650965061076f565b8273ffffffffffffffffffffffffffffffffffffffff16633dd2b61460006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b505050506040513d602081101561067757600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff16634900862e6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018281038252600b8152602001807f61737365745f76616c7565000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b15801561072c57600080fd5b505af1158015610740573d6000803e3d6000fd5b505050506040513d602081101561075657600080fd5b8101908080519060200190929190505050819150965096505b5050505050915091565b600080600080600080600080600080975060009650600095506000945061079f8c610234565b80975081985050506000871415156108da577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9750898b6040518082805190602001908083835b60208310151561080b57805182526020820191506020810190506020830392506107e6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b60208310151561086e5780518252602082019150602081019050602083039250610849565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798506117fe565b6108e38b610234565b8096508198505050600087141515610a1e577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9750898b6040518082805190602001908083835b60208310151561094f578051825260208201915060208101905060208303925061092a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b6020831015156109b2578051825260208201915060208101905060208303925061098d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798506117fe565b89861015610b4f577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd9750898b6040518082805190602001908083835b602083101515610a805780518252602082019150602081019050602083039250610a5b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b602083101515610ae35780518252602082019150602081019050602083039250610abe565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798506117fe565b848a86011015610c82577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9750898b6040518082805190602001908083835b602083101515610bb35780518252602082019150602081019050602083039250610b8e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b602083101515610c165780518252602082019150602081019050602083039250610bf1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798506117fe565b610c8a611d1c565b93508373ffffffffffffffffffffffffffffffffffffffff16635887ab246040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610cf057600080fd5b505af1158015610d04573d6000803e3d6000fd5b505050506040513d6020811015610d1a57600080fd5b810190808051906020019092919050505092508273ffffffffffffffffffffffffffffffffffffffff16631a391cb48d6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610ded578082015181840152602081019050610dd2565b50505050905090810190601f168015610e1a5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff1663",
    "def426988b88036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b158015610efc57600080fd5b505af1158015610f10573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663664b37d68d858773ffffffffffffffffffffffffffffffffffffffff1663c74f8caf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610f9657600080fd5b505af1158015610faa573d6000803e3d6000fd5b505050506040513d6020811015610fc057600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156110a0578082015181840152602081019050611085565b50505050905090810190601f1680156110cd5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156110ee57600080fd5b505af1158015611102573d6000803e3d6000fd5b505050506040513d602081101561111857600080fd5b8101908080519060200190929190505050915060018214151561125e577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb9750898b6040518082805190602001908083835b60208310151561118f578051825260208201915060208101905060208303925061116a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b6020831015156111f257805182526020820191506020810190506020830392506111cd565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798506117fe565b8373ffffffffffffffffffffffffffffffffffffffff16635887ab246040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156112c257600080fd5b505af11580156112d6573d6000803e3d6000fd5b505050506040513d60208110156112ec57600080fd5b810190808051906020019092919050505090508073ffffffffffffffffffffffffffffffffffffffff16631a391cb48c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156113bf5780820151818401526020810190506113a4565b50505050905090810190601f1680156113ec5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561140c57600080fd5b505af1158015611420573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff1663def426988b87016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b1580156114ce57600080fd5b505af11580156114e2573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663664b37d68c838773ffffffffffffffffffffffffffffffffffffffff1663c74f8caf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561156857600080fd5b505af115801561157c573d6000803e3d6000fd5b505050506040513d602081101561159257600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b83811015611672578082015181840152602081019050611657565b50505050905090810190601f16801561169f5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156116c057600080fd5b505af11580156116d4573d6000803e3d6000fd5b505050506040513d60208110156116ea57600080fd5b810190808051906020019092919050505050898b6040518082805190602001908083835b602083101515611733578051825260208201915060208101905060208303925061170e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208d6040518082805190602001908083835b6020831015156117965780518252602082019150602081019050602083039250611771565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f105af2c562df33af7eaa9de5fb0c18d8d30f281a18f95a8f76b44353a322693c8b6040518082815260200191505060405180910390a48798505b50505050505050509392505050565b6000806000806000806000809550600094506000935061182c89610234565b8095508196505050600085141515611c4e57611846611d1c565b92508273ffffffffffffffffffffffffffffffffffffffff16635887ab246040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156118ac57600080fd5b505af11580156118c0573d6000803e3d6000fd5b505050506040513d60208110156118d657600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff16631a391cb48a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156119a957808201518184015260208101905061198e565b50505050905090810190601f1680156119d65780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156119f657600080fd5b505af1158015611a0a573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff1663def42698896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b158015611ab657600080fd5b505af1158015611aca573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16634c6f30c08a846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611b89578082015181840152602081019050611b6e565b50505050905090810190601f168015611bb65780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611bd657600080fd5b505af1158015611bea573d6000803e3d6000fd5b505050506040513d6020811015611c0057600080fd5b810190808051906020019092919050505090506001811415611c255760009550611c49565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe95505b611c72565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff95505b87896040518082805190602001908083835b602083101515611ca95780518252602082019150602081019050602083039250611c84565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f7ac7a04970319ae8fc5b92fe177d000fee3c00c92f8e78aae13d6571f17c351f886040518082815260200191505060405180910390a385965050505050505092915050565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff166359a48b656040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611dc657600080fd5b505af1158015611dda573d6000803e3d6000fd5b505050506040513d6020811015611df057600080fd5b810190808051906020019092919050505090508092505050905600a165627a7a72305820359a39cb7ac28563ad7fa716aa44afd6af26313abd44cb973be11893df24b1e30029"
  };

  public static final String SM_BINARY = String.join("", SM_BINARY_ARRAY);

  public static final String[] ABI_ARRAY = {
    "[{\"constant\":false,\"inputs\":[{\"name\":\"from_account\",\"type\":\"string\"},{\"name\":\"to_account\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"},{\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":true,\"name\":\"account\",\"type\":\"string\"},{\"indexed\":true,\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"RegisterEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":true,\"name\":\"from_account\",\"type\":\"string\"},{\"indexed\":true,\"name\":\"to_account\",\"type\":\"string\"},{\"indexed\":true,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferEvent\",\"type\":\"event\"}]"
  };

  public static final String ABI = String.join("", ABI_ARRAY);

  public static final String FUNC_TRANSFER = "transfer";

  public static final String FUNC_REGISTER = "register";

  public static final String FUNC_SELECT = "select";

  public static final Event REGISTEREVENT_EVENT =
      new Event(
          "RegisterEvent",
          Arrays.<TypeReference<?>>asList(
              new TypeReference<Int256>() {},
              new TypeReference<Utf8String>(true) {},
              new TypeReference<Uint256>(true) {}));;

  public static final Event TRANSFEREVENT_EVENT =
      new Event(
          "TransferEvent",
          Arrays.<TypeReference<?>>asList(
              new TypeReference<Int256>() {},
              new TypeReference<Utf8String>(true) {},
              new TypeReference<Utf8String>(true) {},
              new TypeReference<Uint256>(true) {}));;

  protected Asset(String contractAddress, Client client, CryptoKeyPair credential) {
    super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
  }

  public static String getBinary(CryptoSuite cryptoSuite) {
    return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
  }

  public TransactionReceipt transfer(String from_account, String to_account, BigInteger amount) {
    final Function function =
        new Function(
            FUNC_TRANSFER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(from_account),
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(to_account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(amount)),
            Collections.<TypeReference<?>>emptyList());
    return executeTransaction(function);
  }

  public void transfer(
      String from_account, String to_account, BigInteger amount, TransactionCallback callback) {
    final Function function =
        new Function(
            FUNC_TRANSFER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(from_account),
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(to_account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(amount)),
            Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
  }

  public String getSignedTransactionForTransfer(
      String from_account, String to_account, BigInteger amount) {
    final Function function =
        new Function(
            FUNC_TRANSFER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(from_account),
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(to_account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(amount)),
            Collections.<TypeReference<?>>emptyList());
    return createSignedTransaction(function);
  }

  public Tuple3<String, String, BigInteger> getTransferInput(
      TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function =
        new Function(
            FUNC_TRANSFER,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(
                new TypeReference<Utf8String>() {},
                new TypeReference<Utf8String>() {},
                new TypeReference<Uint256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    return new Tuple3<String, String, BigInteger>(
        (String) results.get(0).getValue(),
        (String) results.get(1).getValue(),
        (BigInteger) results.get(2).getValue());
  }

  public Tuple1<BigInteger> getTransferOutput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getOutput();
    final Function function =
        new Function(
            FUNC_TRANSFER,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
  }

  public TransactionReceipt register(String account, BigInteger asset_value) {
    final Function function =
        new Function(
            FUNC_REGISTER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(asset_value)),
            Collections.<TypeReference<?>>emptyList());
    return executeTransaction(function);
  }

  public void register(String account, BigInteger asset_value, TransactionCallback callback) {
    final Function function =
        new Function(
            FUNC_REGISTER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(asset_value)),
            Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
  }

  public String getSignedTransactionForRegister(String account, BigInteger asset_value) {
    final Function function =
        new Function(
            FUNC_REGISTER,
            Arrays.<Type>asList(
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(account),
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(asset_value)),
            Collections.<TypeReference<?>>emptyList());
    return createSignedTransaction(function);
  }

  public Tuple2<String, BigInteger> getRegisterInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function =
        new Function(
            FUNC_REGISTER,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(
                new TypeReference<Utf8String>() {}, new TypeReference<Uint256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    return new Tuple2<String, BigInteger>(
        (String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
  }

  public Tuple1<BigInteger> getRegisterOutput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getOutput();
    final Function function =
        new Function(
            FUNC_REGISTER,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
  }

  public Tuple2<BigInteger, BigInteger> select(String account) throws ContractException {
    final Function function =
        new Function(
            FUNC_SELECT,
            Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(account)),
            Arrays.<TypeReference<?>>asList(
                new TypeReference<Int256>() {}, new TypeReference<Uint256>() {}));
    List<Type> results = executeCallWithMultipleValueReturn(function);
    return new Tuple2<BigInteger, BigInteger>(
        (BigInteger) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
  }

  public List<RegisterEventEventResponse> getRegisterEventEvents(
      TransactionReceipt transactionReceipt) {
    List<Contract.EventValuesWithLog> valueList =
        extractEventParametersWithLog(REGISTEREVENT_EVENT, transactionReceipt);
    ArrayList<RegisterEventEventResponse> responses =
        new ArrayList<RegisterEventEventResponse>(valueList.size());
    for (Contract.EventValuesWithLog eventValues : valueList) {
      RegisterEventEventResponse typedResponse = new RegisterEventEventResponse();
      typedResponse.log = eventValues.getLog();
      typedResponse.account = (byte[]) eventValues.getIndexedValues().get(0).getValue();
      typedResponse.asset_value = (BigInteger) eventValues.getIndexedValues().get(1).getValue();
      typedResponse.ret = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
      responses.add(typedResponse);
    }
    return responses;
  }

  public void subscribeRegisterEventEvent(
      String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
    String topic0 = eventEncoder.encode(REGISTEREVENT_EVENT);
    subscribeEvent(ABI, BINARY, topic0, fromBlock, toBlock, otherTopics, callback);
  }

  public void subscribeRegisterEventEvent(EventCallback callback) {
    String topic0 = eventEncoder.encode(REGISTEREVENT_EVENT);
    subscribeEvent(ABI, BINARY, topic0, callback);
  }

  public List<TransferEventEventResponse> getTransferEventEvents(
      TransactionReceipt transactionReceipt) {
    List<Contract.EventValuesWithLog> valueList =
        extractEventParametersWithLog(TRANSFEREVENT_EVENT, transactionReceipt);
    ArrayList<TransferEventEventResponse> responses =
        new ArrayList<TransferEventEventResponse>(valueList.size());
    for (Contract.EventValuesWithLog eventValues : valueList) {
      TransferEventEventResponse typedResponse = new TransferEventEventResponse();
      typedResponse.log = eventValues.getLog();
      typedResponse.from_account = (byte[]) eventValues.getIndexedValues().get(0).getValue();
      typedResponse.to_account = (byte[]) eventValues.getIndexedValues().get(1).getValue();
      typedResponse.amount = (BigInteger) eventValues.getIndexedValues().get(2).getValue();
      typedResponse.ret = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
      responses.add(typedResponse);
    }
    return responses;
  }

  public void subscribeTransferEventEvent(
      String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
    String topic0 = eventEncoder.encode(TRANSFEREVENT_EVENT);
    subscribeEvent(ABI, BINARY, topic0, fromBlock, toBlock, otherTopics, callback);
  }

  public void subscribeTransferEventEvent(EventCallback callback) {
    String topic0 = eventEncoder.encode(TRANSFEREVENT_EVENT);
    subscribeEvent(ABI, BINARY, topic0, callback);
  }

  public static Asset load(String contractAddress, Client client, CryptoKeyPair credential) {
    return new Asset(contractAddress, client, credential);
  }

  public static Asset deploy(Client client, CryptoKeyPair credential) throws ContractException {
    return deploy(Asset.class, client, credential, getBinary(client.getCryptoSuite()), "");
  }

  public static class RegisterEventEventResponse {
    public TransactionReceipt.Logs log;

    public byte[] account;

    public BigInteger asset_value;

    public BigInteger ret;
  }

  public static class TransferEventEventResponse {
    public TransactionReceipt.Logs log;

    public byte[] from_account;

    public byte[] to_account;

    public BigInteger amount;

    public BigInteger ret;
  }
}

2.6 对合约的部署与调用AssetClient.class

package org.fisco.bcos.asset.client;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.util.List;
import java.util.Properties;
import org.fisco.bcos.asset.contract.Asset;
import org.fisco.bcos.sdk.BcosSDK;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

public class AssetClient {

  static Logger logger = LoggerFactory.getLogger(AssetClient.class);

  private BcosSDK bcosSDK;
  private Client client;
  private CryptoKeyPair cryptoKeyPair;

  public void initialize() throws Exception {
    @SuppressWarnings("resource")
    ApplicationContext context =
        new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
    bcosSDK = context.getBean(BcosSDK.class);
    client = bcosSDK.getClient(1);
    cryptoKeyPair = client.getCryptoSuite().createKeyPair();
    client.getCryptoSuite().setCryptoKeyPair(cryptoKeyPair);
    logger.debug("create client for group1, account address is " + cryptoKeyPair.getAddress());
  }

  public void deployAssetAndRecordAddr() {

    try {
      Asset asset = Asset.deploy(client, cryptoKeyPair);
      System.out.println(
          " deploy Asset success, contract address is " + asset.getContractAddress());

      recordAssetAddr(asset.getContractAddress());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
      System.out.println(" deploy Asset contract failed, error message is  " + e.getMessage());
    }
  }

  public void recordAssetAddr(String address) throws FileNotFoundException, IOException {
    Properties prop = new Properties();
    prop.setProperty("address", address);
    final Resource contractResource = new ClassPathResource("contract.properties");
    FileOutputStream fileOutputStream = new FileOutputStream(contractResource.getFile());
    prop.store(fileOutputStream, "contract address");
  }

  public String loadAssetAddr() throws Exception {
    // load Asset contact address from contract.properties
    Properties prop = new Properties();
    final Resource contractResource = new ClassPathResource("contract.properties");
    prop.load(contractResource.getInputStream());

    String contractAddress = prop.getProperty("address");
    if (contractAddress == null || contractAddress.trim().equals("")) {
      throw new Exception(" load Asset contract address failed, please deploy it first. ");
    }
    logger.info(" load Asset address from contract.properties, address is {}", contractAddress);
    return contractAddress;
  }

  public void queryAssetAmount(String assetAccount) {
    try {
      String contractAddress = loadAssetAddr();
      Asset asset = Asset.load(contractAddress, client, cryptoKeyPair);
      Tuple2<BigInteger, BigInteger> result = asset.select(assetAccount);
      if (result.getValue1().compareTo(new BigInteger("0")) == 0) {
        System.out.printf(" asset account %s, value %s \n", assetAccount, result.getValue2());
      } else {
        System.out.printf(" %s asset account is not exist \n", assetAccount);
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
      logger.error(" queryAssetAmount exception, error message is {}", e.getMessage());

      System.out.printf(" query asset account failed, error message is %s\n", e.getMessage());
    }
  }

  public void registerAssetAccount(String assetAccount, BigInteger amount) {
    try {
      String contractAddress = loadAssetAddr();

      Asset asset = Asset.load(contractAddress, client, cryptoKeyPair);
      TransactionReceipt receipt = asset.register(assetAccount, amount);
      List<Asset.RegisterEventEventResponse> response = asset.getRegisterEventEvents(receipt);
      if (!response.isEmpty()) {
        if (response.get(0).ret.compareTo(new BigInteger("0")) == 0) {
          System.out.printf(
              " register asset account success => asset: %s, value: %s \n", assetAccount, amount);
        } else {
          System.out.printf(
              " register asset account failed, ret code is %s \n", response.get(0).ret.toString());
        }
      } else {
        System.out.println(" event log not found, maybe transaction not exec. ");
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();

      logger.error(" registerAssetAccount exception, error message is {}", e.getMessage());
      System.out.printf(" register asset account failed, error message is %s\n", e.getMessage());
    }
  }

  public void transferAsset(String fromAssetAccount, String toAssetAccount, BigInteger amount) {
    try {
      String contractAddress = loadAssetAddr();
      Asset asset = Asset.load(contractAddress, client, cryptoKeyPair);
      TransactionReceipt receipt = asset.transfer(fromAssetAccount, toAssetAccount, amount);
      List<Asset.TransferEventEventResponse> response = asset.getTransferEventEvents(receipt);
      if (!response.isEmpty()) {
        if (response.get(0).ret.compareTo(new BigInteger("0")) == 0) {
          System.out.printf(
              " transfer success => from_asset: %s, to_asset: %s, amount: %s \n",
              fromAssetAccount, toAssetAccount, amount);
        } else {
          System.out.printf(
              " transfer asset account failed, ret code is %s \n", response.get(0).ret.toString());
        }
      } else {
        System.out.println(" event log not found, maybe transaction not exec. ");
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();

      logger.error(" registerAssetAccount exception, error message is {}", e.getMessage());
      System.out.printf(" register asset account failed, error message is %s\n", e.getMessage());
    }
  }

  public static void Usage() {
    System.out.println(" Usage:");
    System.out.println(
        "\t java -cp conf/:lib/*:apps/* org.fisco.bcos.asset.client.AssetClient deploy");
    System.out.println(
        "\t java -cp conf/:lib/*:apps/* org.fisco.bcos.asset.client.AssetClient query account");
    System.out.println(
        "\t java -cp conf/:lib/*:apps/* org.fisco.bcos.asset.client.AssetClient register account value");
    System.out.println(
        "\t java -cp conf/:lib/*:apps/* org.fisco.bcos.asset.client.AssetClient transfer from_account to_account amount");
    System.exit(0);
  }

  public static void main(String[] args) throws Exception {
    if (args.length < 1) {
      Usage();
    }

    AssetClient client = new AssetClient();
    client.initialize();

    switch (args[0]) {
      case "deploy":
        client.deployAssetAndRecordAddr();
        break;
      case "query":
        if (args.length < 2) {
          Usage();
        }
        client.queryAssetAmount(args[1]);
        break;
      case "register":
        if (args.length < 3) {
          Usage();
        }
        client.registerAssetAccount(args[1], new BigInteger(args[2]));
        break;
      case "transfer":
        if (args.length < 4) {
          Usage();
        }
        client.transferAsset(args[1], args[2], new BigInteger(args[3]));
        break;
      default:
        {
          Usage();
        }
    }
    System.exit(0);
  }
}

2.7 添加一个调用AssetClient的脚本 

#!/bin/bash 

function usage() 
{
    echo " Usage : "
    echo "   bash asset_run.sh deploy"
    echo "   bash asset_run.sh query    asset_account "
    echo "   bash asset_run.sh register asset_account asset_amount "
    echo "   bash asset_run.sh transfer from_asset_account to_asset_account amount "
    echo " "
    echo " "
    echo "examples : "
    echo "   bash asset_run.sh deploy "
    echo "   bash asset_run.sh register  Asset0  10000000 "
    echo "   bash asset_run.sh register  Asset1  10000000 "
    echo "   bash asset_run.sh transfer  Asset0  Asset1 11111 "
    echo "   bash asset_run.sh query Asset0"
    echo "   bash asset_run.sh query Asset1"
    exit 0
}

    case $1 in
    deploy)
            [ $# -lt 1 ] && { usage; }
            ;;
    register)
            [ $# -lt 3 ] && { usage; }
            ;;
    transfer)
            [ $# -lt 4 ] && { usage; }
            ;;
    query)
            [ $# -lt 2 ] && { usage; }
            ;;
    *)
        usage
            ;;
    esac

    java -Djdk.tls.namedGroups="SM2,secp256k1,x25519,secp256r1,secp384r1,secp521r1" -cp 'apps/*:conf/:lib/*' org.fisco.bcos.asset.client.AssetClient $@

  2.8 配置log4j.properties

#
# Copyright 2014-2020  [fisco-dev]
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
#

### set log levels ###
log4j.rootLogger=DEBUG, file

### output the log information to the file ###
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern='_'yyyyMMddHH'.log'
log4j.appender.file.File=./log/sdk.log
log4j.appender.file.Append=true
log4j.appender.file.filter.traceFilter=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C{1}.%M(%L) | %m%n

###output the log information to the console ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C{1}.%M(%L) | %m%n

2.9  创建一个空的contract.properties文件

3、运行

3.1 切换到项目目录

cd asset-app

 

3.2编译项目

./gradlew build

3.3 将代码从window挪到linux

3.4 部署合约

# 进入dist目录

cd dist

bash asset_run.sh deploy

3.5 注册资产

给张三注册资产10万元

bash asset_run.sh register zhangsan 100000

注册成功,张三拥有资产10万元

同上,也给Bob注册资产10万元

bash asset_run.sh register Bob 100000

注册成功,Bob拥有资产10万元

3.6 查询资产

查询张三的资产有多少

bash asset_run.sh query zhangsan

张三拥有10万资产

Bob同上。

bash asset_run.sh query Bob

3.7 资产转移

张三转给张五 5万 块

bash asset_run.sh transfer zhangsan Bob 50000

转移成功

检查张三还剩多少钱

bash asset_run.sh query zhangsan

张三还剩 5 万。

检查Bob还有多少钱

bash asset_run.sh query Bob

张五有 15 万

总结: 至此,我们通过合约开发,合约编译,SDK配置与业务开发构建了一个基于FISCO BCOS联盟区块链的应用。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/758516.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

教师资格证(教资)笔试如何备考?含备考资料

教师资格证&#xff08;教资&#xff09;笔试如何备考&#xff1f;含备考资料 前言 教师&#xff0c;一直以来的热门职业&#xff0c;而要成为一名教师&#xff0c;考取教师资格证则是基本条件&#xff0c;那么教资笔试如何备考呢&#xff1f;&#xff0c;这里准备笔试备考攻…

基于单片机光纤测距系统的设计与实现

摘要 &#xff1a; 光纤由于其频带宽 、 损耗低及抗干扰能力强等优点已被广泛地应用在通信 、 电子及电力方面 &#xff0c; 是我们生产生活中必不可少的媒介。 在实际的光纤实验 、 安装 、 运营和维护工作中 &#xff0c; 一种精准 、 轻便和易操作的光纤测距系统显得尤为重…

PingCastle 3.2.0.1 - Active Directory 安全检测和评估

PingCastle 3.2.0.1 - Active Directory 安全检测和评估 活动目录域安全分析工具 请访问原文链接&#xff1a;https://sysin.org/blog/pingcastle/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org 在 20% 的时间内获得 80% 的…

LitelDE安装---附带每一步截图以及测试

LiteIDE LiteIDE 是一款专为Go语言开发而设计的开源、跨平台、轻量级集成开发环境&#xff08;IDE&#xff09;&#xff0c;基于 Qt 开发&#xff08;一个跨平台的 C 框架&#xff09;&#xff0c;支持 Windows、Linux 和 Mac OS X 平台。LiteIDE 的第一个版本发布于 2011 年 …

[小试牛刀-习题练]《计算机组成原理》之数据信息的表示、运算方法与运算器

【数据信息的表示运算方法与运算器】 1、【机器码转换】X-0.11111111&#xff0c;X的补码是 1.00000001 。 最高位符号位为负值&#xff1a; 反码法——绝对值按位取反末位加一&#xff0c;1.000000000.000000011.00000001扫描法——从右往左找到第一个为1的&#xff…

SpringBoot的自动配置核心原理及拓展点

Spring Boot 的核心原理几个关键点 约定优于配置&#xff1a; Spring Boot 遵循约定优于配置的理念&#xff0c;通过预定义的约定&#xff0c;大大简化了 Spring 应用程序的配置和部署。例如&#xff0c;它自动配置了许多常见的开发任务&#xff08;如数据库连接、Web 服务器配…

PHP校园论坛-计算机毕业设计源码08586

摘 要 本项目旨在基于PHP技术设计与实现一个校园论坛系统&#xff0c;以提供一个功能丰富、用户友好的交流平台。该论坛系统将包括用户注册与登录、帖子发布与回复、个人信息管理等基本功能&#xff0c;并结合社交化特点&#xff0c;增强用户之间的互动性。通过利用PHP语言及其…

核方法总结(四)——高斯过程回归学习笔记

一、定义 基于核方法的线性回归模型和传统线性回归一样&#xff0c;可以用未知数据进行预测&#xff0c;但不能确定 预测的可信度。在参考书第二章中可知&#xff0c;基于贝叶斯方法可以实现对未知数据依概率预测&#xff0c;进而可得到预测的可信度。这一方法中&#xff0c;通…

试用笔记之-收钱吧安卓版演示源代码,收钱吧手机版感受

首先下载&#xff1a; https://download.csdn.net/download/tjsoft/89499105 安卓手机安装 如果有收钱吧帐号输入收钱吧帐号和密码。 如果没有收钱吧帐号点我的注册 登录收钱吧帐号后就可以把手机当成收钱吧POS机用了&#xff0c;还可以扫客服的付款码哦 源代码技术交流QQ:42…

数据架构深度解析

写在前面 在信息化高度发达的今天&#xff0c;数据已成为企业最宝贵的资产之一。如何有效地管理和利用这些数据&#xff0c;以支持企业的决策和业务运营&#xff0c;成为企业面临的重要挑战。数据架构作为数据管理的基础&#xff0c;其设计合理与否直接关系到数据的质量和价值。…

Vue3实现点击按钮实现文字变色

1.动态样式实现 1.1核心代码解释&#xff1a; class"power-station-perspective-item-text"&#xff1a; 为这个 span 元素添加了一个 CSS 类&#xff0c;以便对其样式进行定义。 click"clickItem(item.id)"&#xff1a; 这是一个 Vue 事件绑定。当用户点…

算法金 | 协方差、方差、标准差、协方差矩阵

大侠幸会&#xff0c;在下全网同名「算法金」 0 基础转 AI 上岸&#xff0c;多个算法赛 Top 「日更万日&#xff0c;让更多人享受智能乐趣」 抱个拳&#xff0c;送个礼 1. 方差 方差是统计学中用来度量一组数据分散程度的重要指标。它反映了数据点与其均值之间的偏离程度。在…

【LINUX】内核源码文件系统调用相关摸索

首先&#xff0c;先看看想测试那个系统调用&#xff0c;在应用层&#xff0c;如果使用C语言编程一般我们一来就是open函数&#xff0c;实际在测试的时候&#xff0c;直接用touch xxx.txt然后 echo "xxx" >> xxx.txt&#xff0c;这样就完成了文件创建和写文件的…

idea 用久了代码提示变慢卡顿优化

idea 用久了代码提示变慢卡顿优化 修改虚拟机配置 修改编译构建堆内存

CesiumJS【Basic】- #028 天空盒

文章目录 天空盒1 目标2 代码2.1 main.ts3 资源天空盒 1 目标 配置显示天空盒 2 代码 2.1 main.ts import * as Cesium from cesium;// 创建 Cesium Viewer 并配置地形数据和天空盒 const viewer = new Cesium.Viewer(

【Python系列】列表推导式:简洁而强大的数据操作工具

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

最强文生图模型Stable Diffusion 3 Medium 正式开源

Stability AI 宣布 Stable Diffusion 3 Medium 现已开源&#xff0c;是 Stable Diffusion 3 系列中最新、最先进的文本生成图像 AI 模型 —— 官方声称是 “迄今为止最先进的开源模型”&#xff0c;其性能甚至超过了 Midjourney 6。 Stable Diffusion 3 Medium 模型规格参数达到…

用友U8 Cloud smartweb2.showRPCLoadingTip.d XXE漏洞复现

0x01 产品简介 用友U8 Cloud 提供企业级云ERP整体解决方案,全面支持多组织业务协同,实现企业互联网资源连接。 U8 Cloud 亦是亚太地区成长型企业最广泛采用的云解决方案。 0x02 漏洞概述 用友U8 Cloud smartweb2.showRPCLoadingTip.d 接口处存在XML实体,攻击者可通过该漏…

redis实战-短信登录

基于session的登录流程 session的登录流程图 1. 发送验证码 用户在提交手机号后&#xff0c;会校验手机号是否合法&#xff0c;如果不合法&#xff0c;则要求用户重新输入手机号 如果手机号合法&#xff0c;后台此时生成对应的验证码&#xff0c;同时将验证码进行保存&#x…

昇思25天学习打卡营第七天|模型训练

背景 提供免费算力支持&#xff0c;有交流群有值班教师答疑的华为昇思训练营进入第七天了。 今天是第七天&#xff0c;前六天的学习内容可以看链接 昇思25天学习打卡营第一天|快速入门 昇思25天学习打卡营第二天|张量 Tensor 昇思25天学习打卡营第三天|数据集Dataset 昇思25天…