Highly decentralized and censorship-resistant way to store key data

Overview

Beacon coin

Beacon coin is a Chia singelton coin that can store data that needs to be:

  • always available
  • censorship resistant
  • versioned
  • potentially immutable

You might want to use it for coordinating peers in a network, storing DNS information or whatever else you think of. (please share though). I wrote this mainly to learn more about Chialisp and explore smart coins in Chia Network (especially singletons). I used some general principles that could be expanded to implement a smart contract type of coin, with methods and state etc.

This code is still work in progress so please DO NOT USE it on mainnet. Use at your own risk.

Please note that I'm not affiliated with Chia Network. This means that I don't know if this is the right way to write smart coins and that it might contain some serious security issues until more people review it. Any feedback appreciated. Thanks!

How to use

For Unix/Macs

Clone this repo in a directory.

python3 -m venv venv
. ./venv/bin/activate
pip install .
beacon-coin --help

It should work on Windows too, although did't test:

py -m venv venv
./venv/Scripts/activate
pip install .
beacon-coin

You'll need a testnet chia node and wallet with some mojos. Once wallet and node are synced, you can start using beacon coin. Make sure CHIA_ROOT is set and pointing to the correct chia network (testnet!). More on that here: https://github.com/Chia-Network/chia-blockchain/wiki/How-to-connect-to-the-Testnet

Usage

Usage: beacon-coin [OPTIONS] COMMAND [ARGS]...

  Manage beacon coins on Chia network.

  They can be used to store key information in a decentralized and durable
  way.

Options:
  --config-path TEXT  Path to your Chia blockchain config (usually ~/.chia).
                      Defaults to fetching it from CHIA_ROOT env var.

  --fingerprint TEXT  Key fingerprint, will default to first one it finds if
                      not provided.

  -v, --verbose       Show more debugging info.
  --help              Show this message and exit.

Commands:
  add-pair      Add a pair of strings to coin data.
  change-owner  Change the owner, works on mutable and immutable coins.
  freeze        Freezing makes the coin immutable
  get-data      Returns a JSON of coin data and metadata Can be piped into...
  mint          Mint a new beacon coin, returns a LAUNCHER_ID.
  remove-pair   Remove a pair at a specifed index from coin data.

First you'll need to mint a beacon coin:

$ beacon-coin mint --fee=10 
Minted a new beacon coin with id: 3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12

Track transaction: 070d0ed91de0ce80c884f13ecad4db02d9d63ae028244e1e55dc69aac1b7904f     Fee: 10 mojos

NOTE: Store launcher_id somewhere safe as this wallet doesn't keep it anywhere yet.

Wait until transaction is processed.

You can use cdv mempool -txid 070d0ed91de0ce80c884f13ecad4db02d9d63ae028244e1e55dc69aac1b7904f

Let's check contents first:

$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12
{"version": 1, "data": []}

Ok, now let's add some data:

$ beacon-coin add-pair --fee=10 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 "some" "data"
Added pair ('some', 'data') using transaction: 364eeab9433f6bbf382f2659bdf5bc23c51ae862a765b3d3fdfcf56fe9c8bf1e

Wait again for node to process it.

And let's check content again:

$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12                       
{"version": 2, "data": [[0, ["some", "data"]]]}

Ok, we just stored some data on Chia blockchain.

Let's add more and test the removal.

$ beacon-coin add-pair --fee=10 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 "more" "data"
Added pair ('more', 'data') using transaction: 4e1ed3b76c474a73d68781d328b130d408bacd6650b4018d63231581655aac33
$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12                       
{"version": 3, "data": [[0, ["more", "data"]], [1, ["some", "data"]]]}
$ beacon-coin remove-pair --fee=15 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 0
Removed pair at 0 using transaction: efbbe9fbeadc78c0840f3bffbda57ea1f8d734cbb634992fcd5e4aa28c4a5ab1
$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12
{"version": 4, "data": [[0, ["some", "data"]]]}

Python API

beacon-coin is internally using python API to manage coins.

TODOs

  • refactor wallet and make it more DRY
  • publish tests (right now still in progress)
  • add soft linking between different coins, can enable things like having an immutable beacon coin that points to other mutable coins
Owner
Sebastjan Trepca
Sebastjan Trepca
BTCRecover is an open source wallet password and seed recovery tool.

BTCRecover is an open source wallet password and seed recovery tool. For seed based recovery, this is primarily useful in situations where you have lost/forgotten parts of your mnemonic, or have made

2 Aug 18, 2022
Simple crypto & blockchain implementation written in Python

