@@ -24,7 +24,7 @@ so you can pay to a pubkey, or to its hash. or to a script's hash. the last is h
|
||||
all of the above are the standard bitcoin vout types and there should be plenty of materials about it
|
||||
Encrypted by a verified device
|
||||
what I did with the CC contracts is created a fourth type of vout, the CC vout. this is using the cryptoconditions standard and it is even a different signature mechanism. ed25519 instead of secp256k1. it is basically a big extension to the bitcoin script. There is a special opcode that is added that says it is a CC script.
|
||||
|
||||
|
||||
but it gets more interesting
|
||||
each CC script has an evalcode
|
||||
this is just an arbitrary number. but what it does is allows to create a self-contained universe of CC utxo that all have the same evalcode and that is how a faucet CC differentiates itself from a dice CC, the eval code is different
|
||||
@@ -73,7 +73,7 @@ struct CC_utxo
|
||||
|
||||
// these are the parameters stored after Verus crypto-condition vouts. new versions may change
|
||||
// the format
|
||||
struct CC_meta
|
||||
struct CC_meta
|
||||
{
|
||||
std::vector<unsigned char> version;
|
||||
uint8_t evalCode;
|
||||
@@ -110,7 +110,7 @@ int32_t komodo_nextheight();
|
||||
static const uint256 zeroid;
|
||||
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock);
|
||||
int32_t is_hexstr(char *str,int32_t n);
|
||||
bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL);
|
||||
bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL, bool fSkipExpiry = false);
|
||||
//uint64_t myGettxout(uint256 hash,int32_t n);
|
||||
bool myIsutxo_spentinmempool(uint256 txid,int32_t vout);
|
||||
bool mytxid_inmempool(uint256 txid);
|
||||
|
||||
11
src/cc/dapps/Makefile
Normal file
11
src/cc/dapps/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
# just type make to compile all dapps
|
||||
all: zmigrate oraclefeed
|
||||
|
||||
zmigrate:
|
||||
$(CC) zmigrate.c -o zmigrate -lm
|
||||
|
||||
oraclefeed:
|
||||
$(CC) oraclefeed.c -o oraclefeed -lm
|
||||
|
||||
clean:
|
||||
rm zmigrate oraclefeed
|
||||
28
src/cc/dapps/README.md
Normal file
28
src/cc/dapps/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# CryptoCondition dApps
|
||||
|
||||
## Compiling
|
||||
|
||||
To compile all dapps in this directory:
|
||||
|
||||
make
|
||||
|
||||
## zmigrate - Sprout to Sapling Migration dApp
|
||||
|
||||
This tool converts Sprout zaddress funds into Sapling funds in a new Sapling address.
|
||||
|
||||
### Usage
|
||||
|
||||
./zmigrate COIN zsaplingaddr
|
||||
|
||||
The above command may need to be run multiple times to complete the process.
|
||||
|
||||
This CLI implementation will be called by GUI wallets, average users do not
|
||||
need to worry about using this low-level tool.
|
||||
|
||||
## oraclefeed - feed of price data using oracles
|
||||
|
||||
### Usage
|
||||
|
||||
./oraclefeed $ACNAME $ORACLETXID $MYPUBKEY $FORMAT $BINDTXID [refcoin_cli]
|
||||
|
||||
Supported formats are L and Ihh. Price data from CoinDesk API.
|
||||
@@ -427,11 +427,11 @@ void *dicefinish(void *_ptr)
|
||||
if ( vin0_needed > 0 )
|
||||
{
|
||||
num = 0;
|
||||
//fprintf(stderr,"iter.%d vin0_needed.%d\n",iter,vin0_needed);
|
||||
//fprintf(stderr,"iter.%d vin0_needed.%d\n",iter,vin0_needed);
|
||||
utxos = (struct dicefinish_utxo *)calloc(vin0_needed,sizeof(*utxos));
|
||||
if ( (n= dicefinish_utxosget(num,utxos,vin0_needed,coinaddr)) > 0 )
|
||||
{
|
||||
//fprintf(stderr,"iter.%d vin0_needed.%d got %d, num 0.0002 %d\n",iter,vin0_needed,n,num);
|
||||
//fprintf(stderr,"iter.%d vin0_needed.%d got %d, num 0.0002 %d\n",iter,vin0_needed,n,num);
|
||||
m = 0;
|
||||
DL_FOREACH_SAFE(DICEFINISH_LIST,ptr,tmp)
|
||||
{
|
||||
@@ -484,7 +484,8 @@ void *dicefinish(void *_ptr)
|
||||
//fprintf(stderr,"error ready.%d dicefinish %d of %d process %s %s using need %.8f finish.%s size.%d betspent.%d\n",ptr->bettxid_ready,m,n,iter<0?"loss":"win",ptr->bettxid.GetHex().c_str(),(double)(iter<0 ? 0 : ptr->winamount)/COIN,ptr->txid.GetHex().c_str(),(int32_t)ptr->rawtx.size(),dice_betspent((char *)"dicefinish",ptr->bettxid));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ( system("cc/dapps/sendmany100") != 0 )
|
||||
fprintf(stderr,"error issing cc/dapps/sendmany100\n");
|
||||
free(utxos);
|
||||
}
|
||||
}
|
||||
@@ -533,7 +534,7 @@ void DiceQueue(int32_t iswin,uint64_t sbits,uint256 fundingtxid,uint256 bettxid,
|
||||
else
|
||||
{
|
||||
//fprintf(stderr,"DiceQueue status bettxid.%s already in list\n",bettxid.GetHex().c_str());
|
||||
_dicehash_clear(bettxid);
|
||||
//_dicehash_clear(bettxid);
|
||||
}
|
||||
pthread_mutex_unlock(&DICE_MUTEX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user