Commit graph

20375 commits

Author SHA1 Message Date
Gregory Sanders
47db75e39f Dynafed RPC support, tests, and deployment for custom chains 2019-09-05 10:51:09 -04:00
Gregory Sanders
aac354b5ba OP_TRUE outputs should be allowed to be segwit-ified by decodescript 2019-09-03 10:55:29 -04:00
Gregory Sanders
055514b688 Have removeForBlock boot transactions when required 2019-09-03 10:55:29 -04:00
Gregory Sanders
525b24cf5c Expose fedpeg fetching to consensus and mempool internals 2019-09-03 10:55:29 -04:00
Gregory Sanders
4ac437b87c GetTransactionSigOpCost shouldn't need fedpegscript to evaluate 2019-09-03 10:55:29 -04:00
Gregory Sanders
5097c3880c Add and update startup args for dynafed 2019-09-03 10:55:28 -04:00
Gregory Sanders
24535d6a9f Add unused dynamic genesis block style in chainparams 2019-09-03 10:55:09 -04:00
Gregory Sanders
d10c42a26e Create epoch length chainparam 2019-09-03 10:55:09 -04:00
Gregory Sanders
b996a425e1 Set default of multi_data_permitted to enforce_pak 2019-09-03 10:55:06 -04:00
Gregory Sanders
f6f6308c93 Correct comment about liquidv1 fedpeg matching template 2019-09-03 10:55:06 -04:00
Gregory Sanders
4c00eb4084 Miner should stop trying to account for old PAK system 2019-09-03 10:55:06 -04:00
Gregory Sanders
0e10287f7a Add miner ability to make dynafed blocks 2019-09-03 10:55:06 -04:00
Gregory Sanders
5d281e7e68 ContextualCheckBlockHeader: dynafed doesn't call CheckChallenge 2019-09-03 10:55:06 -04:00
Gregory Sanders
9fe43cdf86 Introduce contextual block checks for dynafed 2019-09-03 10:55:06 -04:00
Gregory Sanders
3605505c94 Enable pak enforcement at mempool/block level when appropriate 2019-09-03 10:55:06 -04:00
Gregory Sanders
802a055191 ScriptHasValidPAKProof takes fedpeg as arg 2019-09-03 10:55:06 -04:00
Gregory Sanders
89174e9617 Remove old mempool-booting logic 2019-09-03 10:55:06 -04:00
Gregory Sanders
edb865cc2f Remove standardness checks for PAK 2019-09-03 10:55:06 -04:00
Gregory Sanders
804cd9f75f Update PAK internals, helper functions 2019-09-03 10:55:06 -04:00
Gregory Sanders
16b87ba951 Disable PAK loading from configuration on init, disable pak test 2019-09-03 10:55:06 -04:00
Gregory Sanders
918896d6ff Add inactive versionbits dynafed deployment 2019-09-03 10:55:06 -04:00
Gregory Sanders
0a8565bbf8 ReadBlockFromDisk: do genesis block check before block proof check 2019-09-03 10:55:06 -04:00
Gregory Sanders
6f0d9244f6 Bump last old block version for versonbits due to elements 2019-09-03 10:55:06 -04:00
Gregory Sanders
563cd93d43 Add python implementation of dynafed block serialization 2019-09-03 10:55:06 -04:00
Gregory Sanders
8d3091bbcb Deserialize merkle proofs without witness, which matters for dynafed 2019-09-03 10:55:06 -04:00
Gregory Sanders
830f917235 Add fedpegscript-fetching helper 2019-09-03 10:55:06 -04:00
Gregory Sanders
b56fe14956 calculate_contract: remove most template checks and assert in preperation for dynafed 2019-09-03 10:55:06 -04:00
Gregory Sanders
fd63cee1ab Add note on peg-in sigops 2019-09-03 10:55:06 -04:00
Gregory Sanders
f17d7de526 Add dynafed helper functions 2019-09-03 10:55:06 -04:00
Gregory Sanders
4aa5f991f4 Refactor block_proof to support dynafed 2019-09-03 10:50:16 -04:00
Gregory Sanders
4e52f2c83c Add dynamic federation blockheader fields to chaindb serialization 2019-09-03 10:50:16 -04:00
Gregory Sanders
a74accf7d1 Add dynamic federations blockheader serialization with HF bit 2019-09-03 10:50:16 -04:00
Gregory Sanders
2845e7811e Define dynamic federations primitives 2019-09-03 10:50:16 -04:00
Gregory Sanders
66c5045d5a
Merge #693: Qt fixes post 18
0fef2be3c Fix QT transaction blinding details being committed to wallet (Gregory Sanders)
172ad7198 Fix QT startup for custom chains (Gregory Sanders)