JaamoCoin - simple Python blockchain example This is a very simple blockchain example written in Python. Based on this tutorial: https://medium.com/co

Jaakko Alajoki 1 Jan 07, 2022
Bombcrypto-robot - Python bot to automate BombCrypto game. Updated 01.02.2022

About: This is an open-source bot, the code is open for anyone to see, fork and

LarkoPa 120 Apr 15, 2022
A simple Python tool to help anyone use Liquidity Pools on the BitShares blockchain.

ACCOUNT AND ACTIVE KEY ARE NOT PERSISTENT, YOU WILL NEED TO ENTER THEM EACH TIME YOU LAUNCH THE APP (but not every transaction. that's a win). If / wh

Brendan Jensen 17 Jun 15, 2022
💰 An Alfred Workflow that provides current price of cryptocurrency

Coin Ticker for Alfred Workflow An Alfred Workflow that provides current price and status about cryptocurrency from cryptocompare.com. Supports Alfred

Bumsoo Kim (Ian) 14 Nov 17, 2022
Secure open-source password manager.

aes256_passwd_store This script securely encrypts or decrypts passwords on disk within a custom database file. It also features functionality to retri

14 Nov 15, 2022
SVSHI - Secure and Verified Smart Home Infrastructure

The SVSHI (Secure and Verified Smart Home Infrastructure) (pronounced like "sushi") project is a platform/runtime/toolchain for developing and running formally verified smart infrastructures, such as

Dependable Systems Laboratory 3 Oct 28, 2022
Dicoding Machine Learning for Expert Submission 1 - Predictive Analytics

Laporan Proyek Machine Learning - Azhar Rizki Zulma Domain Proyek Domain proyek yang dipilih dalam proyek machine learning ini adalah mengenai keuanga

Azhar Rizki Zulma 6 Jul 23, 2022
Generate bitcoin public and private keys and check if they match a filelist of existing addresses that have a nonzero balance

btc-heist Running Install deps, i.e., python3 -m pip install -r requirements.txt Download the CSV dump of all bitcoin addresses with a balance and cut

Denis Khoshaba 103 Dec 05, 2022
A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided

A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided. If you’ve found this bot useful and have profited from it please consider donating any

473 Dec 25, 2022
A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

Vinay Sajip 3 Feb 01, 2022
Quant & Systematic Crypto Research Tools

qsec Quant & Systematic Crypto Research Tools --WORK IN PROGRESS-- This repo is a collection of research tools to help in exploring and building sys

Darren Smith 3 Jul 12, 2022
Python program that handles the creation, encryption and storage of log/journal files. Kinda works like a diary of sorts.

LucaSoft J.O.U.R.N.A.L The J.O.U.R.N.A.L (Just anOther User Redaction & Navigation Assistant by Lucaspec72) is a Python program that handles the creat

Lucaspec72 8 Oct 27, 2021
Aplicação de monitoramento de valores de criptos através da API do Mercado Bitcoin.

myCrypto_MercadoBitcoin Aplicação de monitoramento de valores de criptos através da API do Mercado Bitcoin. Apoie esse projeto! 💵 💵 Olá! Você pode r

Vinícius Azevedo 122 Nov 27, 2022
A simple program written in python to convert: USD, EUR & BTC to BRL

CoinsPrice This is a simple program written in python to convert: USD EUR BTC to BRL, and I used an API to get coins price. Take a look at the window

Luiz Henrique 1 Feb 09, 2022
Amazing CryptoWAF was a CTF challenge for ALLES! CTF 2021

ctf-cryptowaf The AmazingCryptoWAF ™️ is used by the "noter" web app, to offer automagically military encryption for any user data. Even if an attacke

32 Jan 02, 2023
A curated list for getting up to speed on crypto and decentralized networks

crypto reading list A curated list for getting up to speed on crypto and decentralized networks. The content on the toplevel page contains what we con

Jump Crypto 1.1k Jan 07, 2023
Algo-burner - Burner account for the Algorand blockchain

algo-burner Burner address for Algorand's blockchain Apparently it was a problem

1 Jan 12, 2022
GmJEWEL - The monorepo for the Greedy Merchants Guild

Greedy Merchants Guild Hello! Welcome to the monorepo for the Greedy Merchants G

Greedy Merchants Guild 5 Mar 09, 2022
A Python implementation of CWT/COSE.

Python CWT - A Python implementation of CWT/COSE Python CWT is a CBOR Web Token (CWT) and CBOR Object Signing and Encryption (COSE) implementation com

Ajitomi Daisuke 13 Dec 14, 2022