Giter VIP home page Giter VIP logo

internal-custody's Introduction

Internal Custody

Install

You need a running full node and wallet for most commands to work. You don't need anything if you are just a signer. Here are the instructions for this piece:

py -m venv venv
. ./venv/bin/activate  # ./venv/Scripts/activate for Windows users
pip install --extra-index-url https://pypi.chia.net/simple/ chia-internal-custody

If you're on Windows, you need one extra package:

pip install pyreadline

Key Generation

hsmgen > 1.se
hsmgen > 2.se
hsmgen > 3.se
hsmpk $(cat 1.se) > 1.pk
hsmpk $(cat 2.se) > 2.pk
hsmpk $(cat 3.se) > 3.pk

Note: If you're on windows powershell 5 or lower, > does not work properly. Either upgrade your shell or find some other way to put the output into a file as UTF-8.

Configuration

cic init --withdrawal-timelock 60 --payment-clawback 120 --rekey-cancel 120 --rekey-timelock 120 --slow-penalty 120
cic derive_root -pks "1.pk,2.pk,3.pk" -m 2 -n 3

Launch

cic launch_singleton --fee 100000000
cic sync -c './Configuration (<your 6 hex digits>).txt'
cic p2_address --prefix txch
<send money to that address and wait for confirmation>
cic sync

Payment

cic payment -f initial_absorb.unsigned -pks "1.pk,2.pk" -a 100 -t <own address> -ap -at 0
cat ./initial_absorb.unsigned | hsms -y --nochunks 1.se
echo <sig here> > initial_absorb.1.sig
cat ./initial_absorb.unsigned | hsms -y --nochunks 2.se
echo <sig here> > initial_absorb.2.sig
hsmmerge ./initial_absorb.unsigned ./initial_absorb.1.sig ./initial_absorb.2.sig > initial_absorb.signed
cic push_tx -b ./initial_absorb.signed -m 100000000
cic sync

Clawback

cic clawback -f clawback.unsigned -pks "1.pk,2.pk"
cat ./clawback.unsigned | hsms -y --nochunks 1.se
echo <sig here> > clawback.1.sig
cat ./clawback.unsigned | hsms -y --nochunks 2.se
echo <sig here> > clawback.2.sig
hsmmerge ./clawback.unsigned ./clawback.1.sig ./clawback.2.sig > clawback.signed
cic push_tx -b ./clawback.signed -m 100000000
cic sync

Re-configure

cic derive_root --db-path './sync (<your hex digits>).sqlite' -c './Configuration (new).txt' -pks "1.pk,2.pk" -m 1 -n 2

Rekey

cic start_rekey -f rekey.unsigned -pks "1.pk,2.pk" -new './Configuration (new).txt'
cat ./rekey.unsigned | hsms -y --nochunks 1.se
echo <sig here> > rekey.1.sig
cat ./rekey.unsigned | hsms -y --nochunks 2.se
echo <sig here> > rekey.2.sig
hsmmerge ./rekey.unsigned ./rekey.1.sig ./rekey.2.sig > rekey.signed
cic push_tx -b ./rekey.signed -m 100000000
cic sync

Complete

cic complete -f complete.signed
cic push_tx -b ./complete.signed -m 100000000
cic sync

Update DB config

cic update_config -c './Configuration (new).txt'

Increase security

cic increase_security_level -f lock.unsigned -pks "1.pk,2.pk"
cat ./lock.unsigned | hsms -y --nochunks 1.se
echo <sig here> > lock.1.sig
cat ./lock.unsigned | hsms -y --nochunks 2.se
echo <sig here> > lock.2.sig
hsmmerge ./lock.unsigned ./lock.1.sig ./lock.2.sig > lock.signed
cic push_tx -b ./lock.signed -m 100000000
cic sync

internal-custody's People

Contributors

brandth22 avatar cmmarslender avatar matt-o-how avatar nirajpathak13 avatar quexington avatar richardkiss avatar wallentx avatar wjblanke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

internal-custody's Issues

cic launch_singleton fails when using a fee

cic launch_singleton --fee 1000

Traceback (most recent call last):
  File "/Users/chrismarslender/Projects/internal-custody/venv/bin/cic", line 8, in <module>
    sys.exit(main())
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/cic/cli/main.py", line 1938, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/cic/cli/main.py", line 405, in launch_cmd
    asyncio.get_event_loop().run_until_complete(do_command())
  File "/opt/homebrew/Cellar/[email protected]/3.9.12_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/cic/cli/main.py", line 377, in do_command
    await wallet_client.create_signed_transaction(
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/chia/rpc/wallet_rpc_client.py", line 230, in create_signed_transaction
    response: Dict = await self.fetch("create_signed_transaction", request)
  File "/Users/chrismarslender/Projects/internal-custody/venv/lib/python3.9/site-packages/chia/rpc/rpc_client.py", line 49, in fetch
    raise ValueError(res_json)
ValueError: {'error': '', 'success': False}

Multiple pending payments, `cic complete` tries to complete the wrong payment

I had a list of multiple payments, and tried to complete the "ready" payment (others were pending). I selected payment 1 to complete, and it actually generated a complete spend for one of the other payments. Seems like the index 1 is not lining up correctly when generating the spend to the payment I actually selected (the other payments had - as their numbers)

`get_node_and_wallet_clients` issue

There was a change from using chia.cmds.wallet_funcs.get_wallet to chia.cmds.cmds_util.get_wallet in ead10ad.

However, the two functions have different signatures:

  1. chia.cmds.wallet_funcs.get_wallet's signature is (wallet_client: WalletRpcClient, fingerprint: int = None) -> Optional[Tuple[WalletRpcClient, int]]
  2. chia.cmds.cmds_util.get_wallet's signature is (root_path: Path, wallet_client: WalletRpcClient, fingerprint: Optional[int]) -> Optional[int].

So the code here doesn't work anymore.

To fix this, we could pass DEFAULT_ROOT_PATH and modify chia.cmds.cmds_util.get_wallet to return WalletRpcClient as well.

Incorrect amount available display

Created a new singleton with a total 1txch value, then funded.

when I sync/show, the output is:

Singleton:
  - launcher ID: 3f...
  - amount left: 0
  - amount available: 999999999999
  - amount to claim: 1000000000000

Amount available should actually be 1000000000000

cic sync fails with too much dust

When the singleton has a bunch of dust sent to it, cic sync fails with the following:

cic sync -s
413, message='Request Entity Too Large', url=URL('https://localhost:8555/get_coin_records_by_names')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.