-
Notifications
You must be signed in to change notification settings - Fork 83
ENG-505 [DRAFT] local development setup #3858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lionakhnazarov
wants to merge
7
commits into
threshold-network:main
Choose a base branch
from
lionakhnazarov:feat/local-development-setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91,538
−35,273
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
09ef70f
Add performance metrics tracking for key operations
lionakhnazarov 9f00298
Add initial setup for local T network development
lionakhnazarov 788e21c
local development setup
lionakhnazarov 6b8b173
stage 3 - status challenge
lionakhnazarov 01f8b84
Add wallet and bridge configuration for Ethereum integration
lionakhnazarov 64aed0e
local development setup guide
lionakhnazarov 0ad63cd
Enhance RandomBeacon configuration and wallet request scripts
lionakhnazarov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,3 +66,6 @@ tmp/ | |
|
|
||
| # Output directory | ||
| out/ | ||
| storage/ | ||
| logs/ | ||
| data/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # This is a sample TOML configuration file for the Keep client. | ||
|
|
||
| [ethereum] | ||
| URL = "ws://127.0.0.1:8546" | ||
| KeyFile = "/Users/levakhnazarov/ethereum/data/keystore/UTC--2025-12-18T18-53-35.539381000Z--7966c178f466b060aaeb2b91e9149a5fb2ec9c53" | ||
| KeyFilePassword = "password" | ||
|
|
||
| # Uncomment to override the defaults for transaction status monitoring. | ||
|
|
||
| # MiningCheckInterval is the interval in which transaction | ||
| # mining status is checked. If the transaction is not mined within this | ||
| # time, the gas price is increased and transaction is resubmitted. | ||
| # | ||
| # MiningCheckInterval = 60 # 60 sec (default value) | ||
|
|
||
| # MaxGasFeeCap specifies the maximum gas fee cap the client is | ||
| # willing to pay for the transaction to be mined. The offered transaction | ||
| # gas cost can not be higher than the max gas fee cap value. If the maximum | ||
| # allowed gas fee cap is reached, no further resubmission attempts are | ||
| # performed. This property should be set only for Ethereum. In case of | ||
| # legacy non-EIP-1559 transactions, this field works in the same way as | ||
| # `MaxGasPrice` property. | ||
| # | ||
| # MaxGasFeeCap = "500 Gwei" # 500 Gwei (default value) | ||
|
|
||
| # Uncomment to enable Ethereum node rate limiting. Both properties can be | ||
| # used together or separately. | ||
| # | ||
| # RequestsPerSecondLimit sets the maximum average number of requests | ||
| # per second which can be executed against the Ethereum node. | ||
| # All types of Ethereum node requests are rate-limited, | ||
| # including view function calls. | ||
| # | ||
| # RequestsPerSecondLimit = 150 | ||
|
|
||
| # ConcurrencyLimit sets the maximum number of concurrent requests which | ||
| # can be executed against the Ethereum node at the same time. | ||
| # This limit affects all types of Ethereum node requests, | ||
| # including view function calls. | ||
| # | ||
| # ConcurrencyLimit = 30 | ||
|
|
||
| # BalanceAlertThreshold defines a minimum value of the operator's account | ||
| # balance below which the client will start reporting errors in logs. | ||
| # A value can be provided in `wei`, `Gwei` or `ether`, e.g. `7.5 ether`, | ||
| # `7500000000 Gwei`. | ||
| # | ||
| # BalanceAlertThreshold = "0.5 ether" # 0.5 ether (default value) | ||
|
|
||
| [bitcoin.electrum] | ||
| # URL to the Electrum server in format: `scheme://hostname:port`. | ||
| # Should be uncommented only when using a custom Electrum server. Otherwise, | ||
| # one of the default embedded servers is selected randomly at startup. | ||
| # For local development, a URL is required to pass validation. | ||
| # Using a testnet Electrum server URL as a placeholder. | ||
| # Replace this with a real Electrum server URL if needed for Bitcoin functionality. | ||
| URL = "tcp://148.251.237.196:50001" | ||
|
|
||
| # Timeout for a single attempt of Electrum connection establishment. | ||
| # ConnectTimeout = "10s" | ||
|
|
||
| # Timeout for Electrum connection establishment retries. | ||
| # ConnectRetryTimeout = "1m" | ||
|
|
||
| # Timeout for a single attempt of Electrum protocol request. | ||
| # RequestTimeout = "30s" | ||
|
|
||
| # Timeout for Electrum protocol request retries. | ||
| # RequestRetryTimeout = "2m" | ||
|
|
||
| # Interval for connection keep alive requests. | ||
| # KeepAliveInterval = "5m" | ||
|
|
||
| [network] | ||
| Bootstrap = false | ||
| Peers = [ | ||
| "/ip4/127.0.0.1/tcp/3919/ipfs/16Uiu2HAmFRJtCWfdXhZEZHWb4tUpH1QMMgzH1oiamCfUuK6NgqWX", | ||
| ] | ||
| Port = 3920 | ||
|
|
||
| # Uncomment to override the node's default addresses announced in the network | ||
| # AnnouncedAddresses = ["/dns4/example.com/tcp/3919", "/ip4/80.70.60.50/tcp/3919"] | ||
|
|
||
| # Uncomment to enable courtesy message dissemination for topics this node is | ||
| # not subscribed to. Messages will be forwarded to peers for the duration | ||
| # specified as a value in seconds. | ||
| # Message dissemination is disabled by default and should be enabled only | ||
| # on selected bootstrap nodes. It is not a good idea to enable dissemination | ||
| # on non-bootstrap node as it may clutter communication and eventually lead | ||
| # to blacklisting the node. The maximum allowed value is 90 seconds. | ||
| # | ||
| # DisseminationTime = 90 | ||
|
|
||
| [storage] | ||
| Dir = "/Users/levakhnazarov/threshold/fork2/keep-core/data" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, hardcoded absolute path. Might want to use a relative path or environment variable placeholder. |
||
|
|
||
| # ClientInfo exposes metrics and diagnostics modules. | ||
| # | ||
| # Metrics collects and exposes information useful for external monitoring tools usually | ||
| # operating on time series data. | ||
| # All values exposed by metrics module are quantifiable or countable. | ||
| # | ||
| # The following metrics are available: | ||
| # - connected peers count | ||
| # - connected bootstraps count | ||
| # - eth client connectivity status | ||
| # | ||
| # Diagnostics module exposes the following information: | ||
| # - list of connected peers along with their network id and ethereum operator address | ||
| # - information about the client's network id and ethereum operator address | ||
| [clientInfo] | ||
| Port = 9601 | ||
| NetworkMetricsTick = 60 | ||
| EthereumMetricsTick = 600 | ||
|
|
||
| # Uncomment to overwrite default values for TBTC config. | ||
| # | ||
| # [tbtc] | ||
| # PreParamsPoolSize = 3000 | ||
| # PreParamsGenerationTimeout = "2m" | ||
| # PreParamsGenerationDelay = "10s" | ||
| # PreParamsGenerationConcurrency = 1 | ||
| # KeyGenerationConcurrency = 1 | ||
|
|
||
| # Developer options to work with locally deployed contracts | ||
| [developer] | ||
| TokenStakingAddress = "0xAAA02A6D82732e0c08D2C7A75594CcDb064a9E03" | ||
| RandomBeaconAddress = "0x3b64D7b2C08a23307163cd1658e7d8e9935882D2" | ||
| WalletRegistryAddress = "0xd49141e044801DEE237993deDf9684D59fafE2e6" | ||
| BridgeAddress = "0xc0a2ee534F004a4ec2EFA541489acBD5ff4bBA99" | ||
| MaintainerProxyAddress = "0x6d19C0b4bd2B49eCa000C2Fd910c2Db9607f34ee" | ||
| WalletProposalValidatorAddress = "0x5f7dC10e6dD504EEB41678E287aa1732F5EA85c4" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Deposit Data for Testing | ||
|
|
||
| This directory contains deposit data structures prepared for tBTC testing. | ||
|
|
||
| ## Files | ||
|
|
||
| - **deposit-data.json** - Complete deposit information including all parameters | ||
| - **funding-tx-info.json** - BitcoinTxInfo structure for `revealDeposit()` call | ||
| - **deposit-reveal-info.json** - DepositDepositRevealInfo structure for `revealDeposit()` call | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Regenerate Deposit Data | ||
|
|
||
| ```bash | ||
| ./scripts/emulate-deposit.sh [depositor_address] [amount_satoshis] | ||
| ``` | ||
|
|
||
| Examples: | ||
| ```bash | ||
| # Use default values (random depositor, 1 BTC) | ||
| ./scripts/emulate-deposit.sh | ||
|
|
||
| # Specify depositor address | ||
| ./scripts/emulate-deposit.sh 0x1234...abcd | ||
|
|
||
| # Specify depositor and amount (0.5 BTC = 50000000 satoshis) | ||
| ./scripts/emulate-deposit.sh 0x1234...abcd 50000000 | ||
| ``` | ||
|
|
||
| ### Using the Data | ||
|
|
||
| The generated JSON files can be used with: | ||
|
|
||
| 1. **keep-client** (if Bridge supports revealDeposit): | ||
| ```bash | ||
| keep-client bridge reveal-deposit \ | ||
| --funding-tx-info "$(cat funding-tx-info.json | jq -c .)" \ | ||
| --deposit-reveal-info "$(cat deposit-reveal-info.json | jq -c .)" | ||
| ``` | ||
|
|
||
| 2. **cast** (if Bridge contract has revealDeposit function): | ||
| ```bash | ||
| cast send <BRIDGE_ADDRESS> \ | ||
| "revealDeposit((bytes4,bytes,bytes,bytes4),(uint32,bytes8,bytes20,bytes20,bytes4,address))" \ | ||
| "$(cat funding-tx-info.json | jq -c .)" \ | ||
| "$(cat deposit-reveal-info.json | jq -c .)" \ | ||
| --rpc-url http://localhost:8545 | ||
| ``` | ||
|
|
||
| ## Data Structure Details | ||
|
|
||
| ### BitcoinTxInfo | ||
| - `version`: Bitcoin transaction version (4 bytes) | ||
| - `inputVector`: Serialized transaction inputs | ||
| - `outputVector`: Serialized transaction outputs | ||
| - `locktime`: Transaction locktime (4 bytes) | ||
|
|
||
| ### DepositDepositRevealInfo | ||
| - `fundingOutputIndex`: Index of the output in funding transaction | ||
| - `blindingFactor`: 8-byte random value to distinguish deposits | ||
| - `walletPubKeyHash`: 20-byte hash of wallet public key (RIPEMD160(SHA256(compressed_pubkey))) | ||
| - `refundPubKeyHash`: 20-byte hash of refund public key | ||
| - `refundLocktime`: 4-byte refund locktime | ||
| - `vault`: Optional vault address (zero if not used) | ||
|
|
||
| ## Notes | ||
|
|
||
| - The wallet public key hash is calculated from the actual wallet created via DKG | ||
| - Funding transaction data is mocked for testing purposes | ||
| - In production, these would come from actual Bitcoin transactions | ||
| - BridgeStub doesn't implement `revealDeposit()` - deploy full Bridge contract for testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "depositor": "0xf0ec7364a8281ca906a4cf3526feb0989cf843a9", | ||
| "amount": 100000000, | ||
| "amountBTC": 1.00000000, | ||
| "fundingTxHash": "0x5764558a1065e0ca95732a81d5d64f3568b8607da06419c0706fdacf62db2bca", | ||
| "fundingOutputIndex": 0, | ||
| "walletID": "0x2fc6a693193fef87e90c6ccc9cfdbc12607422f45407c0416340ddd6ed470b9e", | ||
| "walletPublicKeyHash": "0x31e67e42a93bbe7f6e5c932232d38e42061369b7", | ||
| "blindingFactor": "0xa47d3d2c8a1d53f8", | ||
| "refundPublicKeyHash": "0x8223501baee1fbf3f9bbc8256258edeb66e5b94f", | ||
| "refundLocktime": "0x695457d0", | ||
| "fundingTxInfo": { | ||
| "version": "0x01000000", | ||
| "inputVector": "0x019b0b5f5c124c4c04d79de61309c34a607fa3b3867a9dbd82f30bfb54cdbec7a7be12fe5c25ddf3e9ba4eeca4f16fe46768604165e2d6381b7555d7782d4cd443ffffffff", | ||
| "outputVector": "0x010017f0ec7364a8281ca906a4cf3526feb0989cf843a9", | ||
| "locktime": "0x00000000" | ||
| }, | ||
| "depositRevealInfo": { | ||
| "fundingOutputIndex": 0, | ||
| "blindingFactor": "0xa47d3d2c8a1d53f8", | ||
| "walletPubKeyHash": "0x31e67e42a93bbe7f6e5c932232d38e42061369b7", | ||
| "refundPubKeyHash": "0x8223501baee1fbf3f9bbc8256258edeb66e5b94f", | ||
| "refundLocktime": "0x695457d0", | ||
| "vault": "0x0000000000000000000000000000000000000000" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "fundingOutputIndex": 0, | ||
| "blindingFactor": "0xa47d3d2c8a1d53f8", | ||
| "walletPubKeyHash": "0x31e67e42a93bbe7f6e5c932232d38e42061369b7", | ||
| "refundPubKeyHash": "0x8223501baee1fbf3f9bbc8256258edeb66e5b94f", | ||
| "refundLocktime": "0x695457d0", | ||
| "vault": "0x0000000000000000000000000000000000000000" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "version": "0x01000000", | ||
| "inputVector": "0x019b0b5f5c124c4c04d79de61309c34a607fa3b3867a9dbd82f30bfb54cdbec7a7be12fe5c25ddf3e9ba4eeca4f16fe46768604165e2d6381b7555d7782d4cd443ffffffff", | ||
| "outputVector": "0x010017f0ec7364a8281ca906a4cf3526feb0989cf843a9", | ||
| "locktime": "0x00000000" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contains a hardcoded local path and timestamp. Consider using a placeholder like
<YOUR_KEYFILE_PATH>or moving this toconfigs/config.toml.SAMPLEinstead of committing it to the repo root.