zcash-hackworks / zbxcat Goto Github PK
View Code? Open in Web Editor NEWA work-in-progress for Zcash Bitcoin Cross-Chain Atomic Transactions
License: Other
A work-in-progress for Zcash Bitcoin Cross-Chain Atomic Transactions
License: Other
Need tests that run bitcoind and zcashd in regtest mode, and go through redeem and refund cases. Especially need to test refund fail cases
Following the set up instructions I run into problems:
Using venv
, python -V
returns Python 3.5.2
which is expected.
Next step, pip install zbxcat
returns:
Could not find a version that satisfies the requirement zbxcat (from versions: )
No matching distribution found for zbxcat
bitcoinRPC.py
->get_fund_status
might better served by listreceivedbyaddress
instead of getreceivedbyaddress
Listrecievedbyaddress
provides richer information on incoming txs allowing for the program to provide feedback like fund tx in mempool but unconfirmed.
Json structure of listrecievedbyaddress
results
Result:
[
{
"involvesWatchonly" : true, (bool) Only returned if imported addresses were involved in transaction
"address" : "receivingaddress", (string) The receiving address
"account" : "accountname", (string) DEPRECATED. The account of the receiving address. The default account is "".
"amount" : x.xxx, (numeric) The total amount in BTC received by the address
"confirmations" : n, (numeric) The number of confirmations of the most recent transaction included
"label" : "label", (string) A comment for the address/transaction, if any
"txids": [
n, (numeric) The ids of transactions received with the address
...
]
}
,...
]
Kindly update for compatibility with Zcash 2.0.2 or provide some instructions and suggestions to accomplish same.
separate signing from sending of txs, get blockchain info from elsewhere
Add to RPC interface, so it's available with zcash-cli to perform these trades?
Have a new layer of abstraction on top of RPC interface for commonly used functions, including this?
Python library for XCAT with current RPC commands?
Notes:
Some things we want to implement could be built on top of RPC interface.
For example, synchronous z_sendmany call. That operation could be created as standalone client, or put into existing interface.
Should we start to move logic to a new layer?
User flow:
Low-level tool that could be building block for other stuff
Like having a tool for executing those 4 steps. Have to coordinate with other person out of band
Eventually we need reliable estimates of how often X Bitcoin blocks will occur before Y Zcash blocks, so that we can set safe locktimes on each chain. With the help of a statistician friend, I wrote a script to calculate that.
import operator as op
import math
# StackExchange ncr magic
def ncr(n, r):
r = min(r, n - r)
if r == 0:
return 1
numer = reduce(op.mul, xrange(n, n - r, -1))
denom = reduce(op.mul, xrange(1, r + 1))
return numer // denom
# Number of Bitcoin blocks for estimation
c1b = 100.0
# Bitcoin's rate (1 block per 600 seconds)
c1r = 1/600.0
# Number of Zcash blocks for estimation
c2b = 300.0
# Zcash's rate (1 block per 150 seconds)
c2r = 1/150.0
sum = 0.0
for k in range(int(c1b), int(c1b + c2b)):
term_one = ncr(int(c1b + c2b - 1), int(k))
term_two = math.pow(c1r / (c1r + c2r), k)
term_three = math.pow(c2r / (c1r + c2r), c1b + c2b - 1 - k)
sum += term_one * term_two * term_three
print sum
Currently the user enters data on the command line, or sets it in xcatconf.py. The xcatconf.py file is used for test cases to avoid manual data entry.
Need to improve how this data is passed in, and make compatible with different use cases.
After about 30 seconds, the rpc daemon times out. Need to refactor to only initialize the client when needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.