keep-network / local-setup

Allow to easily set up tBTC and Keep locally for development and test purposes.
MIT License
8 stars 16 forks source link

tBTC end-to-end test script #3

Closed lukasz-zimnoch closed 4 years ago

lukasz-zimnoch commented 4 years ago

Depends on #2

Here we improve the local environment setup scripts and introduce a new script to perform an end-to-end test of tBTC deposit and redemption. Apart from that, a script for installation and start-up of a local relay maintainer was added.

nkuba commented 4 years ago

I executed the e2e test script successfully.

✗ ./run-e2e-test.sh
npm WARN @babel/plugin-transform-runtime@7.10.1 requires a peer of @babel/core@^7.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN e2e@1.0.0 No description
npm WARN e2e@1.0.0 No repository field.
npm WARN e2e@1.0.0 No license field.

audited 2984 packages in 96.299s

45 packages are looking for funding
  run `npm fund` for details

found 23 vulnerabilities (22 low, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
(node:45730) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Starting deposit number [1]...

Creating new deposit contract with lot size 100000 satoshis...
Looking up new deposit with address 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 backed by keep at address 0x2dB696d61B2583D3b95165422f9e3551758cA166...
Monitoring deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 for transition to ACTIVE.
Waiting for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 keep public key...
Waiting for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 to retrieve public key...
Found public key for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
        Got deposit address: tb1qu8rhru0nhdjd6rn6kufkfv2apae3r4gqmvdypg ; fund with: 100000 satoshis please.
Now monitoring for deposit transaction...
Monitoring Bitcoin for transaction to address tb1qu8rhru0nhdjd6rn6kufkfv2apae3r4gqmvdypg...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Received notification for script hash: [e75df4da483fc704b3fa4f4d8e552c063b777a6807f8878441bf6ea4b87169a5] with status: [bdff42bdc939ef10a9ee56ffc59d454146380c0ece4f65c34ac7b54547e296d1]
Closing connection to electrum server...
Waiting for 1 confirmations for Bitcoin transaction 54c211596525bca8efb82af7fa863220ae34392772cbfe47e649f1785b754ace...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Registered listener for blockchain.headers.subscribe event
Received notification of a new block at height: [1747693]
Closing connection to electrum server...
Submitting funding proof to deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 for Bitcoin transaction 54c211596525bca8efb82af7fa863220ae34392772cbfe47e649f1785b754ace...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Closing connection to electrum server...
Deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 transitioned to ACTIVE.
Deposit is active, minting...
Approving transfer of deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 TDT to Vending Machine...
Minting TBTC...
Found Transfer event for 999500000000000 TBTC.

Deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 has been created successfully.

Starting deposit number [2]...

Creating new deposit contract with lot size 100000 satoshis...
Looking up new deposit with address 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F backed by keep at address 0xC8be1842e30230A2FE1B4eCeA3E288CFd71654D0...
Monitoring deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F for transition to ACTIVE.
Waiting for deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F keep public key...
Waiting for deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F to retrieve public key...
Found public key for deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F...
        Got deposit address: tb1q977u0phzuy3lktljjpvzdsqzrr5xhw6azdr48n ; fund with: 100000 satoshis please.
Now monitoring for deposit transaction...
Monitoring Bitcoin for transaction to address tb1q977u0phzuy3lktljjpvzdsqzrr5xhw6azdr48n...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]

Received notification for script hash: [7399dea7a9fc6341dde0a60756f8f5ae986e875775aa458fbc30a645a5549de9] with status: [0482a7a9a4953861f2a7bf290c643141016217cb08b953573173c72b941da4e1]
Closing connection to electrum server...
Waiting for 1 confirmations for Bitcoin transaction 7aa63c9d40b1428af4e607f21340c64bd69b8a02a91855f0ee578f7ad6b539b1...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Registered listener for blockchain.headers.subscribe event

Received notification of a new block at height: [1747695]
Closing connection to electrum server...
Submitting funding proof to deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F for Bitcoin transaction 7aa63c9d40b1428af4e607f21340c64bd69b8a02a91855f0ee578f7ad6b539b1...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Closing connection to electrum server...

Deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F transitioned to ACTIVE.
Deposit is active, minting...
Approving transfer of deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F TDT to Vending Machine...
Minting TBTC...

Found Transfer event for 999500000000000 TBTC.

Deposit 0xFB7Fb3e8DcC8CeB24176f4737a5B9e4bA6d46C6F has been created successfully.

Starting redemption of the first deposit...

Looking up Deposit contract at address 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Looking up Created event for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Found keep address 0x2dB696d61B2583D3b95165422f9e3551758cA166.
Found existing Bitcoin address for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Looking up UTXO size and transaction fee for redemption transaction...
Approving transfer of 1000000000000000 to the vending machine....
Initiating redemption of deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 from vending machine...
Looking up latest redemption details for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Finding or waiting for transaction signature for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Looking for existing signed redemption transaction on Bitcoin chain for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Closing connection to electrum server...
Broadcasting signed redemption transaction to Bitcoin chain for deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Closing connection to electrum server...
Waiting for 1 confirmations for Bitcoin transaction 998515ea4303b6786ce9cd362b1c5ab64a11c31a0f8bd9391b55e3dac00a8316...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Registered listener for blockchain.headers.subscribe event
^[[CReceived notification of a new block at height: [1747696]
Closing connection to electrum server...
Transaction is sufficiently confirmed; submitting redemption proof to deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346...
Connecting to electrum server...
You are connected to an ElectrumX 1.14.0 server.
Negotiated version: [ElectrumX 1.14.0,1.4.2]
Closing connection to electrum server...

Redemption outcome: Redeemed deposit 0x6Bffd428b2534816ABD2d45e66f9A976Bfc7e346 with Bitcoin transaction 998515ea4303b6786ce9cd362b1c5ab64a11c31a0f8bd9391b55e3dac00a8316.

Test completed successfully