# chain_context · Chromia Docs (concept)

> The chain_context namespace provides access to blockchain configuration and module arguments.

Source: https://docs.chromia.com/rell/language-features/systemlib/namespaces/chain_context/

# chain\_context

The [`chain_context`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/chain_context/) namespace provides access to blockchain configuration and module arguments. For complete API
documentation, see the
[`chain_context` reference](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/chain_context/) in the
Standard Library.

The `chain_context.args` field contains the module arguments specified in the `chromia.yml` configuration file.
`module_args` field must be defined as a user-defined struct within the entry point module named `module_name`. Access
to the `args` field is only possible if the `module_args` struct is defined.

Example of `module_args`:

Rell

```
struct module_args {
    name: text;
    age: integer;
}
```

Corresponding module configuration:

YAML

```
blockchains:
  module-args-example:
    module: example
    moduleArgs:
      example:
        name: Alice
        age: 46
```

Code that reads `module_args`:

Rell

```
function f() {
    print(chain_context.args.name);
    print(chain_context.args.age);
}
```

note

When configuring a module, you only need to explicitly specify values for attributes in `module_args` that differ from
their default values. If an attribute has a default value and you don't specify it, Rell will use the default value
during runtime. If all attributes have default values, you can omit the args section altogether, and default values will
be used for all attributes.

Every module can have its own `module_args`. Reading `chain_context.args` returns the args for the current module, and
the type of `chain_context.args` is different for different modules: it's the `module_args` struct defined in that
module.

* [`chain_context.blockchain_rid`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/chain_context/blockchain_rid/):
  This field contains a byte array representing the blockchain RID.
* [`chain_context.raw_config`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/chain_context/raw_config/):
  This field contains a GTV object representing the blockchain configuration, for example,
  `{"gtx":{"rell":{"mainFile":"main.rell"}}}`.

[View this page on docs.chromia.com](https://docs.chromia.com/rell/language-features/systemlib/namespaces/chain_context/)Content mirrored from the live docs
