Skip to content

Latest commit

 

History

History
231 lines (181 loc) · 6.58 KB

README.md

File metadata and controls

231 lines (181 loc) · 6.58 KB

SMACCO-Integration

SMACCO-Integration is a sophisticated framework designed to facilitate the integration of the SMart ACcount COmposer (SMACCO) within the EpicChain blockchain ecosystem. The SMACCO project aims to simplify the creation and management of "smart accounts" by offering advanced features for asset handling, security, and functionality. This integration provides users with powerful tools to manage their blockchain assets securely and efficiently.

Key Features

1. Smart Account Generation:
SMACCO-Integration enables users to generate smart accounts that are tailored to their specific needs. These accounts come with a range of features that can be customized to ensure secure and efficient asset management.

2. Public/Private Key Validation:
The integration supports robust cryptographic validation of public and private keys. This ensures that only authorized users can access and manage their assets, enhancing overall security.

3. Multi-Signature (MultiSig) Support:
SMACCO-Integration allows the implementation of multi-signature schemes. This feature requires multiple signatures for transactions, which adds an extra layer of security by ensuring that no single party can unilaterally perform sensitive actions.

4. Timelock Functionality:
Users can set conditions that restrict access to their assets until a specified time. This timelock functionality is particularly useful for scenarios where funds need to be held in escrow or restricted until certain conditions are met.

5. Asset-Specific Behavior:
SMACCO-Integration supports defining rules that restrict actions based on the type of asset. For example, it can limit withdrawals to specific assets, ensuring that only authorized assets can be managed or transacted.

Project Objectives

The primary goal of the SMACCO-Integration project is to provide a user-friendly interface that simplifies the process of generating and managing smart accounts. Initially, the focus will be on offering a JSON interface for creating C# code, which will eventually become part of the Advanced Virtual Machine (AVM). The project aims to develop visual interfaces in the future to facilitate the design process for general users, not just developers.

How to Use It

Installation and Usage

For Web Browsers:

To integrate SMACCO-Integration into your web application, include the following script:

<script src="https://unpkg.com/epicchain/dist/bundle.js"></script>

After including the script, you can access the SMACCO functionality in your JavaScript code:

Smacco = smacco.Smacco;

For npm:

To use SMACCO-Integration in a Node.js environment, install it via npm:

npm install epicchain

Then, you can require and use the SMACCO functionality in your JavaScript code:

const Smacco = require('epicchain').Smacco;
Examples

Here are some examples of how to use SMACCO-Integration for different scenarios:

1. Checking Simple Signature:

This example demonstrates how to validate a signature using a public key:

{
  "standard": "smacco-1.0",
  "input_type": "single",
  "pubkey_list": ["036245f426b4522e8a2901be6ccc1f71e37dc376726cc6665d80c5997e240568fb"],
  "rule": {
    "rule_type": "ALLOW_IF",
    "condition": {
      "condition_type": "CHECKSIG"
    }
  }
}

2. Checking Multiple Signatures (2/3 Multisig):

This example shows how to set up a multi-signature scheme requiring at least two out of three signatures:

{
  "standard": "smacco-1.0",
  "input_type": "array",
  "pubkey_list": [
    "036245f426b4522e8a2901be6ccc1f71e37dc376726cc6665d80c5997e240568fb",
    "0303897394935bb5418b1c1c4cf35513e276c6bd313ddd1330f113ec3dc34fbd0d",
    "02e2baf21e36df2007189d05b9e682f4192a101dcdf07eed7d6313625a930874b4"
  ],
  "rule": {
    "rule_type": "ALLOW_IF",
    "condition": {
      "condition_type": "CHECKMULTISIG",
      "minimum_required": "2"
    }
  }
}

3. Time Locking Funds (Until Timestamp 1536896190):

This example demonstrates how to lock funds until a specified timestamp:

{
  "standard": "smacco-1.0",
  "input_type": "single",
  "pubkey_list": ["036245f426b4522e8a2901be6ccc1f71e37dc376726cc6665d80c5997e240568fb"],
  "rules": [
    {
      "rule_type": "DENY_IF",
      "condition": {
        "condition_type": "TIMESTAMP_LESS",
        "timestamp": "1536896190"
      }
    },
    {
      "rule_type": "ALLOW_IF",
      "condition": {
        "condition_type": "CHECKSIG"
      }
    }
  ]
}

4. Complex Logic - Charity Donations Template:

This example illustrates the capability of handling complex logic for different assets, inspired by community discussions:

{
  "standard": "smacco-1.0",
  "input_type": "single",
  "pubkey_list": [
    "031a6c6fbbdf02ca351745fa86b9ba5a9452d785ac4f7fc2b7548ca2a46c4fcf4a",
    "036245f426b4522e8a2901be6ccc1f71e37dc376726cc6665d80c5997e240568fb"
  ],
  "rules": [
    {
      "rule_type": "ALLOW_IF",
      "condition": {
        "condition_type": "CHECKSIG",
        "pubkey": "0"
      }
    },
    {
      "rule_type": "ALLOW_IF",
      "condition": {
        "condition_type": "AND",
        "conditions": [
          {
            "condition_type": "CHECKSIG",
            "pubkey": "1"
          },
          {
            "condition_type": "OR",
            "conditions": [
              {
                "condition_type": "AND",
                "conditions": [
                  {
                    "condition_type": "SELF_TRANSFER"
                  },
                  {
                    "condition_type": "ONLY_EPICCHAIN"
                  }
                ]
              },
              {
                "condition_type": "ONLY_GAS"
              }
            ]
          }
        ]
      }
    }
  ],
  "default_rule": "DENY_ALL"
}

Documentation

For more detailed documentation on SMACCO-Integration.

Docs Requirements (Local Build)

To build the documentation locally, ensure you have Python 3 installed and then install the required dependencies:

python3 -m pip install -r docs/requirements.txt
make docs

For Developers

Testing:
Run the test suite with the following command:

npm test

Building:
Compile the project with Webpack using:

npm run build

Version Management:
To create a new minor version, use:

npm version minor

Publishing:
Push changes and tags to the repository and publish to npm with:

git push origin master --tags
npm publish

License

SMACCO-Integration is licensed under the MIT License. For more details, please refer to the LICENSE file included with the project.