基于区块链的毕业设计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:

  1. determine the current balance of address
  2. 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:

  1. have at least the specified balance
  2. 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:

  1. Standard implementation: works as designed, addresses and corresponding keys are created on demand.
  2. 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.


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}[] 

将扫描所有已创建的地址以及每个地址:

  1. 检查当前余额是否等于上次扫描时的余额:如果等于,则不执行任何操作,将当前余额和当前块高度保存到数据库记录中
  2. 如果等于,则不执行任何操作

该方法将返回地址数组(连同余额和确认):

  1. 至少具有指定数量的确认
  2. 标准实现:按设计工作,按需创建地址和相应的密钥。

Method lifecycle

当调用/create端点时,服务创建一个新地址并保存私钥。pubankey和sigan-address字符串用sigan-key和sigan签名返回。

服务将地址和私钥保存在数据库(Sqlite,加密)*

当第一次使用transactionHash调用/status端点时,服务开始监视该事务,直到有足够的确认被视为已接受。然后,服务将创建一个到池地址的事务(来自env var),并保存out事务与传入事务的关联。

status终结点报告它看到的传入交易的确认数量(incConfirmations,如果没有见证交易,则为0)和传出交易相同,以便消费者(钱包)可以检查存款交易是否已经有效。同时报告已创建(传出)事务的哈希值。

*备选方案:地址从高清钱包创建,主私钥在启动时传递给服务,因此只需保存地址和高清路径。

Code organization

有两种实现方式:

  1. 实验实现:(仅在src/Experimental中)基于契约的实现(它有一个安全好处:资金只能发送到池地址,不能发送到任何其他地址)。
  2. 如果您不了解某个东西应该如何工作,请询问我们。

Misc

  • 只实现规范中的内容。如果您需要更新规格,请先与我们联系。
  • 使用环境变量
  • Use environment variables for configuration

我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/17893.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Ethereum Deposit Proxy – 以太坊存款代理

提供最优质的资源集合

立即查看 了解详情