Pull request description:

  resolves https://github.com/ElementsProject/elements/issues/692

Tree-SHA512: bc18ada2350df95ebcd96fbc64be4085ca4f85e272ed89a3052d91bb02d48f6fc3c9cd0451db9741b14f4c416574d7f9db44cdc7a1502026a48729820ffb6aee
2019-09-03 10:08:53 -04:00
Steven Roose
a6878b8080
Merge #696: sendtomainchain with pak and subtract fee from output fix
adedc7f9c fix HelpExamplRPC port for liquidv1 vs bitcoin mainnet (Gregory Sanders)
d35bf0821 Fix sendtomainchain with pak when subtracting fee from output (Gregory Sanders)

Pull request description:

  resolves https://github.com/ElementsProject/elements/issues/695

  and also fixes RPC port in help

  needs backport to 0.17/0.18

Tree-SHA512: fb5414264a3fc70320b2e25261435a60383c4bf7c2c7f2d6381a862a1c89b2a97f824da412d21cf2e827d02e40e54dde214de471aad9a54c7f3c06ec98d6d840
2019-09-02 11:31:53 +01:00
Gregory Sanders
adedc7f9c1 fix HelpExamplRPC port for liquidv1 vs bitcoin mainnet 2019-08-30 11:36:01 -04:00
Gregory Sanders
d35bf08210 Fix sendtomainchain with pak when subtracting fee from output 2019-08-30 11:35:43 -04:00
Gregory Sanders
0fef2be3cc Fix QT transaction blinding details being committed to wallet 2019-08-22 15:25:42 -04:00
Gregory Sanders
172ad71988 Fix QT startup for custom chains 2019-08-22 15:25:00 -04:00
Gregory Sanders
285712834e
Merge #688: fix config err
eef221938 fix config err (Chengcheng Zhang)

