<<  >> (p.4)
    Author Topic: CIYAM - Project Plan Outline and Progress Updates  (Read 14774 times)
    This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
    CIYAM (OP)
    Legendary
    *
    Offline Offline

    Activity: 1890
    Merit: 1126


    Ian Knowles - CIYAM Lead Developer


    View Profile WWW
    January 03, 2016, 01:42:27 PM
    Last edit: January 04, 2016, 03:26:24 AM by CIYAM
     #61

    Some exciting news is that I have successfully tested an ACCT CLTV redeem using Bitcoin (regest)!!!

    The script to do this has been added to the CIYAM project so provided that you install Bitcoin you will be able to run this using the ciyam_client application.

    Usage is as follows (make sure you have bitcoind running before doing this):
    Code:
    ./ciyam_client -echo -quiet -no_prompt < test_acct_cltv.cin

    The script contents is as follows:
    Code:
    ; Copyright (c) 2016 CIYAM Developers
    ;
    ; Distributed under the MIT/X11 software license, please refer to the file license.txt
    ; in the root project directory or http://www.opensource.org/licenses/mit-license.php.
    ;
    ;CIYAM Bitcoin regression test script for ACCT CLTV redemption
    ;-------------------------------------------------------------
    ;
    ;NOTE: In order to utilise the following script you will first
    ;need to install Bitcoin either into the directory where CIYAM
    ;has been compiled or if not then set the TBITCOIN environment
    ;variable accordingly (check the 'tbitcoin' script to work out
    ;how to do this and don't forget the '-regtest' option). First
    ;make sure that any existing 'regtest' data has been destroyed
    ;then start 'bitcoind'.
    ;
    ~tbitcoin generate 101
    ;
    ; Define an address and matching WIF private key for testing
    ;
    ADDR=mp7zjTrEszZezRBM1cUmTvaK2zf3MuDAHt
    WKEY=cPR4DC5NXVkR37wEbCuUVuvuFxSozsMr8SHYteB2iqG8yV3uHdFR
    ;
    ; To simplify testing just uses the same address for redemption
    ;
    crypto_addr_hash $ADDR
    PKH1=$OUTPUT
    PKH2=$OUTPUT
    ;
    ; Setup an ACCT P2SH script and then get its address and script hash
    ;
    SCTH=c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646
    ~tbitcoin importprivkey $WKEY
    TXID=@~tbitcoin sendtoaddress $ADDR 50
    BLKN=7f
    SCRIPT=76a820%SCTH%87637576a914%PKH1%88ac6701%BLKN%b17576a914%PKH2%88ac68
    crypto_p2sh_addr TBTC $SCRIPT
    P2SH_ADDR=$OUTPUT
    crypto_addr_hash $P2SH_ADDR
    P2SH_HASH=$OUTPUT
    ;
    ; Send funds to the P2SH address
    ;
    ~tbitcoin generate 1
    TXID=@~tbitcoin sendtoaddress $P2SH_ADDR 50
    OLD_TX=@~tbitcoin getrawtransaction $TXID
    ~tbitcoin decoderawtransaction $OLD_TX
    ;
    ; (check that the VOUT matches or change the next line)
    ; (also verify the P2SH scriptPubKey's script and hash)
    ;
    VOUT=0
    #$P2SH_HASH
    ~tbitcoin getblockcount
    LOCK=127
    crypto_p2sh_redeem $TXID $VOUT $SCRIPT $ADDR 5000000000 $WKEY $LOCK
    RAW_TX=$OUTPUT
    ~tbitcoin decoderawtransaction $RAW_TX
    ~tbitcoin signrawtransaction $RAW_TX
    ;
    ; Note this attempt will fail due to being non-final (i.e. locktime)
    ;
    ~tbitcoin sendrawtransaction $RAW_TX
    ;
    ; Increase the block height and then redeem funds from the P2SH UTXO
    ;
    ~tbitcoin generate 25
    ~tbitcoin getblockcount
    TXID=@~tbitcoin sendrawtransaction $RAW_TX
    NEW_TX=@~tbitcoin getrawtransaction $TXID
    ~tbitcoin decoderawtransaction $NEW_TX
    ~tbitcoin generate 1

    In order to use it you will need to delete any existing 'regtest' stuff first.

    This is only the CLTV redeem (or "refund redeem") - so the next step will be the "reveal secret redeem".

    With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

    GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Page 3
Viewing Page: 4