diff --git a/contrib/assets_tutorial/assets_tutorial.py b/contrib/assets_tutorial/assets_tutorial.py index 29fdc4c057..e12e25bfda 100755 --- a/contrib/assets_tutorial/assets_tutorial.py +++ b/contrib/assets_tutorial/assets_tutorial.py @@ -46,7 +46,6 @@ def sync_all(e1, e2): time.sleep(1) return - ## Preparations # Make data directories for each daemon @@ -91,20 +90,19 @@ time.sleep(3) # Alternatively, you can set validatepegin=0 in their configs and not # run the bitcoin node, but it is necessary for fully validating the two way peg. -# At beginning "immature balance" holds all funds until genesis is mature -# Regtest chain starts with 21M elements coins as OP_TRUE which the wallet -# understands. This is useful for testing basic functionality. -# In Elements there is no block subsidy. All 21M output value in a mainnet -# pegged sidechain are locked for pegging. +# Regtest chain starts with 21M bitcoins as OP_TRUE which the wallet +# understands. This is useful for testing basic functionality and for +# blockchains that have no pegging functionality. "Policy" coins are required +# for anti-DoS purposes as well as asset issuance, which consumes inputs for entropy. +# In Elements there is no block subsidy. In a production sidechain it can +# be configured to start with no outputs, necessitating peg-in functionality +# for asset issuance. e1.getwalletinfo() # In regtest mining "target" is OP_TRUE since we have not set `-signblockscript` argument # Generate simply works. e1.generate(101) sync_all(e1, e2) -# Now we have 21M OP_TRUE value in each Elements wallet. -e1.getwalletinfo() -e2.getwalletinfo() ######## WALLET ########### @@ -419,12 +417,6 @@ e1.generate(101) bitcoin.generate(101) sync_all(e1, e2) -# We have to lock up some of the funds first. Regtest(what we're running) has all funds as OP_TRUE -# but this is not the case in testnet/production. Doesn't matter where we send it -# inside Bitcoin, this is just a hack to lock some funds up. -# We can immediately grab this output from the mempool on subsequent steps -e1.sendtomainchain(bitcoin.getnewaddress(), 50) - # Now we can actually start pegging in. Examine the pegin address fields e1.getpeginaddress() # Changes each time as it's a new sidechain address as well as new "tweak" for the watchmen keys @@ -448,7 +440,7 @@ proof = bitcoin.gettxoutproof([txid]) raw = bitcoin.getrawtransaction(txid) # Attempt claim! -claimtxid = e1.claimpegin(raw, proof, addrs["sidechain_address"]) +claimtxid = e1.claimpegin(raw, proof, addrs["witness_program"]) sync_all(e1, e2) # Other node should accept to mempool and mine diff --git a/contrib/assets_tutorial/assets_tutorial.sh b/contrib/assets_tutorial/assets_tutorial.sh index 52f1402672..d9ef72e43c 100755 --- a/contrib/assets_tutorial/assets_tutorial.sh +++ b/contrib/assets_tutorial/assets_tutorial.sh @@ -39,18 +39,11 @@ e2-dae # run the bitcoin node, but it is necessary for the two way peg parts of # this tutorial. -# Prime the chain, see "immature balance" holds all funds until genesis is mature -e1-cli getwalletinfo - -# Mining for now is OP_TRUE -e1-cli generate 101 - -# Now we have 21M OP_TRUE value +# We have 21M OP_TRUE value in each wallet +# This is useful for testing and non-sidechain applications of Elements e1-cli getwalletinfo e2-cli getwalletinfo -# Primed and ready - ######## WALLET ########### @@ -311,19 +304,11 @@ e2-dae $FEDPEGARG e1-cli generate 101 b-cli generate 101 -# We have to lock up some of the funds first. Regtest(what we're running) has all funds as OP_TRUE -# but this is not the case in testnet/production. Doesn't matter where we send it -# inside Bitcoin, this is just a hack to lock some funds up. -e1-cli sendtomainchain $(b-cli getnewaddress) 50 - -# Mature the pegout -e1-cli generate 101 - # Now we can actually start pegging in. Examine the pegin address fields e1-cli getpeginaddress # Changes each time as it's a new sidechain address as well as new "tweak" for the watchmen keys # mainchain_address : where you send your bitcoin from Bitcoin network -# sidechain_address : where the bitcoin will end up on the sidechain after pegging in +# witness_program: what script will have to be satisfied to spent the peg-in input # Each call of this takes the pubkeys defined in the config file, adds a random number to them # that is essetially the hash of the sidechain_address and other information, @@ -335,7 +320,7 @@ e1-cli getpeginaddress ADDRS=$(e1-cli getpeginaddress) MAINCHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['mainchain_address'])") -SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['sidechain_address'])") +SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['witness_program'])") #Send funds to unique watchmen P2SH address TXID=$(b-cli sendtoaddress $MAINCHAIN 1)