Pull request description:

  I was confused to instructions in [Elements code tutorial](https://elementsproject.org/elements-code-tutorial/working-environment):

  > `cp ~/elements/contrib/assets_tutorial/elements2.conf ~/elementsdir2/elements.conf`

  But, in `~/elements/contrib/assets_tutorial/elements2.conf`, the network type is not specified at the beginning.

  I got an error after `e2-cli`:

  ```
  $ e2-cli getwalletinfo
  error: Could not connect to the server 127.0.0.1:7041

  Make sure the daemon server is running and that you are connecting to the correct RPC port.
  ```

  because elements default network is liquid, the port is 7041, so if you don't point the correct chain, you wouldn't get correct info.

  So I think the correct elements2.conf as below:

  ```
  chain=elementsregtest

  rpcuser=user2
  rpcpassword=password2
  elementsregtest.rpcport=18885
  elementsregtest.port=18887
  elementsregtest.connect=localhost:18886

  daemon=1
  listen=1
  txindex=1

  #fedpegscript=51<pubkey>51ae
  #signblockscript=51<pubkey2>51ae

  mainchainrpcport=18888
  mainchainrpcuser=user3
  mainchainrpcpassword=password3
  validatepegin=1

  initialfreecoins=2100000000000000
  ```

  I got correct result:

  ```
  $ e2-cli -getinfo
  {
    "version": 189900,
    "protocolversion": 70015,
    "walletversion": 169900,
    "balance": {
      "bitcoin": 21000000.00000000
    },
    "blocks": 0,
    "timeoffset": 0,
    "connections": 0,
    "proxy": "",
    "difficulty": null,
    "testnet": false,
    "keypoololdest": 1565173696,
    "keypoolsize": 1000,
    "paytxfee": 0.00000000,
    "relayfee": 0.00001000,
    "warnings": ""
  }
  ```

Tree-SHA512: c49303328fe5dde6682a1a8cde88350f35af081bb54d0d1dd5072a4c92cb043ed0b84303956a692bc4bc58f5741eae5664f8ffbe9ca795ca7f632c98d43586dd
2019-08-12 09:31:03 -04:00
Chengcheng Zhang
eef2219389
fix config err 2019-08-07 18:33:25 +08:00
Gregory Sanders
c67ef2938c
Merge #600: PSBT for Confidential Assets
3127c6561 Add legacy help text for walletprocesspsbt suggesting to use new RPCs instead. (Glenn Willen)
d39925b08 Disable PSBT RPCs when not in g_con_elementsmode. (Glenn Willen)
2848b520b PSBT for Confidential Assets (Glenn Willen)
f87684a00 Add convenience method GetNonIssuanceBlindingData (Glenn Willen)

Pull request description:

  This PR extends the PSBT format and RPCs to handle Confidential Assets transactions.

  New fields in PSBT inputs: Unblinded value, Value blinder, Unblinded asset, Asset blinder.
  New fields in PSBT outputs: Recipient blinding pubkey, Value commitment, Value blinder, Asset commitment, Asset blinder, Nonce commitment, Range proof, Surjection proof.

  We preserve the existing invariant that the unsigned transaction inside a PSBT never changes during the process; all updates that need to be applied to produce the final signed transaction are accumulated in the PSBT fields listed above.

  The process is as follows:
  * Create a PSBT using `converttopsbt` [deprecated], `walletcreatefundedpsbt`, `createpsbt`
     * At this point, the output pubkey fields will be filled, for any outputs to confidential addresses.
     * Input fields may be filled, if the wallet was used; otherwise they will be filled in the next step.
     * Incremental creation of the unsigned transaction itself is OUTSIDE the scope of this work. The unsigned transaction must be fully populated with inputs and outputs before the PSBT is created.
     * Transactions with peg-in, issuance, or reissuance outputs are NOT supported at this time.
  * If necessary, update the psbt with input data using `walletfillpsbtdata`.
     * This is like the old `walletprocesspsbt` RPC [deprecated], which tried to both fill and sign the PSBT (which is not workable in the Confidential Assets setting.)
  * Once all inputs have had necessary data updated, possibly using multiple wallets if necessary, any wallet can be used to blind the transaction using `blindpsbt`.
     * This uses the input blinding data, along with the output blinding pubkeys, to compute the output blinding data.
     * Incremental blinding is not supported. All input blinding data must be available when `blindpsbt` is called.
  * Then, the blinded PSBT must be signed using `walletsignpsbt`. As with updating, this can be done by multiple wallets as necessary for the inputs being signed.
  * Once all signatures are present, `finalizepsbt` is used to create the final transaction in the regular transaction format, as before.
  * Then `sendrawtransaction` is used, which will check to make sure that blinding was performed properly before sending.

Tree-SHA512: 2844a1545383cdab6025b90791c9e66f280d988bd40e37354c831b309c4c41eead144ca6d69c956cac40e849978c3450d1a22910f51ca3c6245236b29c05faa8
2019-07-31 15:06:51 -04:00
Glenn Willen
3127c65615 Add legacy help text for walletprocesspsbt suggesting to use new RPCs instead. 2019-07-31 10:50:03 -07:00
Glenn Willen
d39925b08a Disable PSBT RPCs when not in g_con_elementsmode. 2019-07-31 10:50:03 -07:00
Glenn Willen
2848b520b2 PSBT for Confidential Assets 2019-07-31 10:50:03 -07:00
Glenn Willen
f87684a007 Add convenience method GetNonIssuanceBlindingData 2019-07-26 09:17:19 -07:00
Gregory Sanders
065401bc63
Merge #674: [rpc]blindrawtransaction accepts more commitments
d584b65 [test]decrese num of inputs on partial blind test (Akio Nakamura)
254b166 [rpc]blindrawtransaction accepts more commitments (Akio Nakamura)

Pull request description:

  In #510 / #550 a requirement that the blinding commitments were equal in amount to the inputs was introduced. This requirement is correct for the final case, but not for partial transactions (e.g. where party 1 blinds their inputs before even handing the transaction over to party 2 to add theirs). In order to hide party 1's input amounts from party 2, blindrawtransaction must allow >= the inputs, since the commitments are shared beforehand (if not, the blinding fails; this may need further investigating).

  This PR restores the functionality to allow blinding commitments more than or equal to the amount of inputs, which makes the confidential assets demo https://github.com/ElementsProject/confidential-assets-demo functional again.

Tree-SHA512: 11c7e1c648aea26be2f4cb47606cd8e9b40d9e0d736a7eeb1989d6fad10f8f06528fd90766cb95e304c9b2c371278b20d7ef61099cb8b6e18b281a260e5de92d
2019-07-23 10:12:12 -04:00
Gregory Sanders
3dd46d1730
Merge #675: Change default chain to liquidv1
6482455 Change default chain to liquidv1 (Gregory Sanders)
2019-07-12 10:45:31 -04:00
Gregory Sanders
648245505d Change default chain to liquidv1 2019-07-10 13:41:36 -04:00
Akio Nakamura
d584b65c18 [test]decrese num of inputs on partial blind test 2019-07-05 19:10:11 +09:00