This commit is contained in:
2024-03-18 14:28:08 +02:00
parent f9674a74b9
commit e12acb690e
876 changed files with 788 additions and 546 deletions

View File

@@ -1,3 +0,0 @@
smart_contrac_it1.png
smart_contract_intro.png
smartcontract_iac.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

View File

@@ -1,8 +0,0 @@
# Infrastructure As Code
![](img/iac_overview.jpg)
IAC = DevOps is a process framework that ensures collaboration between Development and Operations Team to deploy code to production environment faster in a repeatable and automated way. ... In simple terms, DevOps can be defined as an alignment between development and IT operations with better communication and collaboration.
![](img/smartcontract_iac.png)

View File

@@ -1,9 +0,0 @@
### Smart Contract IT Flow
The TFChain Blockchain will keep a record of all Entities, Twins, Nodes and Farmers in the TF-Grid network. This makes it easy to integrate the Smart Contract on TFChain as well since we can read from that storage in runtime.
![flow](img/smartcontract3_flow.jpg)
The Smart Contract on TFChain works as following:

View File

@@ -1,75 +0,0 @@
### Smart Contract IT Details
#### Smart Contract IT Data Structure
The user creates a contract using an SDK, user interface (browser) or the digital twin.
```js
contract = {
version: contractVersion,
contract_id: contractID,
twin_id: NumericTwinID for the contract,
// node_address is the node address.
node_id: NumericNodeID
// data is the encrypted deployment body. This encrypted the deployment with the **USER** public key. So only the user can read this data later on (or any other key that he keeps safe).
// this data part is read only by the user and can actually hold any information to help him reconstruct his deployment or can be left empty.
data: encrypted(deployment) // optional
// hash: is the deployment predictable hash. the node must use the same method to calculate the challenge (bytes) to compute this same hash.
//used for validating the deployment from node side.
deployment_hash: hash(deployment),
// public_ips: number of ips that need to be reserved by the contract and used by the deployment
public_ips: 0,
state: ContractState (created, deployed),
public_ips_list: list of public ips on this contract
}
```
- The `node_id` field is the target node's ID. A user can do lookup for a node to find its corresponding ID.
- The workload data is encrypted by the user and contains the workload definition for the node.
If `public_ips` is specified, the contract will reserve the number of public ips requested on the node's corresponding farm. If there are not enough ips available an error will be returned. If the contract is canceled by either the user or the node, the IPs for that contract will be freed.
This contract is registered on the blockchain.
#### Reliable Message Bus
The user sends the contractID and workload through the RMB to the destination Node.
RMB is our Reliable Message Bus, workload definitions don't get registerd on the TFChain but directly send peer2peer, this is more secure and private, the smart contract still controls the overall process.
The Node reads from the [RMB](https://github.com/threefoldtech/rmb) and sees a deploy command, it reads the contractID and workload definition from the payload.
It decodes the workload and reads the contract from chain using the contract ID, the Node will check if the user that created the contract and the deployment hash on the contract is the same as what the Node receives over RMB. If all things check out, the Node deploys the workload.
#### consumption reports
The Node periodically sends consumption reports back to the chain for each deployed contract. The chain will compute how much is being used and will charte the user in TFT.
A report looks like:
json
```
{
"contract_id": contractID,
"timestamp": "timestampOfReport",
"cru": cpus,
"sru": ssdInBytes,
"hru": hddInBytes,
"mru": memInBytes,
"nru": trafficInBytes
}
```
Usage of SU, CU and NU will be computed based on the prices and the rules that Threefold set out for cloud pricing.
Users need to pay using TFT.
#### encryption
Sending the workloads encrypted to the chain makes sure that nobody except the user can read his deployment data. It also facilitates a way for the user to recreate his workload data from the chain.
#### multiple users can sign the smart contract for IT
It's possible to sign workloads with multiple users to deploy a workload in all security.
Users can use multisignature for this (from v3.9.0).

View File

@@ -1,10 +0,0 @@
<!-- ## Smart Contract for IT
Ability for developers to launch IT workloads on the TFGrid using our TFGrid primitives. -->
{{#include smartcontract_it_intro.md}}
<!-- {{# include smartcontract_iac.md}} -->
{{#include smartcontract_it_flow.md}}

View File

@@ -1,14 +0,0 @@
## Smart Contract for IT Intro
Ability for developers to launch IT workloads (applications) on the ThreeFold Grid using our TFGrid primitives secured by blockchain concepts.
![](img/smart_contrac_it1.png)
Following benefits
- IT workloads can be deployed 100% deterministic, this means all specific properties of the workloads like necessary files, network bridges, processes, ... are all known at build time, this leads to good security and predictability.
- Consensus can be required for deploying a workload on the ThreeFold grid.
- Auditing and full transparancy on what has been deployed by who at what time.