基于区块链的毕业设计Ethereum Deposit Proxy – 以太坊存款代理
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Ethereum Deposit Proxy – 以太坊存款代理 是一篇很好的国外资料
Ethereum Deposit Proxy
Purpose
Not every user has the ability to sign arbitrary things as needed with his ethereum wallet. To verify, that the claimed ETH transaction belongs to the user creating the Tixl Deposit block, the users needs to sign the public key of the chain the Tixl block is deposited on with his ETH private key and provide that signature to the Tixl deposit block.
This service will create disposable ETH addresses and create the signature on the users behalf.
Installation
A JSON configuration object .config.json
complient with the following interface must be provided:
{ server: string // url to Geth server, e.g. "http://207.154.253.13:8545" address: string // where the money is sent to (pool address), e.g.: "0x0dF22FdeD1D944365B6561B7a620a48E3f4D3CCe" key: string // signing key (hex encoded private key) }
Interface
The service exposes a HTTP API:
Core API:
POST /create request body: context (hex string) Context is any string unique to the wallet owner (e.g.: chainSigPubKey) response body: string Returns address. The address is added to the database of tracked addresses
GET /status/:address (string) response body: { confirmations: int, transaction: string } Transaction may be an empty string if transaction to the pool address has not been created yet. Confirmations is the number of confirmations since the last balance change of the address.
Extra API (may not be needed):
GET /sign/:message (hex string) response body: signature (hex string) Return signature for the given message. Is this needed at all?
Debug API:
POST /update notes: This triggers the scan of all addresses. Only for debugging purposes (in production scans can be triggered automatically).
POST /collect request body: address (string) notes: This will transfer money from the generated address to the single pool address. The trsansaction hash will be stored in the database and reported in future /status calls. Only for debugging purposes (in production collects can be automatic).
POST /create body: {chainSigPubKey: string} returns JSON {address: string, signature: string}
GET /status/:InTxHash {outHash: string, incConfirmations: number, outConfirmations: number}
POST /update body: {balance?: string, confirmations?: int} returns: {address: string, balance: string, confirmations: int}[]
Will scan over all created addresses and for each address and:
- determine the current balance of address
- check if the current balance equals to the balance at the last scan:
- if equals, do nothing
- if not, save the current balance and the current block height to the database record
The method will return the array of addresses (together with balances and confirmations) that:
- have at least the specified balance
- have at least the specified number of confirmations
Method lifecycle
When the /create endpoint is called the service creates a new address and holds the private key. It signs chainSigPubKey
which is an ASCII string with the private key and returns the address and the signature.
The service saves the address and privateKey in a database (Sqlite, encrypted)*
When the /status endpoint is called for the first time with a transactionHash the service starts to monitor that transaction, until it has enough confirmations to be deemed accepted. Then the service creates an transaction to the pool address (from env var) and saves the association of the out transaction with the incoming transaction.
The /status endpoint reports how many confirmations it has seen for the incoming transaction (incConfirmations, 0 if no transaction witnessed) and same for the outgoing transaction, so that the consumer (wallet) can check if the deposit transaction is already valid. Also the hash for the transaction that was created (outgoing) is reported.
*Alternative: The addresses are created from a HD wallet and the master private key is passed to the service on start, so only the address and HD path have to be saved.
Code organization
There are two implementations:
- Standard implementation: works as designed, addresses and corresponding keys are created on demand.
- Experimental implementation: (only in
src/experimental
) contract-based implementation (it has one security benefit: funds can ONLY be sent to the pool address, sending to any other address is not possible).
Misc
- Ask us if you don’t understand how something should work
- Only implement what’s in the specification. If you need to update the specification please chat with us before.
- Use environment variables for configuration
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they’re used to log you in. Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
Ethereum Deposit Proxy
Purpose
并不是每个用户都能用以太坊eth钱包在需要时签署任意东西。为了验证所请求的ETH事务是否属于创建Tixl存款块的用户,用户需要用他的ETH私钥对Tixl块所存放的链的公钥进行签名,并将该签名提供给Tixl Deposit块。
此服务将创建一次性ETH地址并代表用户创建签名。
Installation
一个JSON配置对象。配置.json必须提供具有以下接口的客户端:
{ server: string // url to Geth server, e.g. "http://207.154.253.13:8545" address: string // where the money is sent to (pool address), e.g.: "0x0dF22FdeD1D944365B6561B7a620a48E3f4D3CCe" key: string // signing key (hex encoded private key) }
Interface
该服务公开HTTP API:
核心API:
POST /create request body: context (hex string) Context is any string unique to the wallet owner (e.g.: chainSigPubKey) response body: string Returns address. The address is added to the database of tracked addresses
GET /status/:address (string) response body: { confirmations: int, transaction: string } Transaction may be an empty string if transaction to the pool address has not been created yet. Confirmations is the number of confirmations since the last balance change of the address.
额外的API(可能不需要):
GET /sign/:message (hex string) response body: signature (hex string) Return signature for the given message. Is this needed at all?
调试API:
POST /update notes: This triggers the scan of all addresses. Only for debugging purposes (in production scans can be triggered automatically).
POST /collect request body: address (string) notes: This will transfer money from the generated address to the single pool address. The trsansaction hash will be stored in the database and reported in future /status calls. Only for debugging purposes (in production collects can be automatic).
发布/创建主体:{chainSigPubKey:string}返回JSON{address:string,signature:string}
GET/status/:InTxHash{outHash:string,incConfirmations:number,outConfirmations:number}
POST /update body: {balance?: string, confirmations?: int} returns: {address: string, balance: string, confirmations: int}[]
将扫描所有已创建的地址以及每个地址:
- 检查当前余额是否等于上次扫描时的余额:如果等于,则不执行任何操作,将当前余额和当前块高度保存到数据库记录中
- 如果等于,则不执行任何操作
该方法将返回地址数组(连同余额和确认):
- 至少具有指定数量的确认
- 标准实现:按设计工作,按需创建地址和相应的密钥。
Method lifecycle
当调用/create端点时,服务创建一个新地址并保存私钥。pubankey和sigan-address字符串用sigan-key和sigan签名返回。
服务将地址和私钥保存在数据库(Sqlite,加密)*
当第一次使用transactionHash调用/status端点时,服务开始监视该事务,直到有足够的确认被视为已接受。然后,服务将创建一个到池地址的事务(来自env var),并保存out事务与传入事务的关联。
status终结点报告它看到的传入交易的确认数量(incConfirmations,如果没有见证交易,则为0)和传出交易相同,以便消费者(钱包)可以检查存款交易是否已经有效。同时报告已创建(传出)事务的哈希值。
*备选方案:地址从高清钱包创建,主私钥在启动时传递给服务,因此只需保存地址和高清路径。
Code organization
有两种实现方式:
- 实验实现:(仅在src/Experimental中)基于契约的实现(它有一个安全好处:资金只能发送到池地址,不能发送到任何其他地址)。
- 如果您不了解某个东西应该如何工作,请询问我们。
Misc
- 只实现规范中的内容。如果您需要更新规格,请先与我们联系。
- 使用环境变量
- Use environment variables for configuration
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。
Essential cookies
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
Always active
Analytics cookies
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多信息
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Ethereum Deposit Proxy – 以太坊存款代理