-
Notifications
You must be signed in to change notification settings - Fork 24
Existing EvidenceAPI
Restful API 调用方法 首先确认服务器端的地址和端口,端口默认是8545.
createProofTransaction 使用POST 方法,将以下bodydata 发送到服务器地址和 端口,注意http 头部字段Content-Type:application/json
参数定义
from 交易发起方 (实际部署后将账户地址告知)
proof 上链文件哈希值
extra 附加字段 随proof一同上链
fee 交易手续费
outputs 交易的输出
address 交易接受方(实际部署后将账户地址告知)
amount 转账金额
locktime 锁定脚本时间(固定值)
id 区块链内部标记(固定值)
{"jsonrpc":"2.0","method":"wallet_createProofTransaction","params":["{\"from\":\"P1D9cHbWtMv2z5p5bRGjkgZyYexXLfbwVyi\",\"proof\":\"4defe00d58e12e97c801cf4a4d374dcb85aaccd42cd390bfa06d2df56fb946cb\",\"extra\":\"存证\",\"fee\":0,\"outputs\":[{\"address\":\"P18fFNCL4ttws9p1TgswWvENKss1YVhrBXw\",\"amount\": 0.0001}],\"locktime\":12}",""],"id":1}
返回结果
result为 这笔交易的哈希值(transactionHash)
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xa48ca8136b365b3d134d458d4f2749a7cfcadacb8a5c8f73f8522387957599bc"
}
getFileInfoByFileHash
参数格式
{"jsonrpc":"2.0","method":"wallet_getFileInfoByFileHash","params":[
"0xa48ca8136b365b3d134d458d4f2749a7cfcadacb8a5c8f73f8522387957599bc"],"id":1}
参数为 文件哈希
getFileInfoByTxid
参数格式
{"jsonrpc":"2.0","method":"wallet_getFileInfoByTxid","params":[
"0x5099942bf3ae867998eb558beb3fa25e7493ddc7f7d7161d0af5f882899bd5d5"],"id":1}
参数为 用户存证后返回的交易哈希
返回结果
unithash 区块哈希值
unitindex 区块高度
parentshash 上一个区块哈希值
transactionhash 交易哈希值
timestamp 时间戳
filehash 文件哈希值
extradata 附加字段
备注:如果用户多次进行上链可返回每次上链区块信息内容
{
"jsonrpc": "2.0",
"id": 1,
"result": "[{\"unit_hash\":\"0x754ce24d2f5bdc43d4a63423da2c52a0fd4c63315106dc5b536f0868d10c0d4c\",\"unit_index\":143,\"parents_hash\":\"0x3680bd7eecb372945cc795230405fd1e471ce0f8760aeb7a480f220a4733ff83\",\"transaction_hash\":\"0xa48ca8136b365b3d134d458d4f2749a7cfcadacb8a5c8f73f8522387957599bc\",\"timestamp\":\"2019-01-17 15:27:51\",\"file_hash\":\"4defe00d58e12e97c801cf4a4d374dcb85aaccd42cd390bfa06d2df56fb946cb\",\"extra_data\":\"存证\"}]"
}
支持文件多次上链
createProofOfExistenceTx使用POST 方法,
参数定义
P15P5oHLjvoqMHKXjcV2joHYanTnMBDrZzG 交易发起方地址 (实际部署后将账户地址告知)
存证 存证内容(string)
附加信息 附加字段,随存证内容一同上链(string)
A 存证的引用标识符,可根据此标识查询存证信息(string)
1 区块链标识(固定值)
id:1 区块链内部标记(固定值)
{"jsonrpc":"2.0","method":"wallet_createProofOfExistenceTx","params":["P15P5oHLjvoqMHKXjcV2joHYanTnMBDrZzG","存证","附加信息","A","1"],"id":1}
返回结果
result为 这笔交易的哈希值(transactionHash)
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xa6512e3b72fd388fe5fb656136535c5daa33ecc0641c26452e5001083d5c4d29"
}
getProofOfExistencesByRef
参数格式()
{"jsonrpc":"2.0","method":"wallet_getProofOfExistencesByRef","params":["A"],"id":1}
A 存证的引用标识符,可根据此标识查询存证信息(string)
返回结果
unit_hash 区块哈希值
tx_id 交易哈希值
timestamp 时间戳
main_data 主要存证内容
extradata 附加字段
reference 存证的引用标识符
备注:如果用户多次进行上链可返回每次上链区块信息内容
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"main_data": "存证",
"extra_data": "附加信息",
"reference": "A",
"tx_id": "0xa6512e3b72fd388fe5fb656136535c5daa33ecc0641c26452e5001083d5c4d29",
"unit_hash": "0x01c4d5dd92305305ce459a432930cae511cda1f5e2b1b903a182b6a59dde67bd",
"timestamp": "2019-06-26T14:36:22+08:00"
}
]
}
文件多次上链返回结果
PalletOne©2018-2019
Home
Getting started
- Install and build
- Create a private chain
- Launch the PalletOne Client
- Create a PalletOne Account
- Send and Receive PTN
- Create and send your token
- Backing up your account and data
- Restoring your account
- Deposit contract
- Mediator Node Installation and Joining
- Howto Become a Mediator
- Howto Run a Unit-producing Mediator
Developer Tools
- Getting PTNs from PalletOne's Testnet Faucet
- Wallet restful and console API Usage
- Third-Party-Wallet-Support
- Third-Party-Wallet-Contract-Invoke
- API Document
FAQ