Service Account

[Previous << Flow Token](https://qiita.com/flowcadence/items/41308221443f207a7921)
[Next >> Flow Fees](https://qiita.com/flowcadence/items/0f41148ca231a09d1efb)

https://qiita.com/flowcadence/items/3073d69c6e9895e68b5a#flow-developers

サービスアカウントは、Flowのコアプロトコル要求事項を管理するアカウントです。

| Network | Contract Address |
|:-:|:-:|
| Emulator | `0xf8d6e0586b0a20c7` |
| Cadence Testing Framework | `0x0000000000000001` |
| Testnet | `0x8c5303eaa26202d6` |
| Mainnet | `0xe467b9dd11fa00df` |

サービスアカウントにデプロイされた3つの重要なスマートコントラクトは以下です。
<h1>FlowServiceAccount</h1>

`FlowServiceAccount`は、トランザクション手数料やデプロイ許可(permissions)を追跡し、Flow Token操作のためのいくつかの簡便なメソッドを提供します。

Source: [FlowServiceAccount.cdc](https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowServiceAccount.cdc)

<h3>Events</h3>

`FlowServiceAccount`の重要なイベントは次のとおりです。

```ruby
access(all) event TransactionFeeUpdated(newFee: UFix64)
access(all) event AccountCreationFeeUpdated(newFee: UFix64)
```


<h1>RandomBeaconHistory</h1>

* `RandomBeaconHistory`は、Flowネットワークによって生成されたrandom sourcesの履歴を保存します。Flow Service Accountによって、全てのブロックにおける、ブロックのランダムソースを含む(block's source of randomness)タイミングで、定義済みのHeartbeatリソースが更新されます。

Source: [RandomBeaconHistory.cdc](https://github.com/onflow/flow-core-contracts/blob/master/contracts/RandomBeaconHistory.cdc)

<h3>Events</h3>

`RandomBeaconHistory`の重要なイベントは次のとおりです。

```ruby
/* Event emitted when missing SoRs from past heartbeats are detected and will be backfilled:
 *  - `blockHeight` is the height where the gap is detected
 *  - `gapStartHeight` is the height of the first missing entry detected */
access(all) event RandomHistoryMissing(blockHeight: UInt64, gapStartHeight: UInt64)

/* Event emitted when missing SoRs are backfilled on the current heartbeat:
 *  - `blockHeight` is the height where the backfill happened, it also defines the SoR used to backfill
 *  - `gapStartHeight` is the height of the first backfilled entry
 *  - `count` is the number of backfilled entries
 * Note that in very rare cases, the backfilled gap may not be contiguous. This event does not
 * fully define the backfilled entries in this case. */
access(all) event RandomHistoryBackfilled(blockHeight: UInt64, gapStartHeight: UInt64, count: UInt64)
```

<h1>NodeVersionBeacon</h1>

* `NodeVersionBeacon`は、指定されたブロック高でブロックを実行/処理されるのに使われる、過去のプロトコルバージョンと将来のプロトコルバージョンを保持しています。

Source: [NodeVersionBeacon.cdc](https://github.com/onflow/flow-core-contracts/blob/master/contracts/NodeVersionBeacon.cdc)


<h3>Events</h3>

`RandomBeaconHistory`の重要なイベントは次のとおりです。

```ruby
/** Event emitted when the version table is updated.
 *  It contains the current version and all the upcoming versions
 *  sorted by block height.
 *  The sequence increases by one each time an event is emitted.
 *  It can be used to verify no events were missed. */
access(all) event VersionBeacon(
    versionBoundaries: [VersionBoundary],
    sequence: UInt64
)

/** Event emitted any time the version boundary freeze period is updated.
 * freeze period is measured in blocks (from the current block). */
access(all) event NodeVersionBoundaryFreezePeriodChanged(freezePeriod: UInt64)
```


*Last updated on **Dec 17, 2024** by **j pimmel***

翻訳元

https://developers.flow.com/build/core-contracts/service-account

***

<b>[Previous << Flow Token](https://qiita.com/flowcadence/items/41308221443f207a7921)
</b>

[Flow blockchain / Cadence version1.0ドキュメント](https://qiita.com/flowcadence/items/3073d69c6e9895e68b5a) (Service Account)

<b>[Next >> Flow Fees](https://qiita.com/flowcadence/items/0f41148ca231a09d1efb)</